From c2a8f641ad195a2b35cf63062e8b4993efc6b818 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Aug 2022 10:22:27 +0800 Subject: [PATCH 01/62] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/IcCustomerReportDTO.java | 65 +++++++++++++++ .../java/com/epmet/dto/IcReportFunDTO.java | 64 +++++++++++++++ .../IcCustomerReportController.java | 70 ++++++++++++++++ .../controller/IcReportFunController.java | 70 ++++++++++++++++ .../com/epmet/dao/IcCustomerReportDao.java | 16 ++++ .../java/com/epmet/dao/IcReportFunDao.java | 16 ++++ .../epmet/entity/IcCustomerReportEntity.java | 31 +++++++ .../com/epmet/entity/IcReportFunEntity.java | 34 ++++++++ .../service/IcCustomerReportService.java | 78 ++++++++++++++++++ .../com/epmet/service/IcReportFunService.java | 78 ++++++++++++++++++ .../impl/IcCustomerReportServiceImpl.java | 82 +++++++++++++++++++ .../service/impl/IcReportFunServiceImpl.java | 82 +++++++++++++++++++ .../resources/mapper/IcCustomerReportDao.xml | 6 ++ .../main/resources/mapper/IcReportFunDao.xml | 6 ++ 14 files changed, 698 insertions(+) create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcCustomerReportDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcReportFunDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcReportFunController.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcReportFunDao.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcCustomerReportEntity.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcReportFunEntity.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcReportFunService.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcReportFunServiceImpl.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcReportFunDao.xml diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcCustomerReportDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcCustomerReportDTO.java new file mode 100644 index 0000000000..0ea2fa3416 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcCustomerReportDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Data +public class IcCustomerReportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 报表id + */ + private String reportId; + + /** + * 客户id + */ + private String customerId; + + /** + * 删除标识:0.未删除 1.已删除; + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间=绑定时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcReportFunDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcReportFunDTO.java new file mode 100644 index 0000000000..894bda4613 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcReportFunDTO.java @@ -0,0 +1,64 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Data +public class IcReportFunDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * ic_customer_report.id + */ + private String customerReportId; + + /** + * 功能类别来源于字典表key;eg:resi_info,house_info + */ + private String funCategoryKey; + + /** + * 删除标识:0.未删除 1.已删除; + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间=绑定时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java new file mode 100644 index 0000000000..59725b2cad --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -0,0 +1,70 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +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.dto.IcCustomerReportDTO; +import com.epmet.service.IcCustomerReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@RestController +@RequestMapping("icCustomerReport") +public class IcCustomerReportController { + + @Autowired + private IcCustomerReportService icCustomerReportService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = icCustomerReportService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + IcCustomerReportDTO data = icCustomerReportService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcCustomerReportDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icCustomerReportService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcCustomerReportDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icCustomerReportService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icCustomerReportService.delete(ids); + return new Result(); + } + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcReportFunController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcReportFunController.java new file mode 100644 index 0000000000..8f22b6939e --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcReportFunController.java @@ -0,0 +1,70 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +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.dto.IcReportFunDTO; +import com.epmet.service.IcReportFunService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@RestController +@RequestMapping("icReportFun") +public class IcReportFunController { + + @Autowired + private IcReportFunService icReportFunService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = icReportFunService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + IcReportFunDTO data = icReportFunService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcReportFunDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icReportFunService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcReportFunDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icReportFunService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icReportFunService.delete(ids); + return new Result(); + } + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java new file mode 100644 index 0000000000..32068db46a --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcCustomerReportEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Mapper +public interface IcCustomerReportDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcReportFunDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcReportFunDao.java new file mode 100644 index 0000000000..a1486095e2 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcReportFunDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcReportFunEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Mapper +public interface IcReportFunDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcCustomerReportEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcCustomerReportEntity.java new file mode 100644 index 0000000000..b43d2e9887 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcCustomerReportEntity.java @@ -0,0 +1,31 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_customer_report") +public class IcCustomerReportEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 报表id + */ + private String reportId; + + /** + * 客户id + */ + private String customerId; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcReportFunEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcReportFunEntity.java new file mode 100644 index 0000000000..b39c7fea27 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcReportFunEntity.java @@ -0,0 +1,34 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_report_fun") +public class IcReportFunEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * ic_customer_report.id + */ + private String customerReportId; + + /** + * 功能类别来源于字典表key;eg:resi_info,house_info + */ + private String funCategoryKey; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java new file mode 100644 index 0000000000..4f6f9af2cd --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.entity.IcCustomerReportEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +public interface IcCustomerReportService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-08-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-08-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcCustomerReportDTO + * @author generator + * @date 2022-08-08 + */ + IcCustomerReportDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-08 + */ + void save(IcCustomerReportDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-08 + */ + void update(IcCustomerReportDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-08 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcReportFunService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcReportFunService.java new file mode 100644 index 0000000000..567609f0cf --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcReportFunService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IcReportFunDTO; +import com.epmet.entity.IcReportFunEntity; + +import java.util.List; +import java.util.Map; + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +public interface IcReportFunService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-08-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-08-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcReportFunDTO + * @author generator + * @date 2022-08-08 + */ + IcReportFunDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-08 + */ + void save(IcReportFunDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-08 + */ + void update(IcReportFunDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-08 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java new file mode 100644 index 0000000000..9350625c0d --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.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.dao.IcCustomerReportDao; +import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.entity.IcCustomerReportEntity; +import com.epmet.service.IcCustomerReportService; +import org.apache.commons.lang3.StringUtils; +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-08-08 + */ +@Service +public class IcCustomerReportServiceImpl extends BaseServiceImpl implements IcCustomerReportService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcCustomerReportDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcCustomerReportDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IcCustomerReportDTO get(String id) { + IcCustomerReportEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcCustomerReportDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcCustomerReportDTO dto) { + IcCustomerReportEntity entity = ConvertUtils.sourceToTarget(dto, IcCustomerReportEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcCustomerReportDTO dto) { + IcCustomerReportEntity entity = ConvertUtils.sourceToTarget(dto, IcCustomerReportEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcReportFunServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcReportFunServiceImpl.java new file mode 100644 index 0000000000..bf2e8bece1 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcReportFunServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.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.dao.IcReportFunDao; +import com.epmet.dto.IcReportFunDTO; +import com.epmet.entity.IcReportFunEntity; +import com.epmet.service.IcReportFunService; +import org.apache.commons.lang3.StringUtils; +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-08-08 + */ +@Service +public class IcReportFunServiceImpl extends BaseServiceImpl implements IcReportFunService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcReportFunDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcReportFunDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IcReportFunDTO get(String id) { + IcReportFunEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcReportFunDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcReportFunDTO dto) { + IcReportFunEntity entity = ConvertUtils.sourceToTarget(dto, IcReportFunEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcReportFunDTO dto) { + IcReportFunEntity entity = ConvertUtils.sourceToTarget(dto, IcReportFunEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml new file mode 100644 index 0000000000..9e4b9347a2 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcReportFunDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcReportFunDao.xml new file mode 100644 index 0000000000..0da1a5ae81 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcReportFunDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From efbe5ef9d6a4ec76dc46427ad24a6a5eead3d2c9 Mon Sep 17 00:00:00 2001 From: syc Date: Mon, 8 Aug 2022 10:31:33 +0800 Subject: [PATCH 02/62] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=BF=9B=E5=B1=95=E5=A2=9E=E5=8A=A0=E5=86=85=E9=83=A8=E5=A4=87?= =?UTF-8?q?=E6=B3=A8=E3=80=81=E5=A4=84=E7=90=86=E4=B8=AD=E7=9A=84=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E7=AD=89=E4=BF=A1=E6=81=AF=E7=9A=84=E8=BF=94=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/IcEventProcessListResultDTO.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventProcessListResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventProcessListResultDTO.java index 65d28e6501..5afe520905 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventProcessListResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventProcessListResultDTO.java @@ -16,6 +16,10 @@ public class IcEventProcessListResultDTO implements Serializable { private static final long serialVersionUID = 5762152044573235897L; + /** + * 项目ID + */ + private String projectId; /** * 进展Id */ @@ -39,6 +43,26 @@ public class IcEventProcessListResultDTO implements Serializable { * 公开答复 */ private String publicReply; + /** + * 是否发送到外部系统 0否 1是 + */ + private Integer isSend; + /** + * 内部备注 + */ + private String internalRemark; + /** + * 子节点 + */ + private List subProcess; + /** + * 公开答复附件 + */ + private List publicFile; + /** + * 内部备注附件 + */ + private List internalFile; /** * 协办单位类型,1社区自组织,2联建单位 */ @@ -69,4 +93,5 @@ public class IcEventProcessListResultDTO implements Serializable { */ private String actualServiceTime; + } From 6f6c112157d48116c8951c66eeab35922c469214 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 8 Aug 2022 10:44:21 +0800 Subject: [PATCH 03/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0commons-feignclient=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E8=B0=83=E7=94=A8=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-commons-feignclient/pom.xml | 23 +++++++++++++++++++ .../com/epmet/commons/feignclient/.gitkeep | 0 .../epmet/commons/feignclient/dtos/.gitkeep | 0 .../epmet/commons/feignclient/feigns/.gitkeep | 0 pom.xml | 3 ++- 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 epmet-commons/epmet-commons-feignclient/pom.xml create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/.gitkeep create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/.gitkeep create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/.gitkeep diff --git a/epmet-commons/epmet-commons-feignclient/pom.xml b/epmet-commons/epmet-commons-feignclient/pom.xml new file mode 100644 index 0000000000..d0b611f882 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/pom.xml @@ -0,0 +1,23 @@ + + + + epmet-cloud + com.epmet + 2.0.0 + + + 4.0.0 + + epmet-commons-feignclient + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + + \ No newline at end of file diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/.gitkeep b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/.gitkeep b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/.gitkeep b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pom.xml b/pom.xml index ff15bf358e..95a3495790 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,8 @@ epmet-module epmet-user epmet-openapi - + epmet-commons/epmet-commons-feignclient + UTF-8 From cdd85d9346a77bb0629d5409d12d490cc537c23b Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Aug 2022 13:28:27 +0800 Subject: [PATCH 04/62] =?UTF-8?q?=E6=9A=82=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/result/ReportResultDTO.java | 84 +++++++++++++++++++ .../IcCustomerReportController.java | 13 +++ .../com/epmet/dao/IcCustomerReportDao.java | 13 ++- .../service/IcCustomerReportService.java | 9 ++ .../impl/IcCustomerReportServiceImpl.java | 24 ++++++ .../resources/mapper/IcCustomerReportDao.xml | 11 +++ 6 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java new file mode 100644 index 0000000000..cbbc75acca --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java @@ -0,0 +1,84 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/8 10:29 + * @DESC + */ +@Data +public class ReportResultDTO implements Serializable { + + private static final long serialVersionUID = -5798816843431200300L; + + /** + * 报表名字 + */ + private String reportName; + + /** + * 报表ID + */ + private String reportId; + + /** + * 客户ID + */ + @JsonIgnore + private String customerId; + + /** + * 客户名字 + */ + @JsonIgnore + private String customerName; + + /** + * 分类名字 + */ + @JsonIgnore + private String categoryName; + + /** + * 分类key + */ + @JsonIgnore + private String categoryKey; + + /** + * 客户信息集合 + */ + private List customerList; + + + @Data + static class CustomerList implements Serializable{ + + private static final long serialVersionUID = 7146198312265513418L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户名字 + */ + private String customerName; + + /** + * 分类名字 + */ + private String categoryName; + + /** + * 分类key + */ + private String categoryKey; + } +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index 59725b2cad..39b55f50af 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -9,10 +9,12 @@ 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.dto.IcCustomerReportDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.service.IcCustomerReportService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Map; @@ -67,4 +69,15 @@ public class IcCustomerReportController { return new Result(); } + /** + * Desc: 报表集合 + * @param + * @author zxc + * @date 2022/8/8 10:38 + */ + @PostMapping("list") + public Result> reportList(){ + return new Result>().ok(icCustomerReportService.reportList()); + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java index 32068db46a..52513402d2 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java @@ -1,9 +1,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 客户报表关系表 * @@ -12,5 +15,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcCustomerReportDao extends BaseDao { - + + /** + * Desc: 报表集合 + * @param + * @author zxc + * @date 2022/8/8 10:38 + */ + List reportList(); + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java index 4f6f9af2cd..544aeb9a83 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -3,6 +3,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import java.util.List; @@ -75,4 +76,12 @@ public interface IcCustomerReportService extends BaseService reportList(); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 9350625c0d..206e9c2d74 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -8,12 +8,17 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcCustomerReportDao; import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.service.IcCustomerReportService; +import org.apache.commons.collections4.CollectionUtils; 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.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -27,6 +32,9 @@ import java.util.Map; @Service public class IcCustomerReportServiceImpl extends BaseServiceImpl implements IcCustomerReportService { + @Autowired + private EpmetAdminOpenFeignClient adminOpenFeignClient; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -79,4 +87,20 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportList() { + List reportList = baseDao.reportList(); + if (CollectionUtils.isEmpty(reportList)){ + return new ArrayList<>(); + } + + return null; + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml index 9e4b9347a2..2336b1dc3d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml @@ -3,4 +3,15 @@ + + \ No newline at end of file From 345c885daca9ce4a7d5bc6c76b43ee9eb0c237d2 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Aug 2022 13:59:04 +0800 Subject: [PATCH 05/62] =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feigns/JiMuReportOpenFeignClient.java | 14 +++++++ .../JiMuReportOpenFeignClientFallback.java | 11 ++++++ .../tools/constant/ServiceConstant.java | 5 +++ .../tools/dto/form/DictListFormDTO.java | 4 ++ .../com/epmet/dto/result/ReportResultDTO.java | 2 +- .../constant/CustomerFunctionConstant.java | 2 + .../impl/IcCustomerReportServiceImpl.java | 38 ++++++++++++++++++- 7 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java new file mode 100644 index 0000000000..69f1f84c70 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -0,0 +1,14 @@ +package com.epmet.commons.feignclient.feigns; + +import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * @Author zxc + * @DateTime 2022/8/8 13:52 + * @DESC + */ +@FeignClient(name = ServiceConstant.JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallback.class) +public interface JiMuReportOpenFeignClient { +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java new file mode 100644 index 0000000000..f1ca95d23d --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java @@ -0,0 +1,11 @@ +package com.epmet.commons.feignclient.feigns.fallback; + +import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; + +/** + * @Author zxc + * @DateTime 2022/8/8 13:53 + * @DESC + */ +public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignClient { +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index 221d7d3f69..b753a7d65b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -143,4 +143,9 @@ public interface ServiceConstant { * 聚合查询服务 */ String DATA_AGGREGATOR_SERVER = "data-aggregator-server"; + + /** + * + */ + String JM_REPORT = ""; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java index 1880debe42..88adefbd17 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java @@ -1,6 +1,8 @@ package com.epmet.commons.tools.dto.form; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; @@ -9,6 +11,8 @@ import javax.validation.constraints.NotBlank; * @Author sun */ @Data +@AllArgsConstructor +@NoArgsConstructor public class DictListFormDTO { /** diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java index cbbc75acca..0667a0c226 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java @@ -57,7 +57,7 @@ public class ReportResultDTO implements Serializable { @Data - static class CustomerList implements Serializable{ + public static class CustomerList implements Serializable{ private static final long serialVersionUID = 7146198312265513418L; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java index dc347a7c53..5d41b4453c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java @@ -23,5 +23,7 @@ public interface CustomerFunctionConstant { */ String PARAMETER_EXCEPTION = "请至少勾选一条默认功能或定制功能数据"; + String REPORT_CATEGORY = "jmreport_category"; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 206e9c2d74..5e8e770abe 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -4,13 +4,21 @@ 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.dto.form.DictListFormDTO; +import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerFunctionConstant; import com.epmet.dao.IcCustomerReportDao; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.IcCustomerReportDTO; import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.IcCustomerReportService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -22,6 +30,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 客户报表关系表 @@ -34,6 +43,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl page(Map params) { @@ -99,8 +110,31 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl(); } - - return null; + Result> dictList = adminOpenFeignClient.dictList(new DictListFormDTO(CustomerFunctionConstant.REPORT_CATEGORY)); + if (!dictList.success()){ + throw new EpmetException("查询字典信息失败:" + CustomerFunctionConstant.REPORT_CATEGORY); + } + if (CollectionUtils.isNotEmpty(dictList.getData())){ + dictList.getData().forEach(d -> reportList.stream().filter(r -> d.getValue().equals(r.getCategoryKey())).forEach(r -> r.setCategoryName(d.getLabel()))); + } + Result> allCustomerList = operCrmOpenFeignClient.getAllCustomerList(); + if (!allCustomerList.success()){ + throw new EpmetException("获取客户信息失败..."); + } + if (CollectionUtils.isNotEmpty(allCustomerList.getData())){ + allCustomerList.getData().forEach(c -> reportList.stream().filter(r -> c.getId().equals(r.getCustomerId())).forEach(r -> r.setCustomerName(c.getCustomerName()))); + } + // todo 报表 + List result = new ArrayList<>(); + Map> groupByReport = reportList.stream().collect(Collectors.groupingBy(ReportResultDTO::getReportId)); + groupByReport.forEach((reportId,l) -> { + ReportResultDTO dto = new ReportResultDTO(); + dto.setReportId(reportId); + dto.setReportName(l.get(NumConstant.ZERO).getReportName()); + dto.setCustomerList(ConvertUtils.sourceToTarget(l, ReportResultDTO.CustomerList.class)); + result.add(dto); + }); + return result; } } \ No newline at end of file From dc83916024ee385eb3c8b30fe87f4d4ead45687e Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Aug 2022 14:01:58 +0800 Subject: [PATCH 06/62] =?UTF-8?q?=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/feignclient/feigns/JiMuReportOpenFeignClient.java | 2 +- .../java/com/epmet/commons/tools/constant/ServiceConstant.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java index 69f1f84c70..0c5dfb97ef 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -9,6 +9,6 @@ import org.springframework.cloud.openfeign.FeignClient; * @DateTime 2022/8/8 13:52 * @DESC */ -@FeignClient(name = ServiceConstant.JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallback.class) public interface JiMuReportOpenFeignClient { } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index b753a7d65b..61a428a953 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -147,5 +147,5 @@ public interface ServiceConstant { /** * */ - String JM_REPORT = ""; + String EPMET_JM_REPORT = "epmet-jmreport-server"; } From e2ed87a4697ac18f1b313e4f2f478c89596430c2 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 8 Aug 2022 14:07:18 +0800 Subject: [PATCH 07/62] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=B1=BB=E5=88=AB?= =?UTF-8?q?=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/V0.0.22__jmreport_category.sql | 5 ++++ .../epmet/dto/form/PreviewReportFormDTO.java | 29 +++++++++++++++++++ .../epmet/dto/result/PreviewReportResDTO.java | 18 ++++++++++++ .../IcCustomerReportController.java | 18 ++++++++++++ .../service/IcCustomerReportService.java | 9 ++++++ .../impl/IcCustomerReportServiceImpl.java | 24 ++++++++++++++- 6 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.22__jmreport_category.sql create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/PreviewReportFormDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/PreviewReportResDTO.java diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.22__jmreport_category.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.22__jmreport_category.sql new file mode 100644 index 0000000000..aa7b268044 --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.22__jmreport_category.sql @@ -0,0 +1,5 @@ +INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1556509011061993473', 'jmreport_category', '报表应用类别', '居民信息、房屋信息', 32, 0, 0, '1', '2022-08-08 13:14:01', '1', '2022-08-08 13:14:01'); + + +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1556509175185108994', 1556509011061993473, '房屋信息', 'house_info', '0', '', 2, 0, 0, '1', '2022-08-08 13:14:41', '1', '2022-08-08 13:14:41'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1556509102015475714', 1556509011061993473, '居民信息', 'resi_info', '0', '', 1, 0, 0, '1', '2022-08-08 13:14:23', '1', '2022-08-08 13:14:23'); diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/PreviewReportFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/PreviewReportFormDTO.java new file mode 100644 index 0000000000..c38eb53b1c --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/PreviewReportFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Map; + +/** + * @Description + * @Author yzm + * @Date 2022/8/8 13:31 + */ +@Data +public class PreviewReportFormDTO { + public interface AddUserInternalGroup { + } + + @NotBlank(message = "reportId不能为空", groups = AddUserInternalGroup.class) + private String reportId; + @NotBlank(message = "categoryKey不能为空", groups = AddUserInternalGroup.class) + private String categoryKey; + private Map paramMap; + + @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) + private String customerId; + @NotBlank(message = "staffId不能为空", groups = AddUserInternalGroup.class) + private String staffId; +} + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/PreviewReportResDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/PreviewReportResDTO.java new file mode 100644 index 0000000000..aaff6e933b --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/PreviewReportResDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/8/8 13:37 + */ +@Data +public class PreviewReportResDTO { + private String reportId; + /** + * rediskey格式:customerId:reportId:resiinfo:staffId + */ + private String paramKey; +} + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index 59725b2cad..7c8a317964 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -1,7 +1,9 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -9,6 +11,8 @@ 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.dto.IcCustomerReportDTO; +import com.epmet.dto.form.PreviewReportFormDTO; +import com.epmet.dto.result.PreviewReportResDTO; import com.epmet.service.IcCustomerReportService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -67,4 +71,18 @@ public class IcCustomerReportController { return new Result(); } + + /** + * 在居民信息或者房屋信息等页面点击填表,存储入参到redis,返给前端key + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("preview") + public Result previewReport(@LoginUser TokenDto tokenDto, @RequestBody PreviewReportFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, PreviewReportFormDTO.AddUserInternalGroup.class); + return new Result().ok(icCustomerReportService.previewReport(formDTO)); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java index 4f6f9af2cd..b69e1d0e46 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -3,6 +3,8 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.dto.form.PreviewReportFormDTO; +import com.epmet.dto.result.PreviewReportResDTO; import com.epmet.entity.IcCustomerReportEntity; import java.util.List; @@ -75,4 +77,11 @@ public interface IcCustomerReportService extends BaseService implements IcCustomerReportService { - + @Autowired + private RedisUtils redisUtils; @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -79,4 +85,20 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl Date: Mon, 8 Aug 2022 14:09:33 +0800 Subject: [PATCH 08/62] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B2=A1=E7=94=A8?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IcCustomerReportController.java | 37 ----------- .../service/IcCustomerReportService.java | 66 +------------------ .../impl/IcCustomerReportServiceImpl.java | 51 +------------- 3 files changed, 5 insertions(+), 149 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index a00410f7a7..bd71da40d4 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -35,43 +35,6 @@ public class IcCustomerReportController { @Autowired private IcCustomerReportService icCustomerReportService; - @RequestMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = icCustomerReportService.page(params); - return new Result>().ok(page); - } - - @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ - IcCustomerReportDTO data = icCustomerReportService.get(id); - return new Result().ok(data); - } - - @NoRepeatSubmit - @PostMapping("save") - public Result save(@RequestBody IcCustomerReportDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icCustomerReportService.save(dto); - return new Result(); - } - - @NoRepeatSubmit - @PostMapping("update") - public Result update(@RequestBody IcCustomerReportDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - icCustomerReportService.update(dto); - return new Result(); - } - - @PostMapping("delete") - public Result delete(@RequestBody String[] ids){ - //效验数据 - AssertUtils.isArrayEmpty(ids, "id"); - icCustomerReportService.delete(ids); - return new Result(); - } /** * Desc: 报表集合 diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java index 9219ef0382..fb1fb27de5 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -1,12 +1,12 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.dto.form.PreviewReportFormDTO; +import com.epmet.dto.result.PreviewReportResDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import java.util.List; -import java.util.Map; /** * 客户报表关系表 @@ -16,66 +16,6 @@ import java.util.Map; */ public interface IcCustomerReportService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2022-08-08 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2022-08-08 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return IcCustomerReportDTO - * @author generator - * @date 2022-08-08 - */ - IcCustomerReportDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2022-08-08 - */ - void save(IcCustomerReportDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2022-08-08 - */ - void update(IcCustomerReportDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2022-08-08 - */ - void delete(String[] ids); - /** * Desc: 报表集合 * @param diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 313901118b..125b42a422 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -1,25 +1,22 @@ package com.epmet.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.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.form.DictListFormDTO; import com.epmet.commons.tools.dto.result.DictListResultDTO; import com.epmet.commons.tools.exception.EpmetException; -import com.epmet.commons.tools.constant.StrConstant; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerFunctionConstant; import com.epmet.dao.IcCustomerReportDao; import com.epmet.dto.CustomerDTO; -import com.epmet.dto.IcCustomerReportDTO; -import com.epmet.dto.result.ReportResultDTO; import com.epmet.dto.form.PreviewReportFormDTO; import com.epmet.dto.result.PreviewReportResDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; @@ -28,10 +25,8 @@ import org.apache.commons.collections4.CollectionUtils; 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.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -52,21 +47,6 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, IcCustomerReportDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, IcCustomerReportDTO.class); - } private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); @@ -77,33 +57,6 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl Date: Mon, 8 Aug 2022 14:12:06 +0800 Subject: [PATCH 09/62] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=9A=82=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/ReportEditFormDTO.java | 33 +++++++++++++++++++ .../IcCustomerReportController.java | 29 ++++++++++------ .../service/IcCustomerReportService.java | 11 +++++++ .../impl/IcCustomerReportServiceImpl.java | 14 ++++++++ 4 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java new file mode 100644 index 0000000000..d1e72f7d15 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/8 14:04 + * @DESC + */ +@Data +public class ReportEditFormDTO implements Serializable { + + private static final long serialVersionUID = -2157859106926125470L; + + public interface ReportEditForm{} + + /** + * 操作类型,批量操作:add;单个编辑:edit + */ + @NotBlank(message = "type不能为空", groups = ReportEditForm.class) + private String type; + + @NotBlank(message = "reportId不能为空", groups = ReportEditForm.class) + private String reportId; + + private List customerIds; + + private List categoryKeys; +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index bd71da40d4..922bf28af4 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -1,25 +1,21 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.aop.NoRepeatSubmit; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; 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.dto.IcCustomerReportDTO; -import com.epmet.dto.result.ReportResultDTO; import com.epmet.dto.form.PreviewReportFormDTO; +import com.epmet.dto.form.ReportEditFormDTO; import com.epmet.dto.result.PreviewReportResDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.service.IcCustomerReportService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; -import java.util.Map; /** @@ -61,4 +57,17 @@ public class IcCustomerReportController { ValidatorUtils.validateEntity(formDTO, PreviewReportFormDTO.AddUserInternalGroup.class); return new Result().ok(icCustomerReportService.previewReport(formDTO)); } + /** + * Desc: 报表编辑 + * @param formDTO + * @author zxc + * @date 2022/8/8 14:09 + */ + @PostMapping("edit") + public Result reportEdit(@RequestBody ReportEditFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ReportEditFormDTO.ReportEditForm.class); + icCustomerReportService.reportEdit(formDTO); + return new Result(); + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java index fb1fb27de5..372dfa5bed 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -3,6 +3,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.form.PreviewReportFormDTO; import com.epmet.dto.result.PreviewReportResDTO; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.dto.form.ReportEditFormDTO; import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; @@ -30,4 +33,12 @@ public interface IcCustomerReportService extends BaseService Date: Mon, 8 Aug 2022 14:28:42 +0800 Subject: [PATCH 10/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0AOP=E6=8B=A6=E6=88=AA=E5=99=A8=EF=BC=8C?= =?UTF-8?q?=E5=92=8C=E5=AF=B9=E5=BA=94=E7=9A=84=E6=B3=A8=E8=A7=A3=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E6=8B=A6=E6=88=AAurl=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E7=BB=99=E5=85=B7=E6=9C=89@RequestBody=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=E7=9A=84=E5=85=A5=E5=8F=82=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/annotation/ReportRequest.java | 13 ++++ .../tools/aspect/ReportRequestAspect.java | 74 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ReportRequest.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ReportRequest.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ReportRequest.java new file mode 100644 index 0000000000..41a9379fe0 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ReportRequest.java @@ -0,0 +1,13 @@ +package com.epmet.commons.tools.annotation; + +import java.lang.annotation.*; + +/** + * 标记一个接口,它会被报表服务所调用 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ReportRequest { + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java new file mode 100644 index 0000000000..81dc4facf1 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java @@ -0,0 +1,74 @@ +package com.epmet.commons.tools.aspect; + +import cn.hutool.core.bean.BeanUtil; +import com.epmet.commons.tools.redis.RedisUtils; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import java.lang.reflect.Parameter; +import java.util.Map; + +/** + * 需要被报表服务请求的api,需要加上这个注解 + * 1.该注解会取url中固定的key,去redis获取参数,给入参dto复制 + */ +@Aspect +@Component +@Order(20) +public class ReportRequestAspect { + + /** + * 从redis中取参数用 + */ + public static final String REPORT_REDIS_KEY = "paramKey"; + + @Autowired + private RedisUtils redisUtils; + + @Before("@annotation(com.epmet.commons.tools.annotation.ReportRequest)") + public void before(JoinPoint point) { + RequestAttributes ra = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) ra; + String paramKey = sra.getRequest().getParameter(REPORT_REDIS_KEY); + if (StringUtils.isBlank(paramKey)) { + // 没有携带key参数,直接跳过 + return; + } + + Map cachedParams = redisUtils.hGetAll(paramKey); + + // 使用方法签名获取出参数class列表 + Object[] args = point.getArgs(); + MethodSignature signature = (MethodSignature) point.getSignature(); + Parameter[] parameters = signature.getMethod().getParameters(); + fillArgsToRequestBody(args, cachedParams, parameters); + } + + /** + * 将redis中取出的参数,赋值到指定的入参dto上 + * @param args + * @param storedParams + */ + private void fillArgsToRequestBody(Object[] args, Map storedParams, Parameter[] parameters) { + for (int i = 0; i < args.length; i++) { + Object arg = args[i]; + Class argClazz = arg.getClass(); + RequestBody requestBodyAnno = parameters[i].getAnnotation(RequestBody.class); + if (arg != null && requestBodyAnno != null) { + Object argBean = BeanUtil.mapToBean(storedParams, arg.getClass(), true); + BeanUtil.copyProperties(argBean, arg); + return; + } + } + } +} From ac7fc2032b0e526e3d6061008463fc092c5d11d5 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 8 Aug 2022 14:36:20 +0800 Subject: [PATCH 11/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0AOP=E6=8B=A6=E6=88=AA=E5=99=A8=EF=BC=8C?= =?UTF-8?q?=E5=92=8C=E5=AF=B9=E5=BA=94=E7=9A=84=E6=B3=A8=E8=A7=A3=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E6=8B=A6=E6=88=AAurl=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E7=BB=99=E5=85=B7=E6=9C=89@RequestBody=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=E7=9A=84=E5=85=A5=E5=8F=82=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/aspect/ReportRequestAspect.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java index 81dc4facf1..2c7dc898d9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java @@ -1,7 +1,10 @@ package com.epmet.commons.tools.aspect; import cn.hutool.core.bean.BeanUtil; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.redis.RedisUtils; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; @@ -25,6 +28,7 @@ import java.util.Map; @Aspect @Component @Order(20) +@Slf4j public class ReportRequestAspect { /** @@ -46,6 +50,11 @@ public class ReportRequestAspect { } Map cachedParams = redisUtils.hGetAll(paramKey); + if (cachedParams == null || cachedParams.size() == 0) { + log.warn("【报表服务】根据paramKey:{}未获取到有效的参数缓存。", paramKey); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "参数失效", "参数失效"); + // redis中没有此参数 + } // 使用方法签名获取出参数class列表 Object[] args = point.getArgs(); From 46b0781fdeb2ad8c9220c36dfb8c5c32fa2bd228 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 8 Aug 2022 14:41:26 +0800 Subject: [PATCH 12/62] fanhui key --- .../java/com/epmet/service/impl/IcCustomerReportServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 125b42a422..dea2c795bc 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -109,6 +109,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl Date: Mon, 8 Aug 2022 14:44:45 +0800 Subject: [PATCH 13/62] =?UTF-8?q?=E5=90=88=E4=B8=A2=E4=BA=86=E5=90=97?= =?UTF-8?q?=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/IcCustomerReportServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index fad0275192..33cd63ca07 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -15,9 +15,8 @@ import com.epmet.constant.CustomerFunctionConstant; import com.epmet.dao.IcCustomerReportDao; import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.PreviewReportFormDTO; -import com.epmet.dto.result.PreviewReportResDTO; -import com.epmet.dto.IcCustomerReportDTO; import com.epmet.dto.form.ReportEditFormDTO; +import com.epmet.dto.result.PreviewReportResDTO; import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; @@ -27,6 +26,7 @@ import org.apache.commons.collections4.CollectionUtils; 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.ArrayList; import java.util.List; From ccd9c8c5d36d649c144a251b70412ee799791ef5 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 8 Aug 2022 14:56:32 +0800 Subject: [PATCH 14/62] =?UTF-8?q?orgProjectDetailList=E8=AF=95=E4=B8=8B?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dataaggre/controller/GovOrgController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index bbf8011130..073a181d18 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; @@ -455,6 +456,7 @@ public class GovOrgController { * @Author zhaoqifeng * @Date 2022/7/28 10:34 */ + @ReportRequest @PostMapping("orgProjectDetailList") public Result> orgProjectDetailList(@LoginUser TokenDto tokenDto, @RequestBody OrgStatisticsFormDTO formDTO) { return new Result>().ok(govOrgService.orgProjectDetailList(tokenDto, formDTO)); From 5b3dde38edbf62acde8796ff4ed4300001743140 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Aug 2022 15:05:38 +0800 Subject: [PATCH 15/62] =?UTF-8?q?=E6=9A=82=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/ReportEditFormDTO.java | 16 +++++++- .../constant/CustomerFunctionConstant.java | 3 ++ .../com/epmet/dao/IcCustomerReportDao.java | 5 +++ .../impl/IcCustomerReportServiceImpl.java | 40 +++++++++++++++++++ .../resources/mapper/IcCustomerReportDao.xml | 21 ++++++++++ 5 files changed, 83 insertions(+), 2 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java index d1e72f7d15..3bb7871caa 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.dto.form; import lombok.Data; +import javax.validation.Valid; import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.util.List; @@ -27,7 +28,18 @@ public class ReportEditFormDTO implements Serializable { @NotBlank(message = "reportId不能为空", groups = ReportEditForm.class) private String reportId; - private List customerIds; + @Valid + private List customerList; - private List categoryKeys; + + @Data + public static class CustomerReportEditForm implements Serializable{ + + private static final long serialVersionUID = 8154093835160706134L; + + private List categoryKeys; + + @NotBlank(message = "customerId不能为空", groups = ReportEditForm.class) + private String customerId; + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java index 5d41b4453c..b5cbc36f11 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java @@ -25,5 +25,8 @@ public interface CustomerFunctionConstant { String REPORT_CATEGORY = "jmreport_category"; + String REPORT_EDIT = "edit"; + String REPORT_ADD = "add"; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java index 52513402d2..89b4578045 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java @@ -4,6 +4,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -24,4 +25,8 @@ public interface IcCustomerReportDao extends BaseDao { */ List reportList(); + void delCustomerReport(@Param("customerIds") List customerIds); + + void delCustomerReportFun(@Param("reportIds") List reportIds); + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 33cd63ca07..07875f7537 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -19,9 +19,11 @@ import com.epmet.dto.form.ReportEditFormDTO; import com.epmet.dto.result.PreviewReportResDTO; import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; +import com.epmet.entity.IcReportFunEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.IcCustomerReportService; +import com.epmet.service.IcReportFunService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -29,6 +31,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -48,6 +51,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl getWrapper(Map params){ @@ -124,7 +129,42 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl entities = new ArrayList<>(); + List funEntities = new ArrayList<>(); + formDTO.getCustomerList().forEach(c -> { + IcCustomerReportEntity reportEntity = new IcCustomerReportEntity(); + reportEntity.setReportId(formDTO.getReportId()); + reportEntity.setCustomerId(c.getCustomerId()); + if (CollectionUtils.isNotEmpty(c.getCategoryKeys())){ + c.getCategoryKeys().forEach(key -> { + IcReportFunEntity funEntity = new IcReportFunEntity(); + funEntity.setCustomerReportId(formDTO.getReportId()); + funEntity.setFunCategoryKey(key); + funEntities.add(funEntity); + }); + } + entities.add(reportEntity); + }); + insetCustomerReportAndFun(entities,funEntities); + } + } + @Transactional(rollbackFor = Exception.class) + public void insetCustomerReportAndFun(List reportEntities,List funEntities){ + if (CollectionUtils.isNotEmpty(reportEntities)){ + insertBatch(reportEntities); + } + if (CollectionUtils.isNotEmpty(funEntities)){ + reportFunService.insertBatch(funEntities); + } } } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml index 2336b1dc3d..073fcbaa89 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml @@ -3,6 +3,27 @@ + + DELETE FROM ic_customer_report + + WHERE CUSTOMER_ID IN ( + + #{c} + + ) + + + + DELETE FROM ic_report_fun + + WHERE CUSTOMER_REPORT_ID IN ( + + #{r} + + ) + + + + + + \ No newline at end of file From caa74b8edeef21fec37c7bbd4bfe5a28faf24902 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 8 Aug 2022 15:50:04 +0800 Subject: [PATCH 18/62] =?UTF-8?q?=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dataaggre/controller/GovOrgController.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 073a181d18..bbf8011130 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -5,7 +5,6 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; @@ -456,7 +455,6 @@ public class GovOrgController { * @Author zhaoqifeng * @Date 2022/7/28 10:34 */ - @ReportRequest @PostMapping("orgProjectDetailList") public Result> orgProjectDetailList(@LoginUser TokenDto tokenDto, @RequestBody OrgStatisticsFormDTO formDTO) { return new Result>().ok(govOrgService.orgProjectDetailList(tokenDto, formDTO)); From 9246e6df131e0e59a9e5ba2c401c35176d590543 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 9 Aug 2022 10:17:11 +0800 Subject: [PATCH 19/62] =?UTF-8?q?listresi=E8=AF=95=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/controller/IcResiUserController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index f958d975d3..778740a9a6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -25,6 +25,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; @@ -368,6 +369,7 @@ public class IcResiUserController implements ResultDataResolver { return new Result<>(); } + @ReportRequest @PostMapping("listresi") @MaskResponse(fieldNames = {"MOBILE", "ID_CARD"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) public Result>> queryListResi1(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO) { From 97ae52f67a0e49655fab2b8d43f2f6ce7cb57014 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 9 Aug 2022 10:22:17 +0800 Subject: [PATCH 20/62] huifu --- .../java/com/epmet/controller/IssueManageController.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java index e5013de9f1..a77e531b26 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java @@ -1,7 +1,6 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.enums.RequirePermissionEnum; @@ -134,10 +133,8 @@ public class IssueManageController { * @author wangc * @date 2020.05.14 13:58 **/ - //先注释掉权限注解 - @ReportRequest @PostMapping(value = "closedlist") - // @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_CLOSED_LIST) + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_CLOSED_LIST) public Result> closedList( @RequestBody CommonIssueListFormDTO issueListFormDTO){ ValidatorUtils.validateEntity(issueListFormDTO); return new Result>().ok(issueService.closedListGov(issueListFormDTO)); From 24435dbb753760c229a5ff4631c6fead023241d1 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 9 Aug 2022 10:45:04 +0800 Subject: [PATCH 21/62] =?UTF-8?q?house/houselist=E6=94=BE=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/controller/HouseController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index 62dfafccdf..f3eea5b2db 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -27,6 +27,7 @@ import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.ServiceConstant; @@ -105,6 +106,7 @@ public class HouseController implements ResultDataResolver { @Autowired private IcHouseDao icHouseDao; + @ReportRequest @PostMapping("houselist") @MaskResponse(fieldNames = {"ownerIdCard", "ownerPhone"}, fieldsMaskType = {MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_MOBILE}) From a36655d7bcf73cb54671f72cc72e60458e221e8a Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 9 Aug 2022 14:07:43 +0800 Subject: [PATCH 22/62] =?UTF-8?q?=E6=9A=82=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dtos/form/JiMuReportFormDTO.java | 2 + .../dtos/result/JiMuReportResultDTO.java | 2 + .../feigns/JiMuReportOpenFeignClient.java | 20 +++- .../JiMuReportOpenFeignClientFallback.java | 15 +++ ...uReportOpenFeignClientFallbackFactory.java | 24 ++++ .../tools/utils/HttpClientManager.java | 28 +++++ .../com/epmet/dto/result/ReportResultDTO.java | 7 ++ .../com/epmet/dao/IcCustomerReportDao.java | 2 +- .../impl/IcCustomerReportServiceImpl.java | 113 +++++++++++++++--- .../resources/mapper/IcCustomerReportDao.xml | 13 +- 10 files changed, 203 insertions(+), 23 deletions(-) create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallbackFactory.java diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JiMuReportFormDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JiMuReportFormDTO.java index 03a5e5aa24..caf58ec9a9 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JiMuReportFormDTO.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JiMuReportFormDTO.java @@ -28,4 +28,6 @@ public class JiMuReportFormDTO implements Serializable { * 类别 */ private List categoryKeys; + + private String id; } diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java index a7e7291791..9f48ab6bba 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java @@ -19,4 +19,6 @@ public class JiMuReportResultDTO implements Serializable { private String name; private String id; + private String reportId; + private String reportName; } diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java index 0c5dfb97ef..f6afa4d9a4 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -1,14 +1,30 @@ package com.epmet.commons.feignclient.feigns; -import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallback; +import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; +import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO; +import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallbackFactory; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; /** * @Author zxc * @DateTime 2022/8/8 13:52 * @DESC */ -@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallback.class) +//@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class) +@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class, url = "localhost:8118") public interface JiMuReportOpenFeignClient { + + @GetMapping("jmreport/excelQuery") + Result getList(@RequestParam("pageNo") Integer pageNo,@RequestParam("pageSize") Integer pageSize, + @RequestParam("reportType") String reportType, + @RequestParam("token") String token); + + @GetMapping("jmreport/show") + Result getReport(@RequestBody JiMuReportFormDTO formDTO); + } diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java index f1ca95d23d..24b5580256 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java @@ -1,6 +1,11 @@ package com.epmet.commons.feignclient.feigns.fallback; +import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; +import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO; 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; /** * @Author zxc @@ -8,4 +13,14 @@ import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; * @DESC */ public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignClient { + + @Override + public Result getList(Integer pageNo, Integer pageSize, String reportType, String token) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_JM_REPORT, "getList",pageNo,pageSize,reportType, token); + } + + @Override + public Result getReport(JiMuReportFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_JM_REPORT, "getReport",formDTO); + } } diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallbackFactory.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallbackFactory.java new file mode 100644 index 0000000000..e0274436c2 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallbackFactory.java @@ -0,0 +1,24 @@ +package com.epmet.commons.feignclient.feigns.fallback; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @Author zxc + * @DateTime 2022/8/9 13:27 + * @DESC + */ +@Slf4j +@Component +public class JiMuReportOpenFeignClientFallbackFactory implements FallbackFactory { + + private JiMuReportOpenFeignClientFallback fallback = new JiMuReportOpenFeignClientFallback(); + + @Override + public JiMuReportOpenFeignClientFallback create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 4fe6be37da..69b9d87b97 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -443,6 +443,34 @@ public class HttpClientManager { } } + public Result sendGet(String url, Map params, Map headerMap) { + + try { + URIBuilder builder = new URIBuilder(url); + if (!CollectionUtils.isEmpty(params)) { + Set set = params.keySet(); + for (String key : set) { + builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key))); + } + } + + System.out.println(builder.getPath()); + HttpGet httpGet = new HttpGet(builder.build()); + httpGet.setConfig(requestConfig); + if (null != headerMap){ + headerMap.forEach((k,v) -> { + if (StringUtils.isNotBlank(k)) { + httpGet.addHeader(k, v == null ? null : v.toString()); + } + }); + } + return execute(httpGet,false); + } catch (Exception e) { + log.error("sendGet exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + private Result execute(HttpRequestBase httpMethod, boolean isHttps) { CloseableHttpResponse response = null; try { diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java index 0667a0c226..b8638c3b5c 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -81,4 +82,10 @@ public class ReportResultDTO implements Serializable { */ private String categoryKey; } + + public ReportResultDTO() { + this.reportName = ""; + this.reportId = ""; + this.customerList = new ArrayList<>(); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java index b7a7e93a01..0e467ca8dc 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java @@ -23,7 +23,7 @@ public interface IcCustomerReportDao extends BaseDao { * @author zxc * @date 2022/8/8 10:38 */ - List reportList(); + List reportList(@Param("categoryKeys")List categoryKeys); /** * Desc: 根据客户IDs获取ids diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index d939a18a79..248beb49ff 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -1,8 +1,11 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO; +import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; @@ -12,6 +15,8 @@ import com.epmet.commons.tools.dto.result.DictListResultDTO; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerFunctionConstant; import com.epmet.dao.IcCustomerReportDao; @@ -27,16 +32,15 @@ import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.IcCustomerReportService; import com.epmet.service.IcReportFunService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; 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.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.net.InetAddress; +import java.util.*; import java.util.stream.Collectors; /** @@ -46,6 +50,7 @@ import java.util.stream.Collectors; * @since v1.0.0 2022-08-08 */ @Service +@Slf4j public class IcCustomerReportServiceImpl extends BaseServiceImpl implements IcCustomerReportService { @Autowired private RedisUtils redisUtils; @@ -56,6 +61,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl getWrapper(Map params){ @@ -75,10 +82,30 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportList() { - List reportList = baseDao.reportList(); - if (CollectionUtils.isEmpty(reportList)){ + Result list = jiMuReportOpenFeignClient.getList(1,10000,"datainfo", EpmetRequestHolder.getHeader("Authorization")); + Result url = getUrl(2, null); + log.info(url.toString()); + Map map = JSON.parseObject(url.getData(), Map.class); + Map map2 = (Map)map.get("result"); + List> map3 = (List>) map2.get("records"); + List allReports = new ArrayList<>(); + map3.forEach(m -> { + allReports.add(ConvertUtils.mapToEntity(m,JiMuReportResultDTO.class)); + }); + if (CollectionUtils.isEmpty(allReports)){ return new ArrayList<>(); } + List allReportList = new ArrayList<>(); + allReports.forEach(r -> { + ReportResultDTO dto = new ReportResultDTO(); + dto.setReportId(r.getId()); + dto.setReportName(r.getName()); + allReportList.add(dto); + }); + List reportList = baseDao.reportList(null); + if (CollectionUtils.isEmpty(reportList)){ + return allReportList; + } Result> dictList = adminOpenFeignClient.dictList(new DictListFormDTO(CustomerFunctionConstant.REPORT_CATEGORY)); if (!dictList.success()){ throw new EpmetException("查询字典信息失败:" + CustomerFunctionConstant.REPORT_CATEGORY); @@ -93,17 +120,9 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportList.stream().filter(r -> c.getId().equals(r.getCustomerId())).forEach(r -> r.setCustomerName(c.getCustomerName()))); } - // todo 报表 - List result = new ArrayList<>(); Map> groupByReport = reportList.stream().collect(Collectors.groupingBy(ReportResultDTO::getReportId)); - groupByReport.forEach((reportId,l) -> { - ReportResultDTO dto = new ReportResultDTO(); - dto.setReportId(reportId); - dto.setReportName(l.get(NumConstant.ZERO).getReportName()); - dto.setCustomerList(ConvertUtils.sourceToTarget(l, ReportResultDTO.CustomerList.class)); - result.add(dto); - }); - return result; + groupByReport.forEach((reportId,l) -> allReportList.stream().filter(a -> a.getReportId().equals(reportId)).forEach(a -> a.setCustomerList(ConvertUtils.sourceToTarget(l, ReportResultDTO.CustomerList.class)))); + return allReportList; } /** @@ -173,7 +192,25 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportIdAndName(ReportListFormDTO formDTO) { - return null; + List reportList = baseDao.reportList(formDTO.getCategoryKeys()); + if (CollectionUtils.isEmpty(reportList)){ + return new ArrayList<>(); + } + List recordIds = reportList.stream().map(m -> m.getReportId()).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); + List result = new ArrayList<>(); + recordIds.forEach(r -> { + JiMuReportFormDTO form = new JiMuReportFormDTO(); + form.setId(r); +// Result url = getUrl(NumConstant.ONE, r); +// if (!report.success()){ +// throw new EpmetException("查询报表失败:"+r); +// } +// JiMuReportResultDTO data = report.getData(); +// data.setReportId(data.getId()); +// data.setReportName(data.getReportName()); +// result.add(data); + }); + return result; } @Transactional(rollbackFor = Exception.class) @@ -186,4 +223,46 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl getUrl(Integer type,String id) { + String add = ""; + Result result; + try { + InetAddress localHost = InetAddress.getLocalHost(); +// add = localHost.getHostAddress(); + add = "http://192.168.1.141:8118"; + System.out.println(add); + }catch (Exception e){ + log.warn("获取url失败"); + } + if (type.compareTo(NumConstant.TWO) == NumConstant.ZERO){ + add = add.concat("/jmreport/excelQuery"); + Map params = new HashMap<>(16); + params.put("pageNo",1); + params.put("pageSize",10000); + params.put("reportType","datainfo"); + params.put("name",""); + params.put("token", EpmetRequestHolder.getHeader("Authorization")); + Map headers = new HashMap<>(16); + headers.put("token", EpmetRequestHolder.getHeader("Authorization")); + headers.put("X-Access-Token", EpmetRequestHolder.getHeader("Authorization")); + headers.put("Accept", "application/json, text/plain, */*"); + headers.put("Content-Type", "application/json;charset=utf-8"); + result = HttpClientManager.getInstance().sendGet(add, params, headers); + }else { + add.concat("/jmreport/show"); + Map params = new HashMap<>(16); + params.put("id",id); + Map headers = new HashMap<>(16); + headers.put("token", EpmetRequestHolder.getHeader("Authorization")); + result = HttpClientManager.getInstance().sendPostAndHeader(add, params, headers); + } + return result; + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml index a30bcdca75..6dcce49e7c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml @@ -5,7 +5,7 @@ DELETE FROM ic_customer_report - + WHERE CUSTOMER_ID IN ( #{c} @@ -15,7 +15,7 @@ DELETE FROM ic_report_fun - + WHERE CUSTOMER_REPORT_ID IN ( #{r} @@ -31,8 +31,15 @@ cr.CUSTOMER_ID, rf.FUN_CATEGORY_KEY AS categoryKey FROM ic_customer_report cr - INNER JOIN ic_report_fun rf ON rf.CUSTOMER_REPORT_ID = cr.REPORT_ID AND rf.DEL_FLAG = 0 + INNER JOIN ic_report_fun rf ON rf.CUSTOMER_REPORT_ID = cr.ID AND rf.DEL_FLAG = 0 WHERE cr.DEL_FLAG = 0 + + AND rf.FUN_CATEGORY_KEY in ( + + #{r} + + ) + ORDER BY cr.CREATED_TIME DESC From c0399d21c028d2b9a8df27a7832c58d8377d3763 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 9 Aug 2022 14:57:37 +0800 Subject: [PATCH 23/62] =?UTF-8?q?=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF/?= =?UTF-8?q?=E6=88=BF=E5=B1=8B=E4=BF=A1=E6=81=AF-=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/ReportListFormDTO.java | 2 + .../IcCustomerReportController.java | 3 +- .../com/epmet/dao/IcCustomerReportDao.java | 2 +- .../impl/IcCustomerReportServiceImpl.java | 40 ++++++++++++------- .../resources/mapper/IcCustomerReportDao.xml | 3 ++ 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportListFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportListFormDTO.java index 5e70557c95..4d67790aed 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportListFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportListFormDTO.java @@ -16,4 +16,6 @@ public class ReportListFormDTO implements Serializable { private static final long serialVersionUID = -4459838228433571457L; private List categoryKeys; + + private String customerId; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index f8b1ab415b..0c4cdcc0fa 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -79,7 +79,8 @@ public class IcCustomerReportController { * @date 2022/8/8 15:20 */ @PostMapping("report-list") - public Result> reportIdAndName(@RequestBody ReportListFormDTO formDTO){ + public Result> reportIdAndName(@RequestBody ReportListFormDTO formDTO,@LoginUser TokenDto tokenDto){ + formDTO.setCustomerId(tokenDto.getCustomerId()); return new Result>().ok(icCustomerReportService.reportIdAndName(formDTO)); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java index 0e467ca8dc..ce9fc0334e 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java @@ -23,7 +23,7 @@ public interface IcCustomerReportDao extends BaseDao { * @author zxc * @date 2022/8/8 10:38 */ - List reportList(@Param("categoryKeys")List categoryKeys); + List reportList(@Param("categoryKeys")List categoryKeys,@Param("customerId")String customerId); /** * Desc: 根据客户IDs获取ids diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 248beb49ff..fd1b1a2d8c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -84,8 +84,11 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportList() { Result list = jiMuReportOpenFeignClient.getList(1,10000,"datainfo", EpmetRequestHolder.getHeader("Authorization")); Result url = getUrl(2, null); - log.info(url.toString()); + log.info("所有jm报表"+url); Map map = JSON.parseObject(url.getData(), Map.class); + if (!map.containsValue(true)){ + throw new EpmetException("获取所有jm报表失败"); + } Map map2 = (Map)map.get("result"); List> map3 = (List>) map2.get("records"); List allReports = new ArrayList<>(); @@ -102,7 +105,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportList = baseDao.reportList(null); + List reportList = baseDao.reportList(null,null); if (CollectionUtils.isEmpty(reportList)){ return allReportList; } @@ -192,7 +195,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportIdAndName(ReportListFormDTO formDTO) { - List reportList = baseDao.reportList(formDTO.getCategoryKeys()); + List reportList = baseDao.reportList(formDTO.getCategoryKeys(), formDTO.getCustomerId()); if (CollectionUtils.isEmpty(reportList)){ return new ArrayList<>(); } @@ -201,14 +204,17 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl { JiMuReportFormDTO form = new JiMuReportFormDTO(); form.setId(r); -// Result url = getUrl(NumConstant.ONE, r); -// if (!report.success()){ -// throw new EpmetException("查询报表失败:"+r); -// } -// JiMuReportResultDTO data = report.getData(); -// data.setReportId(data.getId()); -// data.setReportName(data.getReportName()); -// result.add(data); + Result url = getUrl(NumConstant.ONE, r); + log.info("模板详情"+url); + Map map = JSON.parseObject(url.getData(), Map.class); + if (!map.containsValue(true)){ + throw new EpmetException("获取jm报表详情失败:"+r); + } + Map map2 = (Map)map.get("result"); + JiMuReportResultDTO data = ConvertUtils.mapToEntity(map2, JiMuReportResultDTO.class); + data.setReportId(data.getId()); + data.setReportName(data.getName()); + result.add(data); }); return result; } @@ -234,8 +240,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl result; try { InetAddress localHost = InetAddress.getLocalHost(); -// add = localHost.getHostAddress(); - add = "http://192.168.1.141:8118"; + add = "http://"+localHost.getHostAddress()+":8118"; System.out.println(add); }catch (Exception e){ log.warn("获取url失败"); @@ -255,12 +260,17 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl params = new HashMap<>(16); params.put("id",id); + params.put("apiUrl",""); + params.put("params",""); Map headers = new HashMap<>(16); headers.put("token", EpmetRequestHolder.getHeader("Authorization")); - result = HttpClientManager.getInstance().sendPostAndHeader(add, params, headers); + headers.put("X-Access-Token", EpmetRequestHolder.getHeader("Authorization")); + headers.put("Accept", "application/json, text/plain, */*"); + headers.put("Content-Type", "application/json;charset=utf-8"); + result = HttpClientManager.getInstance().sendPostByJSONAndHeader(add, JSON.toJSONString(params), headers); } return result; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml index 6dcce49e7c..689f448228 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml @@ -40,6 +40,9 @@ ) + + AND cr.CUSTOMER_ID = #{customerId} + ORDER BY cr.CREATED_TIME DESC From 2e865428a2c2df9478a954749a6f2e2fb0aafc03 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 9 Aug 2022 15:20:00 +0800 Subject: [PATCH 24/62] =?UTF-8?q?url=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/feignclient/feigns/JiMuReportOpenFeignClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java index f6afa4d9a4..5317a63ca5 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -15,8 +15,8 @@ import org.springframework.web.bind.annotation.RequestParam; * @DateTime 2022/8/8 13:52 * @DESC */ -//@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class) -@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class, url = "localhost:8118") +@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class) +//@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class, url = "localhost:8118") public interface JiMuReportOpenFeignClient { @GetMapping("jmreport/excelQuery") From 0705950123ed542bc894fef4bacde9a7af9aa913 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 9 Aug 2022 16:44:56 +0800 Subject: [PATCH 25/62] =?UTF-8?q?=E8=B0=83=E9=80=9Acustomize=E8=B0=83?= =?UTF-8?q?=E7=94=A8jmreport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/feignclient/dtos/JiMuPage.java | 22 +++++++++++++ .../commons/feignclient/dtos/JiMuResult.java | 19 ++++++++++++ .../result/JiMuReportDetailResultDTO.java | 31 +++++++++++++++++++ .../feigns/JiMuReportOpenFeignClient.java | 16 +++++++--- .../JiMuReportOpenFeignClientFallback.java | 11 +++++-- .../impl/IcCustomerReportServiceImpl.java | 16 +++++++++- 6 files changed, 108 insertions(+), 7 deletions(-) create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuPage.java create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportDetailResultDTO.java diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuPage.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuPage.java new file mode 100644 index 0000000000..1c92f30d11 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuPage.java @@ -0,0 +1,22 @@ +package com.epmet.commons.feignclient.dtos; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 积木报表的返回值Page对象 + * @param + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class JiMuPage { + private int pageNo; + private int pageSize; + private int total; + private int pages; + private List records; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java new file mode 100644 index 0000000000..304510b3c6 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java @@ -0,0 +1,19 @@ +package com.epmet.commons.feignclient.dtos; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 积木报表的返回值Result对象 + * @param + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class JiMuResult { + private boolean success = true; + private String message = ""; + private Integer code = 0; + private T result; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportDetailResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportDetailResultDTO.java new file mode 100644 index 0000000000..9e27d5ab5b --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportDetailResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.commons.feignclient.dtos.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.Map; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class JiMuReportDetailResultDTO { + private String id; + private String code; + private String name; + private String note; + private String status; + private String type; + private String jsonStr; + private String apiUrl; + private String apiMethod; + private String apiCode; + private String thumb; + private Integer template; + private String createBy; + private Date createTime; + private String updateBy; + private Date updateTime; + private Map dataList; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java index 5317a63ca5..4187bf8615 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -1,13 +1,18 @@ package com.epmet.commons.feignclient.feigns; +import com.epmet.commons.feignclient.dtos.JiMuPage; +import com.epmet.commons.feignclient.dtos.JiMuResult; import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; +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.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; /** @@ -19,10 +24,13 @@ import org.springframework.web.bind.annotation.RequestParam; //@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class, url = "localhost:8118") public interface JiMuReportOpenFeignClient { - @GetMapping("jmreport/excelQuery") - Result getList(@RequestParam("pageNo") Integer pageNo,@RequestParam("pageSize") Integer pageSize, - @RequestParam("reportType") String reportType, - @RequestParam("token") String token); + @GetMapping(value = "jmreport/excelQuery") + JiMuResult> getList(@RequestParam("pageNo") Integer pageNo, + @RequestParam("pageSize") Integer pageSize, + @RequestParam("name") String name, + @RequestParam("reportType") String reportType, + @RequestParam("token") String token, + @RequestHeader MultiValueMap headers); @GetMapping("jmreport/show") Result getReport(@RequestBody JiMuReportFormDTO formDTO); diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java index 24b5580256..5d49a38766 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java @@ -1,11 +1,17 @@ package com.epmet.commons.feignclient.feigns.fallback; +import com.epmet.commons.feignclient.dtos.JiMuPage; +import com.epmet.commons.feignclient.dtos.JiMuResult; import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; +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.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.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; /** * @Author zxc @@ -15,8 +21,9 @@ import com.epmet.commons.tools.utils.Result; public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignClient { @Override - public Result getList(Integer pageNo, Integer pageSize, String reportType, String token) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_JM_REPORT, "getList",pageNo,pageSize,reportType, token); + public JiMuResult> getList(Integer pageNo, Integer pageSize, String name, String reportType, String token, MultiValueMap headers) { + JiMuResult> rst = new JiMuResult<>(false, "请求失败", 200, null); + return rst; } @Override diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index fd1b1a2d8c..c3ef461d8d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -3,7 +3,10 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.epmet.commons.feignclient.dtos.JiMuPage; +import com.epmet.commons.feignclient.dtos.JiMuResult; import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; +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.mybatis.service.impl.BaseServiceImpl; @@ -36,8 +39,10 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.MultiValueMap; import java.net.InetAddress; import java.util.*; @@ -82,7 +87,16 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportList() { - Result list = jiMuReportOpenFeignClient.getList(1,10000,"datainfo", EpmetRequestHolder.getHeader("Authorization")); + + String authorization = EpmetRequestHolder.getHeader("Authorization"); + + // 自定义header传递 + MultiValueMap headers = new HttpHeaders(); + headers.add("token", authorization); + + JiMuResult> result = jiMuReportOpenFeignClient.getList(1, 10000, "", "datainfo", authorization, headers); + + // todo 下面的删掉吧 Result url = getUrl(2, null); log.info("所有jm报表"+url); Map map = JSON.parseObject(url.getData(), Map.class); From 7b8d036f6cf301a71179e79a75d62d1598e3f3cf Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 9 Aug 2022 17:27:40 +0800 Subject: [PATCH 26/62] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/feignclient/dtos/JiMuResult.java | 1 + .../feigns/JiMuReportOpenFeignClient.java | 6 ++-- .../JiMuReportOpenFeignClientFallback.java | 15 ++++------ .../com/epmet/dao/IcCustomerReportDao.java | 2 +- .../impl/IcCustomerReportServiceImpl.java | 28 +++++++------------ .../resources/mapper/IcCustomerReportDao.xml | 3 +- 6 files changed, 23 insertions(+), 32 deletions(-) diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java index 304510b3c6..5aa42d273a 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java @@ -16,4 +16,5 @@ public class JiMuResult { private String message = ""; private Integer code = 0; private T result; + private T data; } diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java index 4187bf8615..8e2b8f230d 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java +++ b/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.form.JiMuReportFormDTO; 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.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.Result; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.util.MultiValueMap; 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.RequestParam; +import java.util.Map; + /** * @Author zxc * @DateTime 2022/8/8 13:52 @@ -33,6 +33,6 @@ public interface JiMuReportOpenFeignClient { @RequestHeader MultiValueMap headers); @GetMapping("jmreport/show") - Result getReport(@RequestBody JiMuReportFormDTO formDTO); + JiMuResult> getReport(@RequestBody JiMuReportFormDTO formDTO); } diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java index 5d49a38766..5db76ab521 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java +++ b/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.form.JiMuReportFormDTO; 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.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.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestParam; + +import java.util.Map; /** * @Author zxc @@ -22,12 +18,13 @@ public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignCli @Override public JiMuResult> getList(Integer pageNo, Integer pageSize, String name, String reportType, String token, MultiValueMap headers) { - JiMuResult> rst = new JiMuResult<>(false, "请求失败", 200, null); + JiMuResult> rst = new JiMuResult<>(false, "请求失败", 200, null,null); return rst; } @Override - public Result getReport(JiMuReportFormDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_JM_REPORT, "getReport",formDTO); + public JiMuResult> getReport(JiMuReportFormDTO formDTO) { + JiMuResult> rst = new JiMuResult<>(false, "请求失败", 200, null,null); + return rst; } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java index ce9fc0334e..0972fd32b4 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java @@ -33,7 +33,7 @@ public interface IcCustomerReportDao extends BaseDao { */ List getIdsByCustomer(@Param("customerIds") List customerIds,@Param("reportId") String reportId); - void delCustomerReport(@Param("customerIds") List customerIds); + void delCustomerReport(@Param("customerIds") List customerIds,@Param("reportId")String reportId); void delCustomerReportFun(@Param("reportIds") List reportIds); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index c3ef461d8d..b7783c7724 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/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 reportList() { - String authorization = EpmetRequestHolder.getHeader("Authorization"); - // 自定义header传递 MultiValueMap headers = new HttpHeaders(); headers.add("token", authorization); - JiMuResult> result = jiMuReportOpenFeignClient.getList(1, 10000, "", "datainfo", authorization, headers); - - // todo 下面的删掉吧 - Result url = getUrl(2, null); - log.info("所有jm报表"+url); - Map map = JSON.parseObject(url.getData(), Map.class); - if (!map.containsValue(true)){ + if (!result.isSuccess()){ throw new EpmetException("获取所有jm报表失败"); } - Map map2 = (Map)map.get("result"); - List> map3 = (List>) map2.get("records"); + List> records = (List>)result.getResult().getRecords(); List allReports = new ArrayList<>(); - map3.forEach(m -> { - allReports.add(ConvertUtils.mapToEntity(m,JiMuReportResultDTO.class)); - }); + for (Map record : records) { + allReports.add(ConvertUtils.mapToEntity(record,JiMuReportResultDTO.class)); + } if (CollectionUtils.isEmpty(allReports)){ return new ArrayList<>(); } @@ -174,9 +165,9 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl { JiMuReportFormDTO form = new JiMuReportFormDTO(); form.setId(r); + JiMuResult> report = jiMuReportOpenFeignClient.getReport(form); Result url = getUrl(NumConstant.ONE, r); log.info("模板详情"+url); Map map = JSON.parseObject(url.getData(), Map.class); @@ -254,8 +246,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl result; try { InetAddress localHost = InetAddress.getLocalHost(); - add = "http://"+localHost.getHostAddress()+":8118"; - System.out.println(add); +// add = "http://"+localHost.getHostAddress()+":8118"; + add = "http://"+"192.168.1.141"+":8118"; }catch (Exception e){ log.warn("获取url失败"); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml index 689f448228..1c9b98a2bb 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml @@ -5,8 +5,9 @@ DELETE FROM ic_customer_report + WHERE REPORT_ID = #{reportId} - WHERE CUSTOMER_ID IN ( + AND CUSTOMER_ID IN ( #{c} From 25b5fac2b328f3f712161e842ff195c7607d6528 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 9 Aug 2022 17:46:00 +0800 Subject: [PATCH 27/62] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feigns/JiMuReportOpenFeignClient.java | 4 +- .../JiMuReportOpenFeignClientFallback.java | 3 +- .../impl/IcCustomerReportServiceImpl.java | 69 ++++--------------- 3 files changed, 14 insertions(+), 62 deletions(-) diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java index 8e2b8f230d..957521eabb 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -2,14 +2,12 @@ package com.epmet.commons.feignclient.feigns; import com.epmet.commons.feignclient.dtos.JiMuPage; import com.epmet.commons.feignclient.dtos.JiMuResult; -import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallbackFactory; import com.epmet.commons.tools.constant.ServiceConstant; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; @@ -33,6 +31,6 @@ public interface JiMuReportOpenFeignClient { @RequestHeader MultiValueMap headers); @GetMapping("jmreport/show") - JiMuResult> getReport(@RequestBody JiMuReportFormDTO formDTO); + JiMuResult> getReport(@RequestParam("id") String id,@RequestParam("apiUrl") String apiUrl,@RequestParam("params") String params,@RequestHeader MultiValueMap headers); } diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java index 5db76ab521..409ae4ce19 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java @@ -2,7 +2,6 @@ package com.epmet.commons.feignclient.feigns.fallback; import com.epmet.commons.feignclient.dtos.JiMuPage; import com.epmet.commons.feignclient.dtos.JiMuResult; -import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; import org.springframework.util.MultiValueMap; @@ -23,7 +22,7 @@ public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignCli } @Override - public JiMuResult> getReport(JiMuReportFormDTO formDTO) { + public JiMuResult> getReport(String id,String apiUrl,String params,MultiValueMap headers) { JiMuResult> rst = new JiMuResult<>(false, "请求失败", 200, null,null); return rst; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index b7783c7724..a080785bfc 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -1,6 +1,5 @@ package com.epmet.service.impl; -import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.epmet.commons.feignclient.dtos.JiMuPage; @@ -19,7 +18,6 @@ import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.EpmetRequestHolder; -import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerFunctionConstant; import com.epmet.dao.IcCustomerReportDao; @@ -44,8 +42,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.MultiValueMap; -import java.net.InetAddress; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -209,15 +209,16 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl { JiMuReportFormDTO form = new JiMuReportFormDTO(); form.setId(r); - JiMuResult> report = jiMuReportOpenFeignClient.getReport(form); - Result url = getUrl(NumConstant.ONE, r); - log.info("模板详情"+url); - Map map = JSON.parseObject(url.getData(), Map.class); - if (!map.containsValue(true)){ + String authorization = EpmetRequestHolder.getHeader("Authorization"); + // 自定义header传递 + MultiValueMap headers = new HttpHeaders(); + headers.add("token", authorization); + headers.add("Authorization", authorization); + JiMuResult> report = jiMuReportOpenFeignClient.getReport(r,"","",headers); + if (!report.isSuccess()){ throw new EpmetException("获取jm报表详情失败:"+r); } - Map map2 = (Map)map.get("result"); - JiMuReportResultDTO data = ConvertUtils.mapToEntity(map2, JiMuReportResultDTO.class); + JiMuReportResultDTO data = ConvertUtils.mapToEntity(report.getResult(), JiMuReportResultDTO.class); data.setReportId(data.getId()); data.setReportName(data.getName()); result.add(data); @@ -235,50 +236,4 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl getUrl(Integer type,String id) { - String add = ""; - Result result; - try { - InetAddress localHost = InetAddress.getLocalHost(); -// add = "http://"+localHost.getHostAddress()+":8118"; - add = "http://"+"192.168.1.141"+":8118"; - }catch (Exception e){ - log.warn("获取url失败"); - } - if (type.compareTo(NumConstant.TWO) == NumConstant.ZERO){ - add = add.concat("/jmreport/excelQuery"); - Map params = new HashMap<>(16); - params.put("pageNo",1); - params.put("pageSize",10000); - params.put("reportType","datainfo"); - params.put("name",""); - params.put("token", EpmetRequestHolder.getHeader("Authorization")); - Map headers = new HashMap<>(16); - headers.put("token", EpmetRequestHolder.getHeader("Authorization")); - headers.put("X-Access-Token", EpmetRequestHolder.getHeader("Authorization")); - headers.put("Accept", "application/json, text/plain, */*"); - headers.put("Content-Type", "application/json;charset=utf-8"); - result = HttpClientManager.getInstance().sendGet(add, params, headers); - }else { - add = add.concat("/jmreport/show"); - Map params = new HashMap<>(16); - params.put("id",id); - params.put("apiUrl",""); - params.put("params",""); - Map headers = new HashMap<>(16); - headers.put("token", EpmetRequestHolder.getHeader("Authorization")); - headers.put("X-Access-Token", EpmetRequestHolder.getHeader("Authorization")); - headers.put("Accept", "application/json, text/plain, */*"); - headers.put("Content-Type", "application/json;charset=utf-8"); - result = HttpClientManager.getInstance().sendPostByJSONAndHeader(add, JSON.toJSONString(params), headers); - } - return result; - } - } \ No newline at end of file From d8cf71965f79c1a8b893f0aecce5d783873c2346 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 10 Aug 2022 08:58:29 +0800 Subject: [PATCH 28/62] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/IcCustomerReportServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index a080785bfc..7ee55b0814 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -169,7 +169,9 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl entities = new ArrayList<>(); List funEntities = new ArrayList<>(); From 4f2f1b4e866bc78041a03c8993ae1f298876d825 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 10 Aug 2022 09:32:23 +0800 Subject: [PATCH 29/62] =?UTF-8?q?pageData=E5=A2=9E=E5=8A=A0pages,=20listre?= =?UTF-8?q?si=E5=92=8Chouselist=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E3=80=82=E7=94=A8=E4=BA=8E=E6=8A=A5=E8=A1=A8=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/commons/tools/page/PageData.java | 7 +++++++ .../main/java/com/epmet/service/impl/HouseServiceImpl.java | 4 +++- .../java/com/epmet/service/impl/IcResiUserServiceImpl.java | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/page/PageData.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/page/PageData.java index 55a331c4e2..1e9271dc2a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/page/PageData.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/page/PageData.java @@ -29,6 +29,7 @@ public class PageData implements Serializable { private List list; + private int pages; /** * 分页 * @param list 列表数据 @@ -38,4 +39,10 @@ public class PageData implements Serializable { this.list = list; this.total = (int)total; } + + public PageData(List list, long total,int pageSize) { + this.list = list; + this.total = (int)total; + this.pages = (int) Math.ceil((double)total / pageSize); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index 5d0556337b..0112a2a34c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -385,7 +385,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { item.setPurpose(HousePurposeEnums.getTypeValue(item.getPurposeKey())); }); - + if (formDTO.getIsPage()) { + return new PageData<>(records == null ? new ArrayList<>() : records, pageInfo.getTotal(), formDTO.getPageSize()); + } return new PageData<>(records == null ? new ArrayList<>() : records, pageInfo.getTotal()); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index f0fcfceefc..7b34dca592 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -960,6 +960,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl(pageInfo.getList(), pageInfo.getTotal(), formDTO.getPageSize()); + } return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); } From 1fe1a743fe3df976a4eb30e81386d209b164af74 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 10 Aug 2022 14:14:35 +0800 Subject: [PATCH 30/62] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9Aredis=20param?= =?UTF-8?q?=20key=20aop=E5=8F=82=E6=95=B0=E8=A6=86=E7=9B=96=EF=BC=8C?= =?UTF-8?q?=E6=8E=92=E9=99=A4"pageSize",=20"pageNo",=20"isPage"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/aspect/ReportRequestAspect.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java index 2c7dc898d9..a23423c08f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java @@ -71,11 +71,13 @@ public class ReportRequestAspect { private void fillArgsToRequestBody(Object[] args, Map storedParams, Parameter[] parameters) { for (int i = 0; i < args.length; i++) { Object arg = args[i]; - Class argClazz = arg.getClass(); + //Class argClazz = arg.getClass(); RequestBody requestBodyAnno = parameters[i].getAnnotation(RequestBody.class); if (arg != null && requestBodyAnno != null) { Object argBean = BeanUtil.mapToBean(storedParams, arg.getClass(), true); - BeanUtil.copyProperties(argBean, arg); + + // 分页参数需要从 + BeanUtil.copyProperties(argBean, arg, "pageSize", "pageNo", "isPage"); return; } } From 99ddd75628fd6a8556a21e1f62adda4aacc2f6bc Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 10 Aug 2022 14:15:54 +0800 Subject: [PATCH 31/62] epmet:jmreport:paramkey --- .../com/epmet/service/impl/IcCustomerReportServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 7ee55b0814..9abbc699f7 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -144,7 +144,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl Date: Thu, 11 Aug 2022 17:13:14 +0800 Subject: [PATCH 32/62] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9Aaggregator?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=96=B0=E5=A2=9E=E7=9A=84partymember?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=E5=9C=B0=E5=9D=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-commons/epmet-commons-feignclient/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-feignclient/pom.xml b/epmet-commons/epmet-commons-feignclient/pom.xml index d0b611f882..4cf486cefb 100644 --- a/epmet-commons/epmet-commons-feignclient/pom.xml +++ b/epmet-commons/epmet-commons-feignclient/pom.xml @@ -3,12 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - epmet-cloud + epmet-commons com.epmet 2.0.0 4.0.0 + jar epmet-commons-feignclient From c87b71e330b7e962fdcdb6001373f429b630d759 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 15 Aug 2022 14:16:15 +0800 Subject: [PATCH 33/62] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=20=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8F=90=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IcResiUserController.java | 21 ++- .../service/IcResiUserExportService.java | 4 +- .../impl/IcResiUserExportServiceImpl.java | 149 ++++++++++-------- 3 files changed, 104 insertions(+), 70 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 778740a9a6..76706a51b0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -68,6 +68,7 @@ import com.epmet.send.SendMqMsgUtil; import com.epmet.service.IcResiUserExportService; import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserService; +import com.github.pagehelper.Page; import feign.RequestInterceptor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -526,7 +527,7 @@ public class IcResiUserController implements ResultDataResolver { log.info("通过原来的模板下载,tokenDto:{}", JSON.toJSONString(tokenDto)); this.exportExcelByEasyExcel(tokenDto, pageFormDTO.getSearchForm(), response); } else { - icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, response); + icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, response,false); } } catch (EpmetException e) { response.reset(); @@ -539,6 +540,24 @@ public class IcResiUserController implements ResultDataResolver { } } + /** + * desc: 自定义导出居民信息 不下载只有数据 + * + * @param tokenDto + * @param pageFormDTO + * @param response + * @return void + * @author LiuJanJun + * @date 2021/11/19 4:24 下午 + * @remark 用于报表调用的接口 试试 + */ + @NoRepeatSubmit + @RequestMapping(value = "/exportExcelCustomData") + public Result>> exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestBody ExportResiUserFormDTO pageFormDTO, HttpServletResponse response) throws Exception { + Page> maps = icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, null, true); + return new Result>>().ok(maps.getResult()); + } + /** * desc:根据客户id 先从oss下载模版,如果有没有则使用系统默认模板 如果不存在则返回null * diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java index 53f9bee81f..f67864cf82 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java @@ -2,8 +2,10 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.ExportResiUserFormDTO; +import com.github.pagehelper.Page; import javax.servlet.http.HttpServletResponse; +import java.util.Map; /** *@Description 居民信息导出service @@ -23,5 +25,5 @@ public interface IcResiUserExportService { * @author LiuJanJun * @date 2022/4/22 1:35 下午 */ - void exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response); + Page> exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response, boolean onlyGetData); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index a5ff0484c8..f32f44da1f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -91,7 +91,9 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { * @date 2022/4/22 1:35 下午 */ @Override - public void exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response) { + public Page> exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response, boolean onlyGetData) { + Page> mapListPage = null; + //校验参数 this.validateSearchForm(tokenDto, exportResiUserFormDTO); IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); @@ -99,6 +101,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { String templateId = exportResiUserFormDTO.getTemplateId(); ExcelWriter excelWriter = null; + WriteSheet writeSheet = null; try { //获取用户配置的导出条件 Result exportConfigResult = this.getIcCustomExportConfig(searchForm.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); @@ -114,36 +117,40 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { List allShowColumns = new ArrayList<>(exportConfigData.getShowSqlColumns()); - //需要合并的列 - List mergeColumnIndexList = new ArrayList<>(); - for (int i = 0; i < allShowColumns.size(); i++) { - IcCustomExportResultDTO.SqlColumn sqlColumn = allShowColumns.get(i); - if (!sqlColumn.getManyToOne()) { - mergeColumnIndexList.add(i); + + + if (!onlyGetData){ + + //需要合并的列 + List mergeColumnIndexList = new ArrayList<>(); + for (int i = 0; i < allShowColumns.size(); i++) { + IcCustomExportResultDTO.SqlColumn sqlColumn = allShowColumns.get(i); + if (!sqlColumn.getManyToOne()) { + mergeColumnIndexList.add(i); + } } - } + int[] mergeColumnIndex = mergeColumnIndexList.stream().filter(Objects::nonNull).mapToInt(i -> i).toArray(); + // 从那一列开始合并 + int mergeRowIndex = exportConfigData.getHeaderRow(); + + // 头的策略 + WriteCellStyle headWriteCellStyle = new WriteCellStyle(); + // 背景设置为红色 + headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); + FreezeAndFilter writeHandler = new FreezeAndFilter(); + //从第几行开始冻结 + writeHandler.rowSplit = exportConfigData.getHeaderRow(); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)) + .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex)) + .registerWriteHandler(horizontalCellStyleStrategy) + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .registerWriteHandler(writeHandler).build(); - int[] mergeColumnIndex = mergeColumnIndexList.stream().filter(Objects::nonNull).mapToInt(i -> i).toArray(); - // 从那一列开始合并 - int mergeRowIndex = exportConfigData.getHeaderRow(); - - // 头的策略 - WriteCellStyle headWriteCellStyle = new WriteCellStyle(); - // 背景设置为红色 - headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); - WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); - contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); - HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); - FreezeAndFilter writeHandler = new FreezeAndFilter(); - //从第几行开始冻结 - writeHandler.rowSplit = exportConfigData.getHeaderRow(); - excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)) - .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex)) - .registerWriteHandler(horizontalCellStyleStrategy) - .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) - .registerWriteHandler(writeHandler).build(); - - WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").head(exportConfigData.getHeaders()).build(); + writeSheet = EasyExcel.writerSheet("Sheet1").head(exportConfigData.getHeaders()).build(); + } String staffOrgPath = null; if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { @@ -151,7 +158,6 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { } else { staffOrgPath = staffInfoCacheResult.getAgencyId(); } - Page> mapListPage = null; allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); do { @@ -168,45 +174,11 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { List showSqlColumns = exportConfigData.getShowSqlColumns(); Set hiddenColumnSet = exportConfigData.getHiddenSqlColumns().stream().map(IcCustomExportResultDTO.SqlColumn::getColumnName).collect(Collectors.toSet()); result.forEach(o -> { - List singleRowData = new ArrayList<>(); - Map originalConditionMap = new ConcurrentHashMap<>(); - o.forEach((key, value) -> { - Map itemMap = showSqlColumns.stream().collect(Collectors.toMap(IcCustomExportResultDTO.SqlColumn::getColumnName, item -> item)); - IcCustomExportResultDTO.SqlColumn columnDTO = itemMap.get(key); - //忽略 不需要显示的列的值得设置 要不然数据会写入到excel中 - if (singleRowData.size() >= showSqlColumns.size()) { - return; - } - - IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); - String tableName = sqlColumn.getTableName(); - String itemId = sqlColumn.getItemId(); - String columnName = columnDTO.getColumnName(); - if (hiddenColumnSet.contains(columnName)) { - return; - } - String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); - //保留原始值 便于remote条件获取 - originalConditionMap.putIfAbsent(columnName, vauleStr); - ExportResiUserItemDTO exportResiUserItemDTO = itemOriginMap.get(tableName); - FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); - - String newValue = vauleStr; - - if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { - putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr); - newValue = String.valueOf(o.get(columnName)); - } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { - newValue = putOptionValue(formItemResult, vauleStr); - } - if (FieldConstant.ID.equals(key)) { - newValue = Md5Util.md5(vauleStr); - } - singleRowData.add(newValue); - }); - resultData.add(singleRowData); + getDataForResi(itemOriginMap, staffInfoCacheResult, resultData, showSqlColumns, hiddenColumnSet, o); }); - excelWriter.write(resultData, writeSheet); + if (!onlyGetData){ + excelWriter.write(resultData, writeSheet); + } } while (mapListPage.getResult().size() == searchForm.getPageSize()); } catch (IOException e) { log.error("exportIcResiUser exception", e); @@ -216,6 +188,47 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { excelWriter.finish(); } } + return mapListPage; + } + + private void getDataForResi(Map itemOriginMap, CustomerStaffInfoCacheResult staffInfoCacheResult, List> resultData, List showSqlColumns, Set hiddenColumnSet, Map o) { + List singleRowData = new ArrayList<>(); + Map originalConditionMap = new ConcurrentHashMap<>(); + o.forEach((key, value) -> { + Map itemMap = showSqlColumns.stream().collect(Collectors.toMap(IcCustomExportResultDTO.SqlColumn::getColumnName, item -> item)); + IcCustomExportResultDTO.SqlColumn columnDTO = itemMap.get(key); + //忽略 不需要显示的列的值得设置 要不然数据会写入到excel中 + if (singleRowData.size() >= showSqlColumns.size()) { + return; + } + + IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); + String tableName = sqlColumn.getTableName(); + String itemId = sqlColumn.getItemId(); + String columnName = columnDTO.getColumnName(); + if (hiddenColumnSet.contains(columnName)) { + return; + } + String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); + //保留原始值 便于remote条件获取 + originalConditionMap.putIfAbsent(columnName, vauleStr); + ExportResiUserItemDTO exportResiUserItemDTO = itemOriginMap.get(tableName); + FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); + + String newValue = vauleStr; + + if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { + putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr); + newValue = String.valueOf(o.get(columnName)); + } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { + newValue = putOptionValue(formItemResult, vauleStr); + } + if (FieldConstant.ID.equals(key)) { + newValue = Md5Util.md5(vauleStr); + } + singleRowData.add(newValue); + }); + resultData.add(singleRowData); } /** From 8c1bb1d5907ce219837f81f0b293df7d19eeccce Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 15 Aug 2022 14:32:27 +0800 Subject: [PATCH 34/62] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=20=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8F=90=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/IcResiUserExportServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index f32f44da1f..be45c1ff58 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -226,6 +226,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { if (FieldConstant.ID.equals(key)) { newValue = Md5Util.md5(vauleStr); } + o.put(key,newValue); singleRowData.add(newValue); }); resultData.add(singleRowData); From b671c98ae6deec36de6525c1d78cd8c7bfd0473e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 15 Aug 2022 15:59:15 +0800 Subject: [PATCH 35/62] test --- .../controller/IcResiUserController.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 76706a51b0..6ea4925571 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -32,6 +32,7 @@ import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; @@ -554,6 +555,29 @@ public class IcResiUserController implements ResultDataResolver { @NoRepeatSubmit @RequestMapping(value = "/exportExcelCustomData") public Result>> exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestBody ExportResiUserFormDTO pageFormDTO, HttpServletResponse response) throws Exception { + if (null == pageFormDTO.getSearchForm()) { + IcResiUserPageFormDTO searchForm = new IcResiUserPageFormDTO(); + searchForm.setFormCode("resi_base_info"); + searchForm.setCustomerId(tokenDto.getCustomerId()); + searchForm.setStaffId(tokenDto.getUserId()); + searchForm.setPageNo(1); + searchForm.setPageSize(20); + List conditions=new ArrayList<>(); + // ResiUserQueryValueDTO temp=new ResiUserQueryValueDTO(); + // temp.setColumnName(""); + // temp.setColumnValue(Arrays.asList("IS_UNEMPLOYED")); + // temp.setQueryType("resi_category"); + // temp.setTableName("ic_resi_user"); + // conditions.add(temp); + searchForm.setConditions(conditions); + pageFormDTO.setSearchForm(searchForm); + } + if (null == pageFormDTO.getExportConfig()) { + IcExportTemplateSaveFormDTO exportTemplateSaveFormDTO = new IcExportTemplateSaveFormDTO(); + exportTemplateSaveFormDTO.setFormCode("resi_base_info"); + exportTemplateSaveFormDTO.setIsSaveTemp(false); + pageFormDTO.setExportConfig(exportTemplateSaveFormDTO); + } Page> maps = icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, null, true); return new Result>>().ok(maps.getResult()); } From 092ca36b94d8109e185ab6d0252847ace5cf2cdb Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 15 Aug 2022 16:34:10 +0800 Subject: [PATCH 36/62] test --- .../main/java/com/epmet/controller/IcResiUserController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 6ea4925571..1d864b0d46 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -572,7 +572,7 @@ public class IcResiUserController implements ResultDataResolver { searchForm.setConditions(conditions); pageFormDTO.setSearchForm(searchForm); } - if (null == pageFormDTO.getExportConfig()) { + if (null == pageFormDTO.getExportConfig()||StringUtils.isBlank(pageFormDTO.getExportConfig().getFormCode())) { IcExportTemplateSaveFormDTO exportTemplateSaveFormDTO = new IcExportTemplateSaveFormDTO(); exportTemplateSaveFormDTO.setFormCode("resi_base_info"); exportTemplateSaveFormDTO.setIsSaveTemp(false); From a21816bdfa80b0aee402300bc7bfa2ea18c5ce71 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 15 Aug 2022 16:58:53 +0800 Subject: [PATCH 37/62] test --- .../com/epmet/commons/tools/aspect/ReportRequestAspect.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java index a23423c08f..53540c797f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java @@ -10,6 +10,7 @@ import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -77,7 +78,7 @@ public class ReportRequestAspect { Object argBean = BeanUtil.mapToBean(storedParams, arg.getClass(), true); // 分页参数需要从 - BeanUtil.copyProperties(argBean, arg, "pageSize", "pageNo", "isPage"); + BeanUtils.copyProperties(argBean, arg, "pageSize", "pageNo", "isPage"); return; } } From b1cc57e0163d157eacb0fe84798a5dfd027a91b2 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 15 Aug 2022 16:59:54 +0800 Subject: [PATCH 38/62] test --- .../com/epmet/commons/tools/aspect/ReportRequestAspect.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java index 53540c797f..a23423c08f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java @@ -10,7 +10,6 @@ import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.reflect.MethodSignature; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -78,7 +77,7 @@ public class ReportRequestAspect { Object argBean = BeanUtil.mapToBean(storedParams, arg.getClass(), true); // 分页参数需要从 - BeanUtils.copyProperties(argBean, arg, "pageSize", "pageNo", "isPage"); + BeanUtil.copyProperties(argBean, arg, "pageSize", "pageNo", "isPage"); return; } } From 6ba583c1bb3e6276a2b90744835beb549d21a6d6 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 15 Aug 2022 17:41:29 +0800 Subject: [PATCH 39/62] exportExcelCustomData --- .../java/com/epmet/controller/IcResiUserController.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 1d864b0d46..a80f0b9daa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -552,9 +552,13 @@ public class IcResiUserController implements ResultDataResolver { * @date 2021/11/19 4:24 下午 * @remark 用于报表调用的接口 试试 */ + @ReportRequest @NoRepeatSubmit @RequestMapping(value = "/exportExcelCustomData") - public Result>> exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestBody ExportResiUserFormDTO pageFormDTO, HttpServletResponse response) throws Exception { + public Result>> exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestParam("templateId") String templateId,@RequestBody ExportResiUserFormDTO pageFormDTO, HttpServletResponse response) throws Exception { + log.warn("templateId=【"+templateId+"】"); + log.warn("pageFormDTO入参【"+JSON.toJSONString(pageFormDTO)+"】"); + pageFormDTO.setTemplateId(templateId); if (null == pageFormDTO.getSearchForm()) { IcResiUserPageFormDTO searchForm = new IcResiUserPageFormDTO(); searchForm.setFormCode("resi_base_info"); @@ -572,7 +576,7 @@ public class IcResiUserController implements ResultDataResolver { searchForm.setConditions(conditions); pageFormDTO.setSearchForm(searchForm); } - if (null == pageFormDTO.getExportConfig()||StringUtils.isBlank(pageFormDTO.getExportConfig().getFormCode())) { + if (null == pageFormDTO.getExportConfig()) { IcExportTemplateSaveFormDTO exportTemplateSaveFormDTO = new IcExportTemplateSaveFormDTO(); exportTemplateSaveFormDTO.setFormCode("resi_base_info"); exportTemplateSaveFormDTO.setIsSaveTemp(false); From 202a6363bad2cd272df55b5913ce2fc82c50e32a Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 16 Aug 2022 14:13:50 +0800 Subject: [PATCH 40/62] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=20=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8F=90=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/ExportResiUserFormDTO.java | 4 ++++ .../controller/IcResiUserController.java | 16 ++++++++++++---- .../impl/IcResiUserExportServiceImpl.java | 19 +++++++++++++------ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java index 4d53cebb86..843ecd19d2 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java @@ -13,6 +13,10 @@ import java.io.Serializable; @Data public class ExportResiUserFormDTO implements Serializable { private static final long serialVersionUID = 8777535966834678256L; + /** + * 客户Id + */ + private String customerId; /** * 表单查询条件 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index a80f0b9daa..41b9702b5d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -555,7 +555,9 @@ public class IcResiUserController implements ResultDataResolver { @ReportRequest @NoRepeatSubmit @RequestMapping(value = "/exportExcelCustomData") - public Result>> exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestParam("templateId") String templateId,@RequestBody ExportResiUserFormDTO pageFormDTO, HttpServletResponse response) throws Exception { + public Map exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestParam("templateId") String templateId, + @RequestParam("pageNo") Integer pageNo,@RequestParam("pageSize") Integer pageSize, + @RequestBody ExportResiUserFormDTO pageFormDTO) throws Exception { log.warn("templateId=【"+templateId+"】"); log.warn("pageFormDTO入参【"+JSON.toJSONString(pageFormDTO)+"】"); pageFormDTO.setTemplateId(templateId); @@ -564,8 +566,8 @@ public class IcResiUserController implements ResultDataResolver { searchForm.setFormCode("resi_base_info"); searchForm.setCustomerId(tokenDto.getCustomerId()); searchForm.setStaffId(tokenDto.getUserId()); - searchForm.setPageNo(1); - searchForm.setPageSize(20); + searchForm.setPageNo(pageNo); + searchForm.setPageSize(pageSize); List conditions=new ArrayList<>(); // ResiUserQueryValueDTO temp=new ResiUserQueryValueDTO(); // temp.setColumnName(""); @@ -580,10 +582,16 @@ public class IcResiUserController implements ResultDataResolver { IcExportTemplateSaveFormDTO exportTemplateSaveFormDTO = new IcExportTemplateSaveFormDTO(); exportTemplateSaveFormDTO.setFormCode("resi_base_info"); exportTemplateSaveFormDTO.setIsSaveTemp(false); + //固定通用客户Id + pageFormDTO.setCustomerId("jmreport_resi_default"); pageFormDTO.setExportConfig(exportTemplateSaveFormDTO); } Page> maps = icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, null, true); - return new Result>>().ok(maps.getResult()); + Map result = new HashMap<>(); + result.put("total",maps.getPages()); + result.put("count",maps.getTotal()); + result.put("data",maps.getResult()); + return result; } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index be45c1ff58..ee5ee06177 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -104,7 +104,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { WriteSheet writeSheet = null; try { //获取用户配置的导出条件 - Result exportConfigResult = this.getIcCustomExportConfig(searchForm.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); + Result exportConfigResult = this.getIcCustomExportConfig(exportResiUserFormDTO.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); Map itemOriginMap = getItemMap(searchForm.getCustomerId()); IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); @@ -120,6 +120,8 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { if (!onlyGetData){ + searchForm.setIsPage(false); + searchForm.setPageSize(NumConstant.TEN_THOUSAND); //需要合并的列 List mergeColumnIndexList = new ArrayList<>(); @@ -165,7 +167,9 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { icResiUserService.dynamicQuery(searchForm.getCustomerId(), searchForm.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, searchForm.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); }); - searchForm.setPageNo(searchForm.getPageNo() + NumConstant.ONE); + if (!searchForm.getIsPage()){ + searchForm.setPageNo(searchForm.getPageNo() + NumConstant.ONE); + } List> result = mapListPage.getResult(); @@ -179,7 +183,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { if (!onlyGetData){ excelWriter.write(resultData, writeSheet); } - } while (mapListPage.getResult().size() == searchForm.getPageSize()); + } while (!searchForm.getIsPage() && mapListPage.getResult().size() == searchForm.getPageSize()); } catch (IOException e) { log.error("exportIcResiUser exception", e); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMessage(), "导出失败"); @@ -240,11 +244,14 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { */ public void validateSearchForm(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO) { IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); - searchForm.setCustomerId(tokenDto.getCustomerId()); + if (StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId())){ + searchForm.setCustomerId(exportResiUserFormDTO.getCustomerId()); + }else{ + searchForm.setCustomerId(tokenDto.getCustomerId()); + } + searchForm.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(searchForm, IcResiUserPageFormDTO.AddUserInternalGroup.class); - searchForm.setIsPage(false); - searchForm.setPageSize(NumConstant.TEN_THOUSAND); } @Nullable From 92794283df0cd91fe3071aa7fc1cfb27a8829965 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 16 Aug 2022 14:48:38 +0800 Subject: [PATCH 41/62] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=20=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8F=90=E5=87=BA2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/IcResiUserController.java | 4 ++-- .../epmet/service/impl/IcResiUserExportServiceImpl.java | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 41b9702b5d..d87eecde2c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -582,10 +582,10 @@ public class IcResiUserController implements ResultDataResolver { IcExportTemplateSaveFormDTO exportTemplateSaveFormDTO = new IcExportTemplateSaveFormDTO(); exportTemplateSaveFormDTO.setFormCode("resi_base_info"); exportTemplateSaveFormDTO.setIsSaveTemp(false); - //固定通用客户Id - pageFormDTO.setCustomerId("jmreport_resi_default"); pageFormDTO.setExportConfig(exportTemplateSaveFormDTO); } + //固定通用客户Id + pageFormDTO.setCustomerId("jmreport_resi_default"); Page> maps = icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, null, true); Map result = new HashMap<>(); result.put("total",maps.getPages()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index ee5ee06177..f22a744046 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -244,12 +244,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { */ public void validateSearchForm(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO) { IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); - if (StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId())){ - searchForm.setCustomerId(exportResiUserFormDTO.getCustomerId()); - }else{ - searchForm.setCustomerId(tokenDto.getCustomerId()); - } - + searchForm.setCustomerId(tokenDto.getCustomerId()); searchForm.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(searchForm, IcResiUserPageFormDTO.AddUserInternalGroup.class); } From ebee7ab4560e07f1b316f49bb78a29eb4de8aef4 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 16 Aug 2022 15:04:26 +0800 Subject: [PATCH 42/62] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=20=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8F=90=E5=87=BA2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/form/ExportResiUserFormDTO.java | 6 ++++++ .../java/com/epmet/controller/IcResiUserController.java | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java index 843ecd19d2..cb6f89eb76 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java @@ -31,5 +31,11 @@ public class ExportResiUserFormDTO implements Serializable { */ private IcExportTemplateSaveFormDTO exportConfig; + /** + * pageNo 报表用的 + */ + private Integer pageNo = 1; + private Integer pageSize = 1000; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index d87eecde2c..10006a97b0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -556,7 +556,6 @@ public class IcResiUserController implements ResultDataResolver { @NoRepeatSubmit @RequestMapping(value = "/exportExcelCustomData") public Map exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestParam("templateId") String templateId, - @RequestParam("pageNo") Integer pageNo,@RequestParam("pageSize") Integer pageSize, @RequestBody ExportResiUserFormDTO pageFormDTO) throws Exception { log.warn("templateId=【"+templateId+"】"); log.warn("pageFormDTO入参【"+JSON.toJSONString(pageFormDTO)+"】"); @@ -566,8 +565,8 @@ public class IcResiUserController implements ResultDataResolver { searchForm.setFormCode("resi_base_info"); searchForm.setCustomerId(tokenDto.getCustomerId()); searchForm.setStaffId(tokenDto.getUserId()); - searchForm.setPageNo(pageNo); - searchForm.setPageSize(pageSize); + searchForm.setPageNo(pageFormDTO.getPageNo()); + searchForm.setPageSize(pageFormDTO.getPageSize()); List conditions=new ArrayList<>(); // ResiUserQueryValueDTO temp=new ResiUserQueryValueDTO(); // temp.setColumnName(""); From c20933d86f59260b2d397c7efffcb84098870f5f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 16 Aug 2022 15:34:09 +0800 Subject: [PATCH 43/62] tst --- .../com/epmet/service/impl/IcResiUserExportServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index f22a744046..f6bfe0ae75 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -164,7 +164,8 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); do { String finalStaffOrgPath = staffOrgPath; - mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { + // mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { + mapListPage = PageHelper.startPage(exportResiUserFormDTO.getPageNo(), exportResiUserFormDTO.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { icResiUserService.dynamicQuery(searchForm.getCustomerId(), searchForm.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, searchForm.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); }); if (!searchForm.getIsPage()){ From d1cae449713a95c4f5f50fd2ba20cf8876b3c834 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 16 Aug 2022 15:43:51 +0800 Subject: [PATCH 44/62] =?UTF-8?q?pageNo,pageSize=E6=94=BE=E5=88=B0controll?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/IcResiUserController.java | 6 ++++-- .../com/epmet/service/impl/IcResiUserExportServiceImpl.java | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 10006a97b0..e3e68fdbb9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -565,8 +565,8 @@ public class IcResiUserController implements ResultDataResolver { searchForm.setFormCode("resi_base_info"); searchForm.setCustomerId(tokenDto.getCustomerId()); searchForm.setStaffId(tokenDto.getUserId()); - searchForm.setPageNo(pageFormDTO.getPageNo()); - searchForm.setPageSize(pageFormDTO.getPageSize()); + // searchForm.setPageNo(pageFormDTO.getPageNo()); + // searchForm.setPageSize(pageFormDTO.getPageSize()); List conditions=new ArrayList<>(); // ResiUserQueryValueDTO temp=new ResiUserQueryValueDTO(); // temp.setColumnName(""); @@ -577,6 +577,8 @@ public class IcResiUserController implements ResultDataResolver { searchForm.setConditions(conditions); pageFormDTO.setSearchForm(searchForm); } + pageFormDTO.getSearchForm().setPageNo(pageFormDTO.getPageNo()); + pageFormDTO.getSearchForm().setPageSize(pageFormDTO.getPageSize()); if (null == pageFormDTO.getExportConfig()) { IcExportTemplateSaveFormDTO exportTemplateSaveFormDTO = new IcExportTemplateSaveFormDTO(); exportTemplateSaveFormDTO.setFormCode("resi_base_info"); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index f6bfe0ae75..f22a744046 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -164,8 +164,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); do { String finalStaffOrgPath = staffOrgPath; - // mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { - mapListPage = PageHelper.startPage(exportResiUserFormDTO.getPageNo(), exportResiUserFormDTO.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { + mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { icResiUserService.dynamicQuery(searchForm.getCustomerId(), searchForm.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, searchForm.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); }); if (!searchForm.getIsPage()){ From 6c99ebc64ece07535380742cc11ed200fa0e40d7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 16 Aug 2022 16:59:40 +0800 Subject: [PATCH 45/62] ic_customer_report --- .../db/migration/V0.0.36__ic_customer_report.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.36__ic_customer_report.sql diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.36__ic_customer_report.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.36__ic_customer_report.sql new file mode 100644 index 0000000000..5ceef02408 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.36__ic_customer_report.sql @@ -0,0 +1,12 @@ +CREATE TABLE `ic_customer_report` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `REPORT_ID` varchar(64) NOT NULL COMMENT '报表id', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除;', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间=绑定时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户报表关系表'; \ No newline at end of file From 86ea463cf7f76efca659a14b521f05f4cb7753db Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 16 Aug 2022 21:10:37 +0800 Subject: [PATCH 46/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=87=BA=EF=BC=8C=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E5=BE=85=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dtos/form/JimuReportExportRequestDTO.java | 27 ++ .../result/JimuReportDbDataResultDTO.java | 17 + .../result/JimuReportFieldTreeResultDTO.java | 26 ++ .../feigns/JiMuReportOpenFeignClient.java | 17 +- .../JiMuReportOpenFeignClientFallback.java | 22 ++ .../feign/EpmetBaseRequestInterceptor.java | 2 - .../tools/utils/EpmetRequestHolder.java | 9 + .../dto/form/ReportHouseTestFormDTO.java | 12 + .../dto/result/ReportHouseTestResultDTO.java | 14 + .../epmet/controller/ReportController.java | 29 ++ .../java/com/epmet/service/HouseService.java | 2 + .../epmet/service/impl/HouseServiceImpl.java | 16 + .../dto/form/ReportBatchExportFormDTO.java | 15 + .../IcCustomerReportController.java | 27 +- .../service/IcCustomerReportService.java | 3 + .../impl/IcCustomerReportServiceImpl.java | 314 +++++++++++++++--- 16 files changed, 507 insertions(+), 45 deletions(-) create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JimuReportExportRequestDTO.java create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportFieldTreeResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ReportHouseTestResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JimuReportExportRequestDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JimuReportExportRequestDTO.java new file mode 100644 index 0000000000..7e66c588e9 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JimuReportExportRequestDTO.java @@ -0,0 +1,27 @@ +package com.epmet.commons.feignclient.dtos.form; + +import lombok.Data; + +/** + * 批量导出用的requst dto + */ +@Data +public class JimuReportExportRequestDTO { + private String excelConfigId; + private ExportRequestQueryParam queryParam = new ExportRequestQueryParam(); + + /** + * 批量导出用的请求参数 + */ + @Data + public static class ExportRequestQueryParam { + private String id; + private String token; + private String paramKey; + private String pageNo; + private Integer pageSize; + private String currentPageNo; + private Integer currentPageSize; + } + +} \ No newline at end of file diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java new file mode 100644 index 0000000000..fe6bf6240b --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.commons.feignclient.dtos.result; + +import lombok.Data; + +@Data +public class JimuReportDbDataResultDTO { + + private ReportDB reportDb; + + @Data + public static class ReportDB { + private String apiUrl; + private String apiMethod; + private String isList; + } + +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportFieldTreeResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportFieldTreeResultDTO.java new file mode 100644 index 0000000000..ef4037afe8 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportFieldTreeResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.commons.feignclient.dtos.result; + +import lombok.Data; + +import java.util.List; + +/** + * 积木报表,报表字段列表 + */ +@Data +public class JimuReportFieldTreeResultDTO { + + private Boolean expand; + private String code; + private List children; + private String dbId; + private String type; + private String isList; + + @Data + public static class Child { + private Boolean expand; + private String title; + private String fieldText; + } +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java index 957521eabb..08b07c0dab 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -2,15 +2,18 @@ package com.epmet.commons.feignclient.feigns; import com.epmet.commons.feignclient.dtos.JiMuPage; import com.epmet.commons.feignclient.dtos.JiMuResult; +import com.epmet.commons.feignclient.dtos.form.JimuReportExportRequestDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportDbDataResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportFieldTreeResultDTO; import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallbackFactory; import com.epmet.commons.tools.constant.ServiceConstant; +import feign.Response; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Map; /** @@ -33,4 +36,12 @@ public interface JiMuReportOpenFeignClient { @GetMapping("jmreport/show") JiMuResult> getReport(@RequestParam("id") String id,@RequestParam("apiUrl") String apiUrl,@RequestParam("params") String params,@RequestHeader MultiValueMap headers); + @GetMapping("/jmreport/field/tree/{report-id}") + JiMuResult>> fieldTree(@PathVariable("report-id") String reportId); + + @GetMapping("jmreport/loadDbData/{report-id}") + JiMuResult loadDbData(@PathVariable("report-id") String reportId); + + @PostMapping("jmreport/exportAllExcelStream") + Response exportAllExcelStream(JimuReportExportRequestDTO param); } diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java index 409ae4ce19..b1c793d560 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java @@ -2,10 +2,15 @@ package com.epmet.commons.feignclient.feigns.fallback; import com.epmet.commons.feignclient.dtos.JiMuPage; import com.epmet.commons.feignclient.dtos.JiMuResult; +import com.epmet.commons.feignclient.dtos.form.JimuReportExportRequestDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportDbDataResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportFieldTreeResultDTO; import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; +import feign.Response; import org.springframework.util.MultiValueMap; +import java.util.List; import java.util.Map; /** @@ -26,4 +31,21 @@ public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignCli JiMuResult> rst = new JiMuResult<>(false, "请求失败", 200, null,null); return rst; } + + @Override + public JiMuResult loadDbData(String reportId) { + JiMuResult rst = new JiMuResult<>(false, "请求失败", 200, null,null); + return rst; + } + + @Override + public Response exportAllExcelStream(JimuReportExportRequestDTO param) { + return null; + } + + @Override + public JiMuResult>> fieldTree(String reportId) { + JiMuResult rst = new JiMuResult<>(false, "请求失败", 200, null,null); + return rst; + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java index f7eb3a778d..746de189e9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java @@ -25,8 +25,6 @@ public class EpmetBaseRequestInterceptor implements RequestInterceptor { // Map requestHeaders = getHeadersFromRequest(); - log.debug("EpmetBaseRequestInterceptor#apply#inheritableAdditionalHeaders:" + requestHeaders); - if (requestHeaders != null && requestHeaders.size() > 0) { for (Map.Entry kv : requestHeaders.entrySet()) { template.header(kv.getKey(), kv.getValue()); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java index c86ef93152..e24f420fa7 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java @@ -2,6 +2,7 @@ package com.epmet.commons.tools.utils; import com.alibaba.ttl.TransmittableThreadLocal; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.Constant; import org.apache.commons.lang3.StringUtils; import java.util.HashMap; @@ -86,6 +87,14 @@ public class EpmetRequestHolder { return getHeader(AppClientConstant.CLIENT); } + /** + * 获取登陆用户的token + * @return + */ + public static String getLoginUserAuthorizationToken() { + return getHeader(Constant.AUTHORIZATION_HEADER); + } + /** * 获取所有 * @return diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java new file mode 100644 index 0000000000..b5206162e4 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java @@ -0,0 +1,12 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class ReportHouseTestFormDTO { + + private Integer pageNo = 1; + private Integer pageSize = 20; + private String id; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ReportHouseTestResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ReportHouseTestResultDTO.java new file mode 100644 index 0000000000..b9f074683d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ReportHouseTestResultDTO.java @@ -0,0 +1,14 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ReportHouseTestResultDTO { + private String houseId; + private String doorName; + private String fullName; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java new file mode 100644 index 0000000000..7576b1fa6d --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java @@ -0,0 +1,29 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ReportHouseTestFormDTO; +import com.epmet.dto.result.ReportHouseTestResultDTO; +import com.epmet.service.HouseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("report") +public class ReportController { + + @Autowired + private HouseService houseService; + + /** + * todo 测试用的 + * @return + */ + @PostMapping("houses/test") + public Result> listHouses(@RequestBody ReportHouseTestFormDTO input, @RequestParam(value="id", required = false) String id) { + System.out.println("id:"+id); + PageData pageData = houseService.listHouses4ReportTest(id, input.getPageNo(), input.getPageSize()); + return new Result>().ok(pageData); + } + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java index a5c940b0c1..3461cc3530 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java @@ -175,4 +175,6 @@ public interface HouseService { Result getHomeInfoByHouseCode(HouseInfoFormDTO dto); void orgIdPathInit(); + + PageData listHouses4ReportTest(String houseId, Integer pageNo, Integer pageSize); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index 0112a2a34c..c0e3933392 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -1222,4 +1222,20 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { } recureAppendParentAgencyId(pid, result); } + + @Override + public PageData listHouses4ReportTest(String houseId, Integer pageNo, Integer pageSize) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcHouseEntity::getBuildingId, "1514143207495208961"); + query.eq(StringUtils.isNotBlank(houseId), IcHouseEntity::getId, houseId); + + PageHelper.startPage(pageNo, pageSize); + List icHouseEntities = icHouseDao.selectList(query); + + PageInfo pi = new PageInfo<>(icHouseEntities); + + List houseDtos = icHouseEntities.stream().map(house -> new ReportHouseTestResultDTO(house.getId(), house.getDoorName(), house.getFullName())).collect(Collectors.toList()); + + return new PageData<>(houseDtos, pi.getTotal()); + } } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java new file mode 100644 index 0000000000..a2673061a5 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.Data; + +/** + * 报表批量导出form dto + */ +@Data +public class ReportBatchExportFormDTO { + + private String token; + private String paramKey; + private String reportId; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index 0c4cdcc0fa..afd9fabde9 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -2,12 +2,11 @@ package com.epmet.controller; import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.PreviewReportFormDTO; -import com.epmet.dto.form.ReportEditFormDTO; -import com.epmet.dto.form.ReportListFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.PreviewReportResDTO; import com.epmet.dto.result.ReportResultDTO; import com.epmet.service.IcCustomerReportService; @@ -17,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; import java.util.List; @@ -84,4 +85,24 @@ public class IcCustomerReportController { return new Result>().ok(icCustomerReportService.reportIdAndName(formDTO)); } + /** + * 批量导出 + */ + @PostMapping("batch-export") + public void batchExport(@RequestBody ReportBatchExportFormDTO input, HttpServletResponse response) { + + String reportId = input.getReportId(); + String paramKey = input.getParamKey(); + String token = input.getToken(); + + icCustomerReportService.batchExport(reportId, token, paramKey, response); + } + + @ReportRequest + @PostMapping("test") + public void test(@RequestBody ExportResiUserFormDTO input) { + + System.out.println(input); + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java index b833104c97..6bd359dd57 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -9,6 +9,7 @@ import com.epmet.dto.result.PreviewReportResDTO; import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -49,4 +50,6 @@ public interface IcCustomerReportService extends BaseService reportIdAndName(ReportListFormDTO formDTO); + + void batchExport(String reportId, String token, String paramKey, HttpServletResponse response); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 9abbc699f7..41bef27c2d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -1,24 +1,28 @@ package com.epmet.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.toolkit.IdWorker; import com.epmet.commons.feignclient.dtos.JiMuPage; import com.epmet.commons.feignclient.dtos.JiMuResult; import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; +import com.epmet.commons.feignclient.dtos.form.JimuReportExportRequestDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportDbDataResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportFieldTreeResultDTO; import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; 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.constant.StrConstant; +import com.epmet.commons.tools.constant.*; import com.epmet.commons.tools.dto.form.DictListFormDTO; import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.redis.RedisUtils; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.EpmetRequestHolder; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.*; import com.epmet.constant.CustomerFunctionConstant; import com.epmet.dao.IcCustomerReportDao; import com.epmet.dto.CustomerDTO; @@ -33,8 +37,10 @@ import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.IcCustomerReportService; import com.epmet.service.IcReportFunService; +import feign.Response; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; @@ -42,11 +48,20 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.MultiValueMap; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; /** * 客户报表关系表 @@ -70,8 +85,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -81,6 +96,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl headers = new HttpHeaders(); headers.add("token", authorization); JiMuResult> result = jiMuReportOpenFeignClient.getList(1, 10000, "", "datainfo", authorization, headers); - if (!result.isSuccess()){ + if (!result.isSuccess()) { throw new EpmetException("获取所有jm报表失败"); } - List> records = (List>)result.getResult().getRecords(); + List> records = (List>) result.getResult().getRecords(); List allReports = new ArrayList<>(); for (Map record : records) { - allReports.add(ConvertUtils.mapToEntity(record,JiMuReportResultDTO.class)); + allReports.add(ConvertUtils.mapToEntity(record, JiMuReportResultDTO.class)); } - if (CollectionUtils.isEmpty(allReports)){ + if (CollectionUtils.isEmpty(allReports)) { return new ArrayList<>(); } List allReportList = new ArrayList<>(); @@ -110,26 +126,26 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportList = baseDao.reportList(null,null); - if (CollectionUtils.isEmpty(reportList)){ + List reportList = baseDao.reportList(null, null); + if (CollectionUtils.isEmpty(reportList)) { return allReportList; } Result> dictList = adminOpenFeignClient.dictList(new DictListFormDTO(CustomerFunctionConstant.REPORT_CATEGORY)); - if (!dictList.success()){ + if (!dictList.success()) { throw new EpmetException("查询字典信息失败:" + CustomerFunctionConstant.REPORT_CATEGORY); } - if (CollectionUtils.isNotEmpty(dictList.getData())){ + if (CollectionUtils.isNotEmpty(dictList.getData())) { dictList.getData().forEach(d -> reportList.stream().filter(r -> d.getValue().equals(r.getCategoryKey())).forEach(r -> r.setCategoryName(d.getLabel()))); } Result> allCustomerList = operCrmOpenFeignClient.getAllCustomerList(); - if (!allCustomerList.success()){ + if (!allCustomerList.success()) { throw new EpmetException("获取客户信息失败..."); } - if (CollectionUtils.isNotEmpty(allCustomerList.getData())){ + if (CollectionUtils.isNotEmpty(allCustomerList.getData())) { allCustomerList.getData().forEach(c -> reportList.stream().filter(r -> c.getId().equals(r.getCustomerId())).forEach(r -> r.setCustomerName(c.getCustomerName()))); } Map> groupByReport = reportList.stream().collect(Collectors.groupingBy(ReportResultDTO::getReportId)); - groupByReport.forEach((reportId,l) -> allReportList.stream().filter(a -> a.getReportId().equals(reportId)).forEach(a -> a.setCustomerList(ConvertUtils.sourceToTarget(l, ReportResultDTO.CustomerList.class)))); + groupByReport.forEach((reportId, l) -> allReportList.stream().filter(a -> a.getReportId().equals(reportId)).forEach(a -> a.setCustomerList(ConvertUtils.sourceToTarget(l, ReportResultDTO.CustomerList.class)))); return allReportList; } @@ -152,6 +168,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportIds = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(formDTO.getCustomerList())){ + if (CollectionUtils.isNotEmpty(formDTO.getCustomerList())) { reportIds = baseDao.getIdsByCustomer(formDTO.getCustomerList().stream().map(m -> m.getCustomerId()).collect(Collectors.toList()), formDTO.getReportId()); } - if (formDTO.getType().equals(CustomerFunctionConstant.REPORT_EDIT)){ + if (formDTO.getType().equals(CustomerFunctionConstant.REPORT_EDIT)) { // 单个编辑 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, formDTO.getReportId()); } - if (CollectionUtils.isNotEmpty(reportIds)){ + if (CollectionUtils.isNotEmpty(reportIds)) { baseDao.delCustomerReportFun(reportIds); } - if (CollectionUtils.isNotEmpty(formDTO.getCustomerList())){ + if (CollectionUtils.isNotEmpty(formDTO.getCustomerList())) { List entities = new ArrayList<>(); List funEntities = new ArrayList<>(); formDTO.getCustomerList().forEach(c -> { @@ -180,7 +197,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl { IcReportFunEntity funEntity = new IcReportFunEntity(); funEntity.setCustomerReportId(reportEntity.getId()); @@ -190,12 +207,13 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportIdAndName(ReportListFormDTO formDTO) { List reportList = baseDao.reportList(formDTO.getCategoryKeys(), formDTO.getCustomerId()); - if (CollectionUtils.isEmpty(reportList)){ + if (CollectionUtils.isEmpty(reportList)) { return new ArrayList<>(); } List recordIds = reportList.stream().map(m -> m.getReportId()).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); @@ -216,9 +234,9 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl headers = new HttpHeaders(); headers.add("token", authorization); headers.add("Authorization", authorization); - JiMuResult> report = jiMuReportOpenFeignClient.getReport(r,"","",headers); - if (!report.isSuccess()){ - throw new EpmetException("获取jm报表详情失败:"+r); + JiMuResult> report = jiMuReportOpenFeignClient.getReport(r, "", "", headers); + if (!report.isSuccess()) { + throw new EpmetException("获取jm报表详情失败:" + r); } JiMuReportResultDTO data = ConvertUtils.mapToEntity(report.getResult(), JiMuReportResultDTO.class); data.setReportId(data.getId()); @@ -229,13 +247,235 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportEntities,List funEntities){ - if (CollectionUtils.isNotEmpty(reportEntities)){ + public void insetCustomerReportAndFun(List reportEntities, List funEntities) { + if (CollectionUtils.isNotEmpty(reportEntities)) { insertBatch(reportEntities); } - if (CollectionUtils.isNotEmpty(funEntities)){ + if (CollectionUtils.isNotEmpty(funEntities)) { reportFunService.insertBatch(funEntities); } } + @Override + public void batchExport(String reportId, String token, String paramKey, HttpServletResponse response) { + + // 1. 首先去积木服务,查询出报表数据源的详细信息,包括报表url,isList;获取到哪一列是id(idFieldName) + + // 根据报表id查询数据源列表,取出第一个 + JiMuResult>> fResult = jiMuReportOpenFeignClient.fieldTree(reportId); + String datasourceId = fResult.getResult().get(0).get(0).getDbId(); + + // 根据数据源ID查询数据源信息 + JiMuResult dbData = jiMuReportOpenFeignClient.loadDbData(datasourceId); + JimuReportDbDataResultDTO.ReportDB reportDb = dbData.getResult().getReportDb(); + + // api的url + String apiUrl = reportDb.getApiUrl(); + // api方法 + //String apiMethod = reportDb.getApiMethod(); + // 是否是集合 + //String isList = reportDb.getIsList(); + // 返回的列表中,哪个字段是ID + String idFieldName = null; + boolean isHttps = false; + + Matcher matcher = Pattern.compile("(http://|https://).+idFieldName=(\\w+).*").matcher(apiUrl); + if (matcher.matches()) { + String proto = matcher.group(1); + if ("https://".equals(proto)) { + isHttps = true; + } + idFieldName = matcher.group(2); + } + + if (StringUtils.isBlank(idFieldName)) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "配置的业务api url缺少idFieldName列"); + } + + // 2. 调用该url的接口,获取到一个列表,根据idFieldName取出ID列 + List ids = listIds(apiUrl, isHttps, idFieldName); + + // 3. 然后以这一列作为查询条件,循环,继续调用该接口,得到单条数据,每一条数据都下载一个excel,最后将其打包为一个压缩包下载 + Path storePath = makeTemporaryDownloadDir(reportId); + + // 4.生成压缩文件 + Path zipFile = downloadAndComppress(storePath, reportId, paramKey, ids); + + // 5.下载 + try (FileInputStream fis = new FileInputStream(zipFile.toFile())) { + ServletOutputStream os = response.getOutputStream(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-Type", "application/zip"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(zipFile.getFileName().toString(), "UTF-8")); + + IOUtils.copy(fis, os); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + Files.delete(zipFile); + } catch (IOException e) { + log.error("【报表批量导出】删除临时zip文件失败"); + } + } + } + + /** + * 批量下载 + * @param storePath 本次导出文件的存储路径,子目录包括:zip文件,时间戳命名的子目录用于存放临时excel(导出完成会删掉) + * @param ids + * @return 压缩文件路径 + */ + private Path downloadAndComppress(Path storePath, String reportId, String paramKey, List ids) { + // 请求头 + Map headers = new HashMap<>(); + headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); + + // 请求体 + JimuReportExportRequestDTO param = new JimuReportExportRequestDTO(); + param.setExcelConfigId(reportId); + param.getQueryParam().setCurrentPageNo("1"); + param.getQueryParam().setCurrentPageSize(20); + param.getQueryParam().setPageNo("1"); + param.getQueryParam().setPageSize(20); + param.getQueryParam().setParamKey(paramKey); + param.getQueryParam().setToken(EpmetRequestHolder.getLoginUserAuthorizationToken()); + + final ArrayList files = new ArrayList<>(); + + final String currentTimeStr = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")); + + // 创建存放xlsx的临时目录 + Path xlsxStorePath = storePath.resolve(currentTimeStr); + try { + Files.createDirectories(xlsxStorePath); + } catch (IOException e) { + throw new EpmetException("【报表批量导出】生成临时目录失败:" + xlsxStorePath.toString()); + } + + + // 1. 循环下载所有id对应的excel + for (String id : ids) { + param.getQueryParam().setId(id); + final Response response = jiMuReportOpenFeignClient.exportAllExcelStream(param); + // 取出文件后缀 + final LinkedList header = (LinkedList) response.headers().get("content-disposition"); + final Matcher matcher = Pattern.compile("attachment;filename=(.+)(.xls|.xlsx)").matcher(header.get(0)); + if (!matcher.matches()) { + log.error("【报表批量导出】批量导出失败,后缀不匹配。文件名:{}, 报表ID:{}, 业务数据ID:{}", header.get(0), reportId, id); + continue; + } + + final File excelFile = xlsxStorePath.resolve("file_" + id + matcher.group(2)).toFile(); + + files.add(excelFile); + try (FileOutputStream fos = new FileOutputStream(excelFile)) { + IOUtils.copy(response.body().asInputStream(), fos); + } catch (Exception e) { + log.error("【报表批量导出】生成临时表格文件失败,文件名:{},报表ID:{}, 业务数据ID:{},错误信息:{}", header.get(0), reportId, id, ExceptionUtils.getErrorStackTrace(e)); + } + } + + // 2,打包 + Path zipFile = storePath.resolve("report_export_" + currentTimeStr + ".zip"); + try (final FileOutputStream fos = new FileOutputStream(zipFile.toFile()); + final ZipOutputStream zos = new ZipOutputStream(fos)) { + + // 循环每一个文件 + for (File file : files) { + try (final FileInputStream fis = new FileInputStream(file.getAbsolutePath())) { + zos.putNextEntry(new ZipEntry("report_export_" + currentTimeStr + "/" + file.getName())); + final byte[] buffer = new byte[10240]; + for (int len; (len = fis.read(buffer)) > 0; ) { + zos.write(buffer, 0, len); + } + } finally { + zos.closeEntry(); + } + } + + zos.flush(); + } catch (Exception e) { + log.error("【报表批量导出】压缩文件失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "压缩失败", "压缩失败"); + } finally { + // 删除临时文件 + cleanTemporaryFiles(storePath.resolve(currentTimeStr)); + } + + return zipFile; + } + + /** + * 清理临时保存文件 + */ + private void cleanTemporaryFiles(Path tempStorePath) { + // 删除内部文件 + for (File file : tempStorePath.toFile().listFiles()) { + try { + Files.delete(file.toPath()); + } catch (IOException e) { + log.error("【报表批量导出】删除临时文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), null, null); + } + } + + // 删除文件夹 + try { + Files.delete(tempStorePath); + } catch (IOException e) { + log.error("【报表批量导出】删除临时目录失败:{}", ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), null, null); + } + } + + /** + * 创建临时目录 + * + * @param reportId + * @return + */ + private Path makeTemporaryDownloadDir(String reportId) { + + String userId = EpmetRequestHolder.getLoginUserId(); + try { + return FileUtils.getAndCreateDirUnderEpmetFilesDir("report/batch_export/", reportId, userId); + } catch (IOException e) { + throw new EpmetException("报表】批量导出-创建临时目录失败,错误信息:" + ExceptionUtils.getErrorStackTrace(e)); + } + } + + /** + * 列出id列表,批量下载用 + * + * @param apiUrl + * @param isHttps + * @param idFieldName + * @return + */ + public List listIds(String apiUrl, boolean isHttps, String idFieldName) { + apiUrl = apiUrl.replace("${id}", ""); + + Map headers = new HashMap<>(); + headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); + Result stringResult = HttpClientManager.getInstance().sendPost(apiUrl, isHttps, "{}", headers); + + JSONObject dataJsonObject = JSON.parseObject(stringResult.getData()); + Object data = dataJsonObject.get("data"); + + JSONArray array = new JSONArray(); + ArrayList ids = new ArrayList<>(); + + // 这种可能是pageData的 + if (data instanceof JSONObject) { + JSONObject jo = (JSONObject) data; + array = jo.getJSONArray("list"); + } + + for (ListIterator it = array.listIterator(); it.hasNext(); ) { + JSONObject e = (JSONObject) it.next(); + ids.add(e.getString(idFieldName)); + } + return ids; + } } \ No newline at end of file From f172839441bc5a8f287c7aa2aba7bbbf0d498bf4 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 16 Aug 2022 21:51:19 +0800 Subject: [PATCH 47/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=87=BA=EF=BC=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/controller/ReportController.java | 8 +++++--- .../java/com/epmet/dto/form/ReportBatchExportFormDTO.java | 2 +- .../com/epmet/controller/IcCustomerReportController.java | 3 +-- .../java/com/epmet/service/IcCustomerReportService.java | 2 +- .../epmet/service/impl/IcCustomerReportServiceImpl.java | 7 ++++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java index 7576b1fa6d..3499e2dc6a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ReportHouseTestFormDTO; @@ -20,9 +21,10 @@ public class ReportController { * @return */ @PostMapping("houses/test") - public Result> listHouses(@RequestBody ReportHouseTestFormDTO input, @RequestParam(value="id", required = false) String id) { - System.out.println("id:"+id); - PageData pageData = houseService.listHouses4ReportTest(id, input.getPageNo(), input.getPageSize()); + @ReportRequest + public Result> listHouses(@RequestBody ReportHouseTestFormDTO input) { + System.out.println("id:"+input.getId()); + PageData pageData = houseService.listHouses4ReportTest(input.getId(), input.getPageNo(), input.getPageSize()); return new Result>().ok(pageData); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java index a2673061a5..9fccc4517d 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java @@ -8,7 +8,7 @@ import lombok.Data; @Data public class ReportBatchExportFormDTO { - private String token; + //private String token; private String paramKey; private String reportId; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index afd9fabde9..b5f1a1c28a 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -93,9 +93,8 @@ public class IcCustomerReportController { String reportId = input.getReportId(); String paramKey = input.getParamKey(); - String token = input.getToken(); - icCustomerReportService.batchExport(reportId, token, paramKey, response); + icCustomerReportService.batchExport(reportId, paramKey, response); } @ReportRequest diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java index 6bd359dd57..54b5a6f22c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -51,5 +51,5 @@ public interface IcCustomerReportService extends BaseService reportIdAndName(ReportListFormDTO formDTO); - void batchExport(String reportId, String token, String paramKey, HttpServletResponse response); + void batchExport(String reportId, String paramKey, HttpServletResponse response); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 41bef27c2d..2d985ad0c7 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -257,7 +257,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl ids = listIds(apiUrl, isHttps, idFieldName); + List ids = listIds(paramKey, apiUrl, isHttps, idFieldName); // 3. 然后以这一列作为查询条件,循环,继续调用该接口,得到单条数据,每一条数据都下载一个excel,最后将其打包为一个压缩包下载 Path storePath = makeTemporaryDownloadDir(reportId); @@ -453,8 +453,9 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl listIds(String apiUrl, boolean isHttps, String idFieldName) { + public List listIds(String paramKey, String apiUrl, boolean isHttps, String idFieldName) { apiUrl = apiUrl.replace("${id}", ""); + apiUrl = apiUrl.replace("${paramKey}", paramKey); Map headers = new HashMap<>(); headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); From fef1420105888b392122e67e1fcef5938e65b2ba Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 16 Aug 2022 22:16:53 +0800 Subject: [PATCH 48/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=87=BA=EF=BC=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/aspect/ReportRequestAspect.java | 7 ++++--- .../com/epmet/dto/form/ReportHouseTestFormDTO.java | 1 + .../com/epmet/controller/ReportController.java | 14 ++++++++++++++ .../epmet/dto/form/ReportBatchExportFormDTO.java | 5 +++++ .../controller/IcCustomerReportController.java | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java index a23423c08f..c355a39df1 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java @@ -1,6 +1,7 @@ package com.epmet.commons.tools.aspect; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.redis.RedisUtils; @@ -71,13 +72,13 @@ public class ReportRequestAspect { private void fillArgsToRequestBody(Object[] args, Map storedParams, Parameter[] parameters) { for (int i = 0; i < args.length; i++) { Object arg = args[i]; - //Class argClazz = arg.getClass(); RequestBody requestBodyAnno = parameters[i].getAnnotation(RequestBody.class); if (arg != null && requestBodyAnno != null) { Object argBean = BeanUtil.mapToBean(storedParams, arg.getClass(), true); - // 分页参数需要从 - BeanUtil.copyProperties(argBean, arg, "pageSize", "pageNo", "isPage"); + // "pageSize", "pageNo", "isPage"三个属性不从redis拷贝,而是取传递雇来的 + // redis里面的字段如果是null,则不会赋值给arg + BeanUtil.copyProperties(argBean, arg, new CopyOptions(null, true, "pageSize", "pageNo", "isPage")); return; } } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java index b5206162e4..2912d5546d 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java @@ -8,5 +8,6 @@ public class ReportHouseTestFormDTO { private Integer pageNo = 1; private Integer pageSize = 20; private String id; + private String test; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java index 3499e2dc6a..1f9337400e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ReportHouseTestFormDTO; import com.epmet.dto.result.ReportHouseTestResultDTO; @@ -9,6 +10,8 @@ import com.epmet.service.HouseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; + @RestController @RequestMapping("report") public class ReportController { @@ -16,6 +19,9 @@ public class ReportController { @Autowired private HouseService houseService; + @Autowired + private RedisUtils redisUtils; + /** * todo 测试用的 * @return @@ -28,4 +34,12 @@ public class ReportController { return new Result>().ok(pageData); } + @PostMapping("put") + public void put() { + final HashMap m = new HashMap<>(); + m.put("test", "aaa"); + + redisUtils.hMSet("ttt", m); + } + } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java index 9fccc4517d..59adb68a26 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java @@ -2,6 +2,8 @@ package com.epmet.dto.form; import lombok.Data; +import javax.validation.constraints.NotBlank; + /** * 报表批量导出form dto */ @@ -9,7 +11,10 @@ import lombok.Data; public class ReportBatchExportFormDTO { //private String token; + private String paramKey; + + @NotBlank(message = "reportId必填") private String reportId; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index b5f1a1c28a..bd1898171d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -90,7 +90,7 @@ public class IcCustomerReportController { */ @PostMapping("batch-export") public void batchExport(@RequestBody ReportBatchExportFormDTO input, HttpServletResponse response) { - + ValidatorUtils.validateEntity(input); String reportId = input.getReportId(); String paramKey = input.getParamKey(); From 523f0c017f33dff74be428db42f1af126574cd98 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 17 Aug 2022 09:13:00 +0800 Subject: [PATCH 49/62] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V0.0.37__ic_report_fun.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql new file mode 100644 index 0000000000..57e0fe6602 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql @@ -0,0 +1,12 @@ +CREATE TABLE `ic_report_fun` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_REPORT_ID` varchar(64) NOT NULL COMMENT 'ic_customer_report.id', + `FUN_CATEGORY_KEY` varchar(255) NOT NULL COMMENT '功能类别来源于字典表key;eg:resi_info,house_info', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除;', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间=绑定时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='报表所属功能表'; From 4cbe3134a2ff0ab854cffcbf992aae1a4b9d05c4 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 17 Aug 2022 10:06:00 +0800 Subject: [PATCH 50/62] test --- .../com/epmet/service/impl/IcResiUserExportServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index f22a744046..0278c1241d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -104,7 +104,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { WriteSheet writeSheet = null; try { //获取用户配置的导出条件 - Result exportConfigResult = this.getIcCustomExportConfig(exportResiUserFormDTO.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); + Result exportConfigResult = this.getIcCustomExportConfig(searchForm.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); Map itemOriginMap = getItemMap(searchForm.getCustomerId()); IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); @@ -244,7 +244,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { */ public void validateSearchForm(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO) { IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); - searchForm.setCustomerId(tokenDto.getCustomerId()); + searchForm.setCustomerId(StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId()) ? exportResiUserFormDTO.getCustomerId() : tokenDto.getCustomerId()); searchForm.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(searchForm, IcResiUserPageFormDTO.AddUserInternalGroup.class); } From 03e904b4d41d1734859f642072162f3c0660a725 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 17 Aug 2022 10:35:26 +0800 Subject: [PATCH 51/62] test --- .../com/epmet/service/impl/IcResiUserExportServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index 0278c1241d..66caf97afc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -103,8 +103,9 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { ExcelWriter excelWriter = null; WriteSheet writeSheet = null; try { + String dynamicCustomerId=StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId()) ? exportResiUserFormDTO.getCustomerId() : tokenDto.getCustomerId() //获取用户配置的导出条件 - Result exportConfigResult = this.getIcCustomExportConfig(searchForm.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); + Result exportConfigResult = this.getIcCustomExportConfig(dynamicCustomerId, templateId, exportResiUserFormDTO.getExportConfig()); Map itemOriginMap = getItemMap(searchForm.getCustomerId()); IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); @@ -244,7 +245,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { */ public void validateSearchForm(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO) { IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); - searchForm.setCustomerId(StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId()) ? exportResiUserFormDTO.getCustomerId() : tokenDto.getCustomerId()); + searchForm.setCustomerId(tokenDto.getCustomerId()); searchForm.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(searchForm, IcResiUserPageFormDTO.AddUserInternalGroup.class); } From 5b5161de13cbdf0b38f630277091d241fbb2a24e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 17 Aug 2022 11:19:57 +0800 Subject: [PATCH 52/62] id --- .../epmet/dto/form/ExportResiUserFormDTO.java | 12 ++-------- .../com/epmet/dto/form/ReportDataFormDTO.java | 23 +++++++++++++++++++ .../impl/IcResiUserExportServiceImpl.java | 19 ++++++++++++++- 3 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java index cb6f89eb76..c6727abd24 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java @@ -11,12 +11,9 @@ import java.io.Serializable; * @Date 2021/10/27 2:06 下午 */ @Data -public class ExportResiUserFormDTO implements Serializable { +public class ExportResiUserFormDTO extends ReportDataFormDTO implements Serializable { private static final long serialVersionUID = 8777535966834678256L; - /** - * 客户Id - */ - private String customerId; + /** * 表单查询条件 */ @@ -31,11 +28,6 @@ public class ExportResiUserFormDTO implements Serializable { */ private IcExportTemplateSaveFormDTO exportConfig; - /** - * pageNo 报表用的 - */ - private Integer pageNo = 1; - private Integer pageSize = 1000; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java new file mode 100644 index 0000000000..6ef39cb1f4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/8/17 11:13 + */ +@Data +public class ReportDataFormDTO { + /** + * 客户Id + */ + private String customerId; + /** + * pageNo 报表用的 + */ + private Integer pageNo = 1; + private Integer pageSize = 1000; + private String id; +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index 66caf97afc..c09b50b644 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -31,6 +31,7 @@ import com.epmet.constant.IcResiUserConstant; import com.epmet.dto.form.ExportResiUserFormDTO; import com.epmet.dto.form.IcExportTemplateQueryFormDTO; import com.epmet.dto.form.IcResiUserPageFormDTO; +import com.epmet.dto.form.ResiUserQueryValueDTO; import com.epmet.dto.result.FormItemResult; import com.epmet.dto.result.IcCustomExportResultDTO; import com.epmet.dto.result.OptionDTO; @@ -45,6 +46,7 @@ import com.google.common.base.Joiner; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.VerticalAlignment; @@ -103,7 +105,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { ExcelWriter excelWriter = null; WriteSheet writeSheet = null; try { - String dynamicCustomerId=StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId()) ? exportResiUserFormDTO.getCustomerId() : tokenDto.getCustomerId() + String dynamicCustomerId=StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId()) ? exportResiUserFormDTO.getCustomerId() : tokenDto.getCustomerId(); //获取用户配置的导出条件 Result exportConfigResult = this.getIcCustomExportConfig(dynamicCustomerId, templateId, exportResiUserFormDTO.getExportConfig()); @@ -164,6 +166,21 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); do { + if(StringUtils.isNotBlank(exportResiUserFormDTO.getId())){ + ResiUserQueryValueDTO idCondition=new ResiUserQueryValueDTO(); + idCondition.setTableName("ic_resi_user"); + idCondition.setQueryType("equal"); + idCondition.setColumnName("ID"); + idCondition.setColumnValue(Arrays.asList(exportResiUserFormDTO.getId())); + + if(CollectionUtils.isNotEmpty(searchForm.getConditions())){ + searchForm.getConditions().add(idCondition); + }else{ + List conditions=new ArrayList<>(); + conditions.add(idCondition); + searchForm.setConditions(conditions); + } + } String finalStaffOrgPath = staffOrgPath; mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { icResiUserService.dynamicQuery(searchForm.getCustomerId(), searchForm.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, searchForm.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); From 6f87d910fbb23ef040ca731384871deff8adf0f2 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 17 Aug 2022 12:54:34 +0800 Subject: [PATCH 53/62] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=B1=85=E6=B0=91=EF=BC=8C=E5=9B=BA=E5=AE=9A=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=B1=85=E6=B0=91ID=E5=88=97=EF=BC=9AIC=5FRESI=5FID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/IcResiUserDao.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 8ba307f70c..c33a228661 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -249,6 +249,7 @@ select - ic_resi_user.ID AS IC_RESI_ID, From 079a3ccf7324ae969bb0a492192d513b50125531 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 17 Aug 2022 13:51:08 +0800 Subject: [PATCH 55/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91listI?= =?UTF-8?q?ds()=E6=96=B9=E6=B3=95=EF=BC=8C=E9=80=82=E9=85=8Dfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/IcCustomerReportServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 2d985ad0c7..59e2a836a7 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -467,10 +467,13 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl ids = new ArrayList<>(); - // 这种可能是pageData的 if (data instanceof JSONObject) { + // 这种可能是pageData的 JSONObject jo = (JSONObject) data; array = jo.getJSONArray("list"); + } else { + // 可能是不分页的列表 + array = (JSONArray) data; } for (ListIterator it = array.listIterator(); it.hasNext(); ) { From 729bf41e1bf818849661bd4af97d68f30d95838c Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 17 Aug 2022 14:24:06 +0800 Subject: [PATCH 56/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91custo?= =?UTF-8?q?mize=E6=9C=8D=E5=8A=A1=E5=A2=9E=E5=8A=A0=E6=8C=82=E8=BD=BD?= =?UTF-8?q?=EF=BC=9A-=20"/opt/epmet=5Ffiles/:/opt/epmet=5Ffiles"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oper-customize-server/deploy/docker-compose-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml index cfaf3a1772..7cee38b4f7 100644 --- a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml @@ -8,6 +8,7 @@ services: network_mode: host # 使用现有网络 volumes: - "/opt/epmet-cloud-logs/dev:/logs" + - "/opt/epmet_files/:/opt/epmet_files" environment: RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./oper-customize.jar" restart: "unless-stopped" From c07d4b29dacd8480ed76d7367583e4883cea64da Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 17 Aug 2022 15:12:16 +0800 Subject: [PATCH 57/62] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AAisLis?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/result/ReportResultDTO.java | 3 +++ .../epmet/service/impl/IcCustomerReportServiceImpl.java | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java index b8638c3b5c..2701957317 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java @@ -27,6 +27,8 @@ public class ReportResultDTO implements Serializable { */ private String reportId; + private Boolean isList; + /** * 客户ID */ @@ -86,6 +88,7 @@ public class ReportResultDTO implements Serializable { public ReportResultDTO() { this.reportName = ""; this.reportId = ""; + this.isList = false; this.customerList = new ArrayList<>(); } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 59e2a836a7..4b6a79619b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -124,6 +124,15 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportDbDataResultDTOJiMuResult = jiMuReportOpenFeignClient.loadDbData(r.getId()); + if (!reportDbDataResultDTOJiMuResult.isSuccess()){ + throw new EpmetException("获取报表dbData失败:"+r.getId()); + } + log.info(JSON.toJSONString(reportDbDataResultDTOJiMuResult)); + JimuReportDbDataResultDTO.ReportDB reportDb = reportDbDataResultDTOJiMuResult.getResult().getReportDb(); + if (null != reportDb){ + dto.setIsList(reportDb.getIsList().equals(NumConstant.ONE_STR)); + } allReportList.add(dto); }); List reportList = baseDao.reportList(null, null); From fbb52ecf7cb6f15191492ea4b5878d5b5b2d3f10 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 17 Aug 2022 15:51:00 +0800 Subject: [PATCH 58/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=87=BA-=E5=A4=9A=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E5=8F=8A=E7=B3=BB=E5=88=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/JimuReportDbDataResultDTO.java | 1 + .../impl/IcCustomerReportServiceImpl.java | 84 +++++++++++++------ 2 files changed, 61 insertions(+), 24 deletions(-) diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java index fe6bf6240b..8eb58e8b74 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java @@ -12,6 +12,7 @@ public class JimuReportDbDataResultDTO { private String apiUrl; private String apiMethod; private String isList; + private String dbChName; } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 59e2a836a7..3da6d12f4a 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -40,6 +40,7 @@ import com.epmet.service.IcReportFunService; import feign.Response; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -57,6 +58,9 @@ import java.nio.file.Path; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -83,6 +87,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl getWrapper(Map params) { @@ -299,7 +305,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl ids) { + private Path downloadAndComppress(Path storePath, String reportId, String reportName, String paramKey, List ids) { // 请求头 Map headers = new HashMap<>(); headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); @@ -341,9 +347,9 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl files = new ArrayList<>(); + ArrayList files = new ArrayList<>(); - final String currentTimeStr = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")); + String currentTimeStr = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")); // 创建存放xlsx的临时目录 Path xlsxStorePath = storePath.resolve(currentTimeStr); @@ -353,38 +359,34 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl> idParts = ListUtils.partition(ids, 100); // 1. 循环下载所有id对应的excel - for (String id : ids) { - param.getQueryParam().setId(id); - final Response response = jiMuReportOpenFeignClient.exportAllExcelStream(param); - // 取出文件后缀 - final LinkedList header = (LinkedList) response.headers().get("content-disposition"); - final Matcher matcher = Pattern.compile("attachment;filename=(.+)(.xls|.xlsx)").matcher(header.get(0)); - if (!matcher.matches()) { - log.error("【报表批量导出】批量导出失败,后缀不匹配。文件名:{}, 报表ID:{}, 业务数据ID:{}", header.get(0), reportId, id); - continue; - } - - final File excelFile = xlsxStorePath.resolve("file_" + id + matcher.group(2)).toFile(); + CountDownLatch cdl = new CountDownLatch(idParts.size()); + for (List idPart : idParts) { + CompletableFuture.runAsync(() -> { + downloadXlsByBatchByBizId(reportId, idPart, param, xlsxStorePath, files, cdl); + }, executorService); + } - files.add(excelFile); - try (FileOutputStream fos = new FileOutputStream(excelFile)) { - IOUtils.copy(response.body().asInputStream(), fos); - } catch (Exception e) { - log.error("【报表批量导出】生成临时表格文件失败,文件名:{},报表ID:{}, 业务数据ID:{},错误信息:{}", header.get(0), reportId, id, ExceptionUtils.getErrorStackTrace(e)); - } + // 等待多线程执行完成,再执行打包 + try { + cdl.await(); + } catch (InterruptedException e) { + log.error(ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException("【报表批量导出】CountDownLatch等待被中断"); } // 2,打包 - Path zipFile = storePath.resolve("report_export_" + currentTimeStr + ".zip"); + Path zipFile = storePath.resolve(reportName + "_" + currentTimeStr + ".zip"); try (final FileOutputStream fos = new FileOutputStream(zipFile.toFile()); final ZipOutputStream zos = new ZipOutputStream(fos)) { // 循环每一个文件 for (File file : files) { try (final FileInputStream fis = new FileInputStream(file.getAbsolutePath())) { - zos.putNextEntry(new ZipEntry("report_export_" + currentTimeStr + "/" + file.getName())); + zos.putNextEntry(new ZipEntry(reportName + "_" + currentTimeStr + "/" + file.getName())); final byte[] buffer = new byte[10240]; for (int len; (len = fis.read(buffer)) > 0; ) { zos.write(buffer, 0, len); @@ -406,6 +408,40 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl bizIds, JimuReportExportRequestDTO param, Path xlsxStorePath, ArrayList files, + CountDownLatch cdl) { + for (String id : bizIds) { + param.getQueryParam().setId(id); + final Response response = jiMuReportOpenFeignClient.exportAllExcelStream(param); + // 取出文件后缀 + final LinkedList header = (LinkedList) response.headers().get("content-disposition"); + final Matcher matcher = Pattern.compile("attachment;filename=(.+)(.xls|.xlsx)").matcher(header.get(0)); + if (!matcher.matches()) { + log.error("【报表批量导出】批量导出失败,后缀不匹配。文件名:{}, 报表ID:{}, 业务数据ID:{}", header.get(0), reportId, id); + continue; + } + + final File excelFile = xlsxStorePath.resolve("file_" + id + matcher.group(2)).toFile(); + + files.add(excelFile); + try (FileOutputStream fos = new FileOutputStream(excelFile)) { + IOUtils.copy(response.body().asInputStream(), fos); + } catch (Exception e) { + log.error("【报表批量导出】生成临时表格文件失败,文件名:{},报表ID:{}, 业务数据ID:{},错误信息:{}", header.get(0), reportId, id, ExceptionUtils.getErrorStackTrace(e)); + } + } + + cdl.countDown(); + } + /** * 清理临时保存文件 */ From 32225e30baee900528fcd1067ae9bd98edaa0ca0 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 17 Aug 2022 17:11:04 +0800 Subject: [PATCH 59/62] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AAisLis?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dtos/result/JiMuReportResultDTO.java | 2 ++ .../impl/IcCustomerReportServiceImpl.java | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java index 9f48ab6bba..6ef587b6d5 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java @@ -21,4 +21,6 @@ public class JiMuReportResultDTO implements Serializable { private String id; private String reportId; private String reportName; + + private Boolean isList = false; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 04e1b596b4..f77a9741bc 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -130,15 +130,6 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportDbDataResultDTOJiMuResult = jiMuReportOpenFeignClient.loadDbData(r.getId()); - if (!reportDbDataResultDTOJiMuResult.isSuccess()){ - throw new EpmetException("获取报表dbData失败:"+r.getId()); - } - log.info(JSON.toJSONString(reportDbDataResultDTOJiMuResult)); - JimuReportDbDataResultDTO.ReportDB reportDb = reportDbDataResultDTOJiMuResult.getResult().getReportDb(); - if (null != reportDb){ - dto.setIsList(reportDb.getIsList().equals(NumConstant.ONE_STR)); - } allReportList.add(dto); }); List reportList = baseDao.reportList(null, null); @@ -254,6 +245,15 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportDbDataResultDTOJiMuResult = jiMuReportOpenFeignClient.loadDbData(r); + if (!reportDbDataResultDTOJiMuResult.isSuccess()){ + throw new EpmetException("获取报表dbData失败:"+r); + } + log.info(JSON.toJSONString(reportDbDataResultDTOJiMuResult)); + JimuReportDbDataResultDTO.ReportDB reportDb = reportDbDataResultDTOJiMuResult.getResult().getReportDb(); + if (null != reportDb){ + data.setIsList(reportDb.getIsList().equals(NumConstant.ONE_STR)); + } data.setReportId(data.getId()); data.setReportName(data.getName()); result.add(data); From 34776d4f15509fb43e28cade2a3626697562daee Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 17 Aug 2022 17:15:30 +0800 Subject: [PATCH 60/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=87=BA-jmreport=E5=B9=B6=E5=8F=91?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=83=BD=E5=8A=9B=E4=B8=8D=E5=A4=AA=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=87=BA=E7=8E=B0=E7=A9=BA=E7=99=BDexcel?= =?UTF-8?q?=EF=BC=8C=E6=B2=A1=E6=95=B0=E6=8D=AE=E5=A1=AB=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/ReportBatchExportFormDTO.java | 2 ++ .../IcCustomerReportController.java | 3 ++- .../service/IcCustomerReportService.java | 2 +- .../impl/IcCustomerReportServiceImpl.java | 24 ++++++++++++++----- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java index 59adb68a26..67f0be2c22 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java @@ -17,4 +17,6 @@ public class ReportBatchExportFormDTO { @NotBlank(message = "reportId必填") private String reportId; + private String id; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index bd1898171d..6859f3e942 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -93,8 +93,9 @@ public class IcCustomerReportController { ValidatorUtils.validateEntity(input); String reportId = input.getReportId(); String paramKey = input.getParamKey(); + final String id = input.getId(); - icCustomerReportService.batchExport(reportId, paramKey, response); + icCustomerReportService.batchExport(id, reportId, paramKey, response); } @ReportRequest diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java index 54b5a6f22c..297d342e19 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -51,5 +51,5 @@ public interface IcCustomerReportService extends BaseService reportIdAndName(ReportListFormDTO formDTO); - void batchExport(String reportId, String paramKey, HttpServletResponse response); + void batchExport(String bizId, String reportId, String paramKey, HttpServletResponse response); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 04e1b596b4..4d8ea4c885 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -272,7 +272,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl ids = listIds(paramKey, apiUrl, isHttps, idFieldName); + List ids = listIds(bizId, paramKey, apiUrl, isHttps, idFieldName); // 3. 然后以这一列作为查询条件,循环,继续调用该接口,得到单条数据,每一条数据都下载一个excel,最后将其打包为一个压缩包下载 Path storePath = makeTemporaryDownloadDir(reportId); @@ -428,6 +428,18 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl bizIds, JimuReportExportRequestDTO param, Path xlsxStorePath, ArrayList files, CountDownLatch cdl) { for (String id : bizIds) { + + try { + Thread.sleep(200l); + } catch (InterruptedException e) { + final String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【报表批量导出】循环导出-请求jmreport,等待过程中睡眠发生意外:{}", errorMsg); + } + + //if (!Arrays.asList("1501821697823608834","1501821694665297922","1501821695114088450","1501821695177003009","1501821695269277697","1501821695344775169","1501821695579656193","1501821695676125186","1501821695755816962","1501821695843897346","1501821695978115074","1501821696108138497","1501821696179441665","1501821696229773313","1501821696284299266","1501821696334630913","1501821696393351170","1501821696452071426","1501821696502403073","1501821696582094849","1501821696645009409","1501821696758255617","1501821696871501826","1501821696917639169","1501821696955387906","1501821696993136641","1501821697135742977","1501821697181880321","1501821697232211969","1501821697274155009").contains(id)) { + // continue; + //} + param.getQueryParam().setId(id); final Response response = jiMuReportOpenFeignClient.exportAllExcelStream(param); // 取出文件后缀 @@ -498,13 +510,13 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl listIds(String paramKey, String apiUrl, boolean isHttps, String idFieldName) { - apiUrl = apiUrl.replace("${id}", ""); - apiUrl = apiUrl.replace("${paramKey}", paramKey); + public List listIds(String id, String paramKey, String apiUrl, boolean isHttps, String idFieldName) { + apiUrl = apiUrl.replace("'${id}'", id == null ? "" : id); + apiUrl = apiUrl.replace("'${paramKey}'", paramKey); Map headers = new HashMap<>(); headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); - Result stringResult = HttpClientManager.getInstance().sendPost(apiUrl, isHttps, "{}", headers); + Result stringResult = HttpClientManager.getInstance().sendPost(apiUrl, isHttps, "{\"id\":" + id + "}", headers); JSONObject dataJsonObject = JSON.parseObject(stringResult.getData()); Object data = dataJsonObject.get("data"); From f5f2bf8d81a06c7c4bb9ff2fb92d61a463f953d2 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 17 Aug 2022 17:39:46 +0800 Subject: [PATCH 61/62] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/IcResiUserController.java | 6 ++++++ .../main/java/com/epmet/dao/IcUserChangeDetailedDao.java | 2 ++ .../src/main/java/com/epmet/dao/IcUserChangeRecordDao.java | 2 ++ .../main/java/com/epmet/dao/IcUserTransferRecordDao.java | 3 ++- .../java/com/epmet/service/IcUserChangeDetailedService.java | 2 ++ .../java/com/epmet/service/IcUserChangeRecordService.java | 2 ++ .../java/com/epmet/service/IcUserTransferRecordService.java | 2 ++ .../java/com/epmet/service/impl/IcResiUserServiceImpl.java | 4 ++++ .../epmet/service/impl/IcUserChangeDetailedServiceImpl.java | 5 +++++ .../epmet/service/impl/IcUserChangeRecordServiceImpl.java | 5 +++++ .../epmet/service/impl/IcUserTransferRecordServiceImpl.java | 5 +++++ .../src/main/resources/mapper/IcUserChangeDetailedDao.xml | 4 ++++ .../src/main/resources/mapper/IcUserChangeRecordDao.xml | 5 +++++ .../src/main/resources/mapper/IcUserTransferRecordDao.xml | 5 ++++- 14 files changed, 50 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index e3e68fdbb9..40e661a63b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -190,6 +190,12 @@ public class IcResiUserController implements ResultDataResolver { IC_RESI_DOWNLOAD_DIR = exportDir; } + /** + * 批量删除居民信息 + * @param tokenDto + * @param formDTO + * @return + */ @NoRepeatSubmit @PostMapping("delete") public Result delete(@LoginUser TokenDto tokenDto, @RequestBody DelIcResiUserFormDTO formDTO) { diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java index ecb3d1f561..bee24287c5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java @@ -39,4 +39,6 @@ public interface IcUserChangeDetailedDao extends BaseDao icUserIds); + + int deleteByIcResiUserId(String icResiUserId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java index cff359168c..89ee1327f2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java @@ -49,4 +49,6 @@ public interface IcUserChangeRecordDao extends BaseDao * @Description 删除客户是新增类型的变更历史数据 **/ void delByCustomerId(@Param("customerId") String customerId, @Param("type") String type, @Param("icUserIds") List icUserIds); + + int deleteByIcResiUserId(String icResiUserId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserTransferRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserTransferRecordDao.java index dacd67bd6c..a869491b26 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserTransferRecordDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserTransferRecordDao.java @@ -29,5 +29,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcUserTransferRecordDao extends BaseDao { - + + int deleteByIcResiUserId(String icResiUserId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java index ce2747ddcd..cf305c4b0a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java @@ -36,4 +36,6 @@ public interface IcUserChangeDetailedService extends BaseService icUserIds); + + int deleteByIcResiUserId(String icResiUserId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java index a75d3a1fe1..fa68cd34da 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java @@ -54,4 +54,6 @@ public interface IcUserChangeRecordService extends BaseService icUserIds) { baseDao.delByCustomerId(customerId, type, icUserIds); } + + @Override + public int deleteByIcResiUserId(String icResiUserId) { + return baseDao.deleteByIcResiUserId(icResiUserId); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java index f72d695c5e..4120e5c2a6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java @@ -171,6 +171,11 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl + + update ic_user_change_detailed set del_flag='1' + where IC_USER_ID=#{icResiUserId} + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml index cd04e8ddfa..cc865efc81 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml @@ -73,4 +73,9 @@ + + update ic_user_change_record set del_flag='1' + where IC_USER_ID = #{icResiUserId} + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcUserTransferRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcUserTransferRecordDao.xml index be24ced9be..d2a829567e 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcUserTransferRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcUserTransferRecordDao.xml @@ -3,5 +3,8 @@ - + + update ic_user_transfer_record set del_flag='1' + where IC_USER_ID = #{icResiUserId} + \ No newline at end of file From 23d49e6c65f3c2b030f6cdc91225ef5cfa7c0a33 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 17 Aug 2022 18:48:10 +0800 Subject: [PATCH 62/62] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91pc?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8D=95=E6=8A=A5=E8=A1=A8=E5=88=97=E8=A1=A8?= =?UTF-8?q?-=E4=BF=AE=E6=94=B9isList=E7=9A=84=E8=8E=B7=E5=8F=96=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/IcCustomerReportServiceImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 61809bfb26..f88fd01ee9 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -244,11 +244,15 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportDbDataResultDTOJiMuResult = jiMuReportOpenFeignClient.loadDbData(r); + + JiMuResult>> fResult = jiMuReportOpenFeignClient.fieldTree(r); + String datasourceId = fResult.getResult().get(0).get(0).getDbId(); + + JiMuResult reportDbDataResultDTOJiMuResult = jiMuReportOpenFeignClient.loadDbData(datasourceId); if (!reportDbDataResultDTOJiMuResult.isSuccess()){ throw new EpmetException("获取报表dbData失败:"+r); } + JiMuReportResultDTO data = ConvertUtils.mapToEntity(report.getResult(), JiMuReportResultDTO.class); log.info(JSON.toJSONString(reportDbDataResultDTOJiMuResult)); JimuReportDbDataResultDTO.ReportDB reportDb = reportDbDataResultDTOJiMuResult.getResult().getReportDb(); if (null != reportDb){