Browse Source

Merge remote-tracking branch 'origin/dev_ic_mp' into dev_ic_mp

master
yinzuomei 4 years ago
parent
commit
8ed2e8c902
  1. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java
  2. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PartyPointRankFormDTO.java
  3. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/UserPointRankFormDTO.java
  4. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  5. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java
  6. 7
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  7. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml
  8. 57
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java
  9. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java
  10. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java
  11. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  12. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java
  13. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java
  14. 62
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java
  15. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  16. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java
  17. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  18. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  19. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java
  20. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  21. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java
  22. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java
  23. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java
  24. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java
  25. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java
  26. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java
  27. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml
  28. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  29. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
  30. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  31. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  32. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
  33. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  34. 48
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  35. 27
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  36. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  37. 72
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  38. 116
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  39. 1
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  40. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml
  41. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java
  42. 24
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java
  43. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/NewEventsResultDTO.java
  44. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ResiEventListResultDTO.java
  45. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UserMentionResultDTO.java
  46. 112
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java
  47. 2
      epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml
  48. 26
      epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.17__event_scan.sql
  49. 83
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml
  50. 2
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java

@ -33,5 +33,10 @@ public class AdvancedBranchRankFormDTO implements Serializable {
*/
private String areaCode;
/**
* 客户ID
*/
private String customerId;
public interface AddUserInternalGroup {}
}

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PartyPointRankFormDTO.java

@ -36,5 +36,10 @@ public class PartyPointRankFormDTO implements Serializable {
* */
private String monthId;
/**
* 客户ID
*/
private String customerId;
}

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/UserPointRankFormDTO.java

@ -36,5 +36,9 @@ public class UserPointRankFormDTO implements Serializable {
* */
private String monthId;
/**
* 客户ID
*/
private String customerId;
}

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -1,6 +1,8 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.enums.OrgTypeEnum;
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.datareport.service.evaluationindex.screen.IndexService;
@ -146,8 +148,9 @@ public class IndexController {
* @author sun
*/
@PostMapping("advancedbranchrank")
Result<List<IndexAdvanceBranchRankResultDTO>> advancedBranchRank(@RequestBody AdvancedBranchRankFormDTO formDTO){
Result<List<IndexAdvanceBranchRankResultDTO>> advancedBranchRank(@RequestBody AdvancedBranchRankFormDTO formDTO, @LoginUser TokenDto loginUser){
ValidatorUtils.validateEntity(formDTO, AdvancedBranchRankFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(loginUser.getCustomerId());
return new Result<List<IndexAdvanceBranchRankResultDTO>>().ok(indexService.advancedBranchRank(formDTO));
}

9
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java

@ -1,5 +1,7 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.tools.annotation.LoginUser;
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.datareport.service.evaluationindex.screen.ScreenUserService;
@ -47,8 +49,10 @@ public class ScreenUserController {
* @author wxz
*/
@PostMapping("userpointrank/withoutpartymember")
public Result<List<UserPointRankListResultDTO>> userPointRankWithoutPartyMem(@RequestBody UserPointRankFormDTO formDTO) {
public Result<List<UserPointRankListResultDTO>> userPointRankWithoutPartyMem(@RequestBody UserPointRankFormDTO formDTO, @LoginUser TokenDto loginUser) {
ValidatorUtils.validateEntity(formDTO, UserPointRankFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(loginUser.getCustomerId());
return new Result<List<UserPointRankListResultDTO>>().ok(screenUserService.userPointRankWithoutPartyMem(formDTO));
}
@ -70,8 +74,9 @@ public class ScreenUserController {
* @author wxz
*/
@PostMapping("partypointrank")
public Result<List<PartyPointRankResultDTO>> partyPointRank(@RequestBody PartyPointRankFormDTO formDTO) {
public Result<List<PartyPointRankResultDTO>> partyPointRank(@RequestBody PartyPointRankFormDTO formDTO, @LoginUser TokenDto loginUser) {
ValidatorUtils.validateEntity(formDTO, PartIndexScroeRankFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(loginUser.getCustomerId());
return new Result<List<PartyPointRankResultDTO>>().ok(screenUserService.partyPointRank(formDTO));
}

7
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -240,7 +240,7 @@
<select id="selectRankList" resultType="com.epmet.evaluationindex.screen.dto.result.IndexAdvanceBranchRankResultDTO">
SELECT
CONCAT(
(select agency_name from screen_customer_agency where agency_id = rd.parent_id),
(select agency_name from screen_customer_agency where agency_id = rd.parent_id <if test="customerId != null and customerId != ''">AND org.CUSTOMER_ID = #{customerId}</if>),
'-',
dm.org_name
)AS "name",
@ -252,7 +252,7 @@
rd.satisfaction_ratio AS "satisfactionRatio"
FROM
screen_index_data_monthly dm
INNER JOIN screen_org_rank_data rd ON dm.org_id = rd.org_id
INNER JOIN screen_org_rank_data rd ON dm.org_id = rd.org_id AND dm.CUSTOMER_ID = rd.CUSTOMER_ID
<!--查询的是网格的排行 下面条件是orgType = grid-->
INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = dm.CUSTOMER_ID AND org.GRID_ID = dm.ORG_ID AND org.DEL_FLAG = '0'
@ -261,6 +261,9 @@
dm.del_flag = '0'
AND rd.del_flag = '0'
<choose>
<when test="customerId != null and customerId != ''">
AND org.CUSTOMER_ID = #{customerId}
</when>
<when test="areaCode != null and areaCode != ''">
AND org.AREA_CODE LIKE concat(#{areaCode}, '%')
</when>

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml

@ -171,6 +171,9 @@
AND u.grid_id = #{orgId}
</if>
</if>
<if test="customerId != null and customerId != ''">
AND u.CUSTOMER_ID = #{customerId}
</if>
ORDER BY
u.point_total DESC,convert(u.user_name using gbk) ASC
LIMIT #{topNum}
@ -212,6 +215,9 @@
AND u.grid_id = #{orgId}
</if>
</if>
<if test="customerId != null and customerId != ''">
AND u.CUSTOMER_ID = #{customerId}
</if>
ORDER BY
u.point_total DESC
LIMIT #{topNum}

57
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java

@ -1,18 +1,26 @@
package com.epmet.controller;
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.utils.Result;
import com.epmet.dto.AgencySubDeptTreeDto;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.service.StatsDimService;
import com.epmet.service.stats.*;
import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("dim")
public class DimController {
@ -272,4 +280,53 @@ public class DimController {
return new Result().ok(partyMemberService.statsPartyMember(customerIdAndDateIdFormDTO));
}
/**
* 同步客户相关的维度agency,department,grid
* 用来补充其他系统传递过来的旧有的数据
* @param customerId
* @return
*/
@PostMapping("/customer-related-dims/sync")
public Result syncCustomerRelatedDims(@RequestParam("customer-id") String customerId) {
if (StringUtils.isBlank(customerId)) {
String errorMsg = "【同步客户相关的维度】请传递客户ID";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg);
}
boolean syncAgencySuccess = true;
boolean syncGridSuccess = true;
boolean syncDepartmentSuccess = true;
// 一.同步agency
try {
statsDimService.syncCustomerAgencyDims(customerId);
} catch (Exception e) {
syncAgencySuccess = false;
log.error("【同步客户相关维度】同步agency失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
// 二.同步grid
try {
statsDimService.syncCustomerGridDims(customerId);
} catch (Exception e) {
syncGridSuccess = false;
log.error("【同步客户相关维度】同步grid失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
// 三.同步department
try {
statsDimService.syncCustomerDepartmentDims(customerId);
} catch (Exception e) {
syncDepartmentSuccess = false;
log.error("【同步客户相关维度】同步department失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
// 构造结果
HashMap<String, Boolean> r = new HashMap<>();
r.put("syncAgencySuccess", syncAgencySuccess);
r.put("syncGridSuccess", syncGridSuccess);
r.put("syncDepartmentSuccess", syncDepartmentSuccess);
return new Result().ok(r);
}
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java

@ -35,6 +35,7 @@ import java.util.List;
public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity> {
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(
@Param("customerId") String customerId,
@Param("createdTimeFrom") Date createdTimeFrom,
@Param("createdTimeTo") Date createdTimeTo);

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java

@ -49,7 +49,7 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @param end
* @return
*/
List<CustomerGridEntity> listGridsByCreateTime(@Param("start") Date start, @Param("end") Date end);
List<CustomerGridEntity> listGridsByCreateTime(@Param("customerId") String customerId, @Param("start") Date start, @Param("end") Date end);
/**
* @Description 查询机关下的网格总数

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -19,6 +19,7 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<CustomerAgencyEntity> listAllEntities();
List<CustomerAgencyEntity> listAgenciesByCreateTime(
@Param("customerId") String customerId,
@Param("statsStartTime") Date statsStartTime,
@Param("statsEndTime") Date statsEndTime);
List<AgencySubTreeDto> selectAllAgency();

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java

@ -12,4 +12,22 @@ public interface StatsDimService {
void initDepartmentDim();
void customerInitProjectCategory();
/**
* 同步客户的组织维度
* @param customerId
*/
void syncCustomerAgencyDims(String customerId);
/**
* 同步客户的网格维度
* @param customerId
*/
void syncCustomerGridDims(String customerId);
/**
* 同步客户的部门维度
* @param customerId
*/
void syncCustomerDepartmentDims(String customerId);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java

@ -83,7 +83,7 @@ public class EIDimServiceImpl implements EIDimService {
startTime = e.getCreatedTime();
}
return originCustomerAgencyService.listAgenciesByCreateTime(startTime, endTime);
return originCustomerAgencyService.listAgenciesByCreateTime(null, startTime, endTime);
}
@Override
@ -125,7 +125,7 @@ public class EIDimServiceImpl implements EIDimService {
startTime = lastAddDept.getCreatedTime();
}
return originCustomerDepartmentService.listDepartmentsByCreatedTime(startTime, endTime);
return originCustomerDepartmentService.listDepartmentsByCreatedTime(null, startTime, endTime);
}
@Override
@ -179,6 +179,6 @@ public class EIDimServiceImpl implements EIDimService {
startTime = lastAddGrid.getCreatedTime();
}
return customerGridService.listGridsByCreateTime(startTime, endTime);
return customerGridService.listGridsByCreateTime(null, startTime, endTime);
}
}

62
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.RobotConstant;
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO;
import com.epmet.entity.crm.CustomerEntity;
@ -78,10 +79,10 @@ public class StatsDimServiceImpl implements StatsDimService {
Date now = new Date();
if (lastDimEntity == null) {
// 首次初始化
grids = customerGridService.listGridsByCreateTime(null, now);
grids = customerGridService.listGridsByCreateTime(null, null, now);
} else {
Date lastInitTime = lastDimEntity.getCreatedTime();
grids = customerGridService.listGridsByCreateTime(lastInitTime, now);
grids = customerGridService.listGridsByCreateTime(null, lastInitTime, now);
}
return convertCustomerGrid2GridDim(grids, now);
@ -127,7 +128,7 @@ public class StatsDimServiceImpl implements StatsDimService {
* @param initTime 创建时间会用来作为下一次查询的输入条件因此必须和本次初始化查询的endTime一致
* @return
*/
private List<DimGridEntity> convertCustomerGrid2GridDim(List<CustomerGridEntity> grids, Date initTime) {
public List<DimGridEntity> convertCustomerGrid2GridDim(List<CustomerGridEntity> grids, Date initTime) {
return grids.stream().map(grid -> {
DimGridEntity dimGrid = new DimGridEntity();
dimGrid.setAgencyId(grid.getPid());
@ -168,7 +169,7 @@ public class StatsDimServiceImpl implements StatsDimService {
lastInitTime = latestCreatedAgencyDim.getCreatedTime();
}
return customerAgencyService.listAgenciesByCreateTime(lastInitTime, endDate);
return customerAgencyService.listAgenciesByCreateTime(null, lastInitTime, endDate);
}
/**
@ -268,7 +269,7 @@ public class StatsDimServiceImpl implements StatsDimService {
if (lastCreatedDeptDim != null) {
lastInitTime = lastCreatedDeptDim.getCreatedTime();
}
return departmentService.listDepartmentsByCreatedTime(lastInitTime, now);
return departmentService.listDepartmentsByCreatedTime(null, lastInitTime, now);
}
public List<CustomerDepartmentEntity> listUpdatedDepartments(Date initTime) {
@ -321,4 +322,55 @@ public class StatsDimServiceImpl implements StatsDimService {
}
return new ArrayList<>();
}
@Override
public void syncCustomerAgencyDims(String customerId) {
// 1.列出现有的agency 维度id列表
List<String> dimAgencyIds = dimAgencyService.listAgencyIds(customerId);
// 2.查询业务表的agency列表
Date endDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN);
List<CustomerAgencyEntity> bizAgencies = customerAgencyService.listAgenciesByCreateTime(customerId, null, endDate);
// 3.将没有同步过来的插入到dim表。创建和更新时间存为今天凌晨
for (CustomerAgencyEntity bizAgency : bizAgencies) {
if (!dimAgencyIds.contains(bizAgency.getId())) {
dimAgencyService.initAgencyAllDim(bizAgency, endDate);
dimAgencyService.initAgencySelfDim(bizAgency, endDate);
}
}
}
@Override
public void syncCustomerGridDims(String customerId) {
// 1.列出现有的grid维度id列表
List<String> dimGridIds = dimGridService.listGridIds(customerId);
// 2.查询业务表的grid列表
// 时间截止到今天凌晨,防止把今天的数据同步过来,影响定时任务查询,漏掉其他客户的数据
Date endDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN);
List<CustomerGridEntity> bizGrids = customerGridService.listGridsByCreateTime(customerId, null, endDate);
// 3.将没有同步过来的插入到dim表。创建和更新时间存为今天凌晨
List<CustomerGridEntity> grids2insert = bizGrids.stream().filter(bg -> !dimGridIds.contains(bg.getId())).collect(Collectors.toList());
List<DimGridEntity> dimGridEntities = convertCustomerGrid2GridDim(grids2insert, endDate);
dimGridEntities.forEach(g -> dimGridService.insert(g));
}
@Override
public void syncCustomerDepartmentDims(String customerId) {
// 1.列出现有的grid维度id列表
List<String> dimDeptIds = dimDepartmentService.listDepartmentIds(customerId);
// 2.查询业务表的grid列表
// 时间截止到今天凌晨,防止把今天的数据同步过来,影响定时任务查询,漏掉其他客户的数据
Date endDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN);
List<CustomerDepartmentEntity> bizDepts = departmentService.listDepartmentsByCreatedTime(customerId, null, endDate);
List<CustomerDepartmentEntity> depts2insert = bizDepts.stream().filter(bd -> !dimDeptIds.contains(bd.getId())).collect(Collectors.toList());
// 3.将没有同步过来的插入到dim表。创建和更新时间存为今天凌晨
dimDepartmentService.initDepartmentDims(depts2insert, new ArrayList<>(), endDate);
}
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -10,7 +10,7 @@ import java.util.Date;
import java.util.List;
public interface CustomerAgencyService {
List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime);
List<CustomerAgencyEntity> listAgenciesByCreateTime(String customerId, Date statsStartTime, Date statsEndTime);
List<CustomerAgencyEntity> listAgenciesByUpdatedTime(Date updatedTime, Date now);
@ -66,4 +66,11 @@ public interface CustomerAgencyService {
* @Description 批量查询客户组织基础信息
**/
List<CustomerAgencyDTO> getAgencyBaseInfo(GridBaseInfoFormDTO formDTO);
/**
* 列出agencyId列表
* @param customerId
* @return
*/
List<String> listAgencyIds(String customerId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java

@ -7,7 +7,7 @@ import java.util.List;
public interface CustomerDepartmentService {
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(String customerId, Date createdTimeFrom, Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(Date startTime, Date endTime);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java

@ -23,7 +23,7 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @return
* @Param("start") Date start, @Param("end") Date end
*/
List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end);
List<CustomerGridEntity> listGridsByCreateTime(String customerId, Date start, Date end);
/**
* @Description 查询机关下有多少网格

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.org.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@ -25,6 +26,7 @@ import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service
@DataSource(DataSourceConstant.GOV_ORG)
@ -40,8 +42,8 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
private CustomerGridService customerGridService;
@Override
public List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) {
return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime);
public List<CustomerAgencyEntity> listAgenciesByCreateTime(String customerId, Date statsStartTime, Date statsEndTime) {
return customerAgencyDao.listAgenciesByCreateTime(customerId, statsStartTime, statsEndTime);
}
@Override
@ -283,4 +285,15 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
return customerAgencyDao.getAgencyBaseInfo(formDTO);
}
@Override
public List<String> listAgencyIds(String customerId) {
LambdaQueryWrapper<CustomerAgencyEntity> query = new LambdaQueryWrapper<>();
query.eq(CustomerAgencyEntity::getCustomerId, customerId);
query.select(CustomerAgencyEntity::getId);
return customerAgencyDao.selectObjs(query)
.stream()
.map(o -> o.toString())
.collect(Collectors.toList());
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java

@ -25,8 +25,8 @@ public class CustomerDepartmentServiceImpl implements CustomerDepartmentService
* @return
*/
@Override
public List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) {
return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo);
public List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(String customerId, Date createdTimeFrom, Date createdTimeTo) {
return departmentDao.listDepartmentsByCreatedTime(customerId, createdTimeFrom, createdTimeTo);
}
@Override

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -34,8 +34,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
private IssueService issueService;
@Override
public List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end) {
return baseDao.listGridsByCreateTime(start, end);
public List<CustomerGridEntity> listGridsByCreateTime(String customerId, Date start, Date end) {
return baseDao.listGridsByCreateTime(customerId, start, end);
}
/**

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java

@ -187,4 +187,25 @@ public interface DimAgencyService extends BaseService<DimAgencyEntity> {
* @return java.util.List<com.epmet.dto.stats.DimAgencyDTO>
*/
List<DimAgencyDTO> getAgencyByLevel(String customerId, String level);
/**
* 查询agency维度已存在的id列表
* @param customerId
* @return
*/
List<String> listAgencyIds(String customerId);
/**
* 初始化agency all 维度(all区分于self)
* @param agency
* @param initTime
*/
void initAgencyAllDim(CustomerAgencyEntity agency, Date initTime);
/**
* 初始化agency self 维度(self区分于all)
* @param agency
* @param initTime
*/
void initAgencySelfDim(CustomerAgencyEntity agency, Date initTime);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java

@ -120,4 +120,11 @@ public interface DimDepartmentService extends BaseService<DimDepartmentEntity> {
*/
List<DimDepartmentDTO> getDistrictDepByCustomer(String customerId);
/**
* 查询部门维度id列表
* @param customerId
* @return
*/
List<String> listDepartmentIds(String customerId);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java

@ -148,4 +148,12 @@ public interface DimGridService extends BaseService<DimGridEntity> {
* @date 2020.09.20 13:01
**/
List<GridAttributesResultDTO> getGridAttributes(String customerId,List<String> gridIds);
/**
* 查询网格维度ID列表
* @param customerId
* @return
*/
List<String> listGridIds(String customerId);
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
@ -47,6 +48,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 机关维度
@ -158,6 +160,7 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_AGENCY);
}
@Override
public void initAgencyAllDim(CustomerAgencyEntity agency, Date initTime) {
DimAgencyEntity dimAgencyEntity = new DimAgencyEntity();
dimAgencyEntity.setCode(agency.getCode());
@ -180,6 +183,7 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
* 初始化机关单位本身的维度(不包含本身)
* @param agency
*/
@Override
public void initAgencySelfDim(CustomerAgencyEntity agency, Date initTime) {
DimAgencyEntity dimAgencyEntity = new DimAgencyEntity();
dimAgencyEntity.setAgencyName(agency.getOrganizationName());
@ -293,4 +297,12 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
return baseDao.selectDimAgencyByLevel(customerId, level);
}
@Override
public List<String> listAgencyIds(String customerId) {
LambdaQueryWrapper<DimAgencyEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DimAgencyEntity::getCustomerId, customerId);
queryWrapper.select(DimAgencyEntity::getId);
return baseDao.selectObjs(queryWrapper).stream().map(o -> o.toString()).collect(Collectors.toList());
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
@ -43,6 +44,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 客户部门维度
@ -169,4 +171,13 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
public List<DimDepartmentDTO> getDistrictDepByCustomer(String customerId) {
return baseDao.getDistrictDepByCustomer(customerId);
}
@Override
public List<String> listDepartmentIds(String customerId) {
LambdaQueryWrapper<DimDepartmentEntity> query = new LambdaQueryWrapper<>();
query.eq(DimDepartmentEntity::getCustomerId, customerId);
query.select(DimDepartmentEntity::getId);
return baseDao.selectObjs(query).stream().map(d -> d.toString()).collect(Collectors.toList());
}
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 客户网格维度
@ -193,4 +195,14 @@ public class DimGridServiceImpl extends BaseServiceImpl<DimGridDao, DimGridEntit
return baseDao.selectGridAttributes(customerId,gridIds);
}
@Override
public List<String> listGridIds(String customerId) {
LambdaQueryWrapper<DimGridEntity> query = new LambdaQueryWrapper<>();
query.eq(DimGridEntity::getCustomerId, customerId);
query.select(DimGridEntity::getId);
return baseDao.selectObjs(query).stream().map(o -> o.toString()).collect(Collectors.toList());
}
}

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml

@ -13,6 +13,9 @@
dept.AGENCY_ID = ca.id and ca.DEL_FLAG='0')
<where>
dept.DEL_FLAG = 0
<if test="customerId != null and customerId != ''">
AND dept.CUSTOMER_ID = #{customerId}
</if>
<if test="createdTimeFrom != null">
AND dept.CREATED_TIME >= #{createdTimeFrom}
</if>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -10,6 +10,9 @@
<where>
DEL_FLAG = 0
AND SYNC_FLAG='1'
<if test="customerId != null and customerId != ''">
AND CUSTOMER_ID = #{customerId}
</if>
<if test="start != null">
AND CREATED_TIME >= #{start}
</if>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -17,6 +17,9 @@
<where>
DEL_FLAG = 0
AND SYNC_FLAG='1'
<if test="customerId != null and customerId !=''">
AND CUSTOMER_ID = #{customerId}
</if>
<if test="statsStartTime != null">
AND CREATED_TIME >= #{statsStartTime}
</if>

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java

@ -92,9 +92,7 @@ public class BuildingController {
//效验数据
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.AddShowGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
buildingService.AddBuilding(customerId,formDTO);
buildingService.addBuilding(customerId,formDTO);
return new Result().ok("保存成功");
}
@ -105,7 +103,7 @@ public class BuildingController {
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.UpdateShowGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
buildingService.UpdateBuilding(customerId,formDTO);
buildingService.updateBuilding(customerId,formDTO);
return new Result().ok("修改成功");
}
@ -114,7 +112,7 @@ public class BuildingController {
//效验数据
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.DeleteGroup.class);
String buildingId = formDTO.getBuildingId();
buildingService.DelBuilding(buildingId);
buildingService.delBuilding(buildingId);
return new Result();
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -32,7 +32,6 @@ import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.excel.IcHouseExcel;
import com.epmet.service.HouseService;
import com.epmet.service.NeighborHoodService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -56,10 +55,6 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("house")
public class HouseController {
@Autowired
private NeighborHoodService neighborHoodService;
@Autowired
private HouseService houseService;
@ -151,10 +146,9 @@ public class HouseController {
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcHouseExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
log.warn("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
//return new Result().error(8001,failList.get(0).getErrorMsg());
}
List<IcHouseExcel> result =importResult.getList();
@ -173,4 +167,4 @@ public class HouseController {
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds){
return new Result<List<HouseInfoDTO>>().ok(houseService.queryListHouseInfo(houseIds));
}
}
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java

@ -60,7 +60,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("neighborhood")
public class NeighborHoodController {
@Autowired
private IcNeighborHoodService icNeighborHoodService;
@Autowired
@ -210,7 +210,7 @@ public class NeighborHoodController {
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcNeighborHoodExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
log.warn("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
//return new Result().error(8001,failList.get(0).getErrorMsg());
@ -231,4 +231,4 @@ public class NeighborHoodController {
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java

@ -40,16 +40,16 @@ public interface BuildingService {
void UpdateBuilding(String customerId, IcBulidingFormDTO formDTO);
void updateBuilding(String customerId, IcBulidingFormDTO formDTO);
/**
* 删除小区
* @param buildingId
*/
void DelBuilding(String buildingId);
void delBuilding(String buildingId);
void AddBuilding(String customerId, IcBulidingFormDTO formDTO);
void addBuilding(String customerId, IcBulidingFormDTO formDTO);
List<BuildingTreeLevelDTO> treeList(String customerId);
@ -62,4 +62,4 @@ public interface BuildingService {
List<BuildingResultDTO> buildingListByIds(List<String> buildingIdList);
BuildingResultPagedDTO buildinglistbyidsPage(List<String> buildingIdList, Integer pageNo, Integer pageSize);
}
}

48
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

@ -1,9 +1,11 @@
package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
@ -70,7 +72,7 @@ public class BuildingServiceImpl implements BuildingService {
@Override
@Transactional(rollbackFor = Exception.class)
public void AddBuilding(String customerId, IcBulidingFormDTO formDTO) {
public void addBuilding(String customerId, IcBulidingFormDTO formDTO) {
//同一小区下不能存在楼栋名字一样的
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),null);
if (null != count && count > 0) {
@ -152,8 +154,11 @@ public class BuildingServiceImpl implements BuildingService {
//3.获取网格下的所有小区
List<String> gridIdList = customerGridList.stream().map(a->a.getId()).collect(Collectors.toList());
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getGridId, gridIdList));
List<String> gridIdList = customerGridList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
LambdaQueryWrapper<IcNeighborHoodEntity> queryWrapper = new QueryWrapper<IcNeighborHoodEntity>().lambda()
.in(IcNeighborHoodEntity::getGridId, gridIdList)
.orderByAsc(IcNeighborHoodEntity::getCreatedTime);
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(queryWrapper);
if(CollectionUtils.isEmpty(icNeighborHoodList)){
agencyList.addAll(gridList);
return covertToTree(customerAgency,agencyList);
@ -171,8 +176,11 @@ public class BuildingServiceImpl implements BuildingService {
}).collect(Collectors.toList());
//3.获取小区下的所有楼宇
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(a->a.getId()).collect(Collectors.toList());
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList));
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
LambdaQueryWrapper<IcBuildingEntity> buildingQueryWrapper = new QueryWrapper<IcBuildingEntity>().lambda()
.in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList)
.orderByAsc(IcBuildingEntity::getCreatedTime,IcBuildingEntity::getBuildingName);
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(buildingQueryWrapper);
if(CollectionUtils.isEmpty(neighborHoodIdList)){
agencyList.addAll(gridList);
@ -193,14 +201,6 @@ public class BuildingServiceImpl implements BuildingService {
return buildingTreeLevelDTO;
}).collect(Collectors.toList());
//组织
// gridList.stream()
// Map<String, List<BuildingTreeLevelDTO>> gridMap = gridList.stream().collect(Collectors.groupingBy(e -> e.getPId()));
// List<BuildingTreeLevelDTO> allList = agencyList.addAll(gridList)
agencyList.addAll(gridList);
agencyList.addAll(neighbourHoodList);
agencyList.addAll(buildingList);
@ -365,25 +365,9 @@ public class BuildingServiceImpl implements BuildingService {
private IPage<Map<String, Object>> searchBuilding(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcBuildingEntity> page = new Page<IcBuildingEntity>(formDTO.getPageNo(),formDTO.getPageSize());
// IcNeighborHoodEntity neighbor = new IcNeighborHoodEntity();
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
building.setDelFlag("0");
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
//
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// buildingEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
IPage<Map<String, Object>> mapIPage = icBuildingDao.searchBuildingByPage(page, building, house);
List<Map<String, Object>> records = mapIPage.getRecords();
@ -428,7 +412,7 @@ public class BuildingServiceImpl implements BuildingService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void UpdateBuilding(String customerId, IcBulidingFormDTO formDTO) {
public void updateBuilding(String customerId, IcBulidingFormDTO formDTO) {
//同一小区下不能存在楼栋名字一样的
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),formDTO.getBuildingId());
if (null != count && count > 0) {
@ -484,7 +468,7 @@ public class BuildingServiceImpl implements BuildingService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void DelBuilding(String buildingId) {
public void delBuilding(String buildingId) {
//如果存在房屋,无法删除
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, buildingId));
if(!CollectionUtils.isEmpty(icHouseEntities)){

27
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -201,9 +201,7 @@ public class HouseServiceImpl implements HouseService {
//3.保存
icHouseService.insertBatch(houseEntityList);
/*if(!"".equals(str)){
return new Result().error(9999, str.append("不存在").toString());
}*/
return numList;
}
@ -252,28 +250,6 @@ public class HouseServiceImpl implements HouseService {
private IPage<Map<String, Object>> searchHouse(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcHouseEntity> page = new Page<IcHouseEntity>(formDTO.getPageNo(),formDTO.getPageSize());
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
// QueryWrapper<IcHouseEntity> houseEntityQueryWrapper = new QueryWrapper<>();
// houseEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getOwnerName()),IcHouseEntity::getOwnerName,formDTO.getOwnerName())
// .like(!StringUtils.isEmpty(formDTO.getOwnerPhone()),IcHouseEntity::getOwnerPhone,formDTO.getOwnerPhone());
// houseEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0");
@ -281,7 +257,6 @@ public class HouseServiceImpl implements HouseService {
List<Map<String, Object>> records = mapIPage.getRecords();
records.forEach(item->{
item.put("houseType", HouseTypeEnums.getTypeValue(item.get("houseTypeKey")));
// item.put("rentFlag", HouseRentFlagEnums.getTypeValue(item.get("rentFlagKey") ));
item.put("purpose", HousePurposeEnums.getTypeValue(item.get("purposeKey")));
});
return mapIPage;

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java

@ -133,14 +133,6 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
IPage<IcNeighborHoodEntity> page = new Page<IcNeighborHoodEntity>(formDTO.getPageNo(),formDTO.getPageSize());
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
// neighborHoodEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
neighbor.setDelFlag("0");

72
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -323,22 +323,8 @@
agency.ORGANIZATION_NAME AS agencyName,
agency.LEVEL AS level,
agency.CUSTOMER_ID as customerId,
( CASE WHEN agency.longitude is null THEN
( SELECT longitude FROM customer_agency
WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = agency.id)
ORDER BY pid ASC LIMIT 1
)
ELSE agency.longitude
END
) longitude,
( CASE WHEN agency.latitude is null THEN
( SELECT latitude FROM customer_agency
WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = agency.id)
ORDER BY pid ASC LIMIT 1
)
ELSE agency.latitude
END
) latitude
agency.longitude,
agency.latitude
FROM
CUSTOMER_AGENCY agency
WHERE
@ -363,22 +349,8 @@
cg.id AS gridId,
cg.GRID_NAME AS gridName,
cg.CUSTOMER_ID AS customerId,
( CASE WHEN ca.longitude is null THEN
( SELECT longitude FROM customer_agency
WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id)
ORDER BY pid ASC LIMIT 1
)
ELSE ca.longitude
END
) longitude,
( CASE WHEN ca.latitude is null THEN
( SELECT latitude FROM customer_agency
WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id)
ORDER BY pid ASC LIMIT 1
)
ELSE ca.latitude
END
) latitude
ca.longitude,
ca.latitude
FROM
customer_grid cg
INNER JOIN customer_agency ca ON cg.PID = ca.ID
@ -393,22 +365,8 @@
agency.ORGANIZATION_NAME AS agencyName,
agency.LEVEL AS level,
agency.CUSTOMER_ID as customerId,
( CASE WHEN agency.longitude is null THEN
( SELECT longitude FROM customer_agency
WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = agency.id)
ORDER BY pid ASC LIMIT 1
)
ELSE agency.longitude
END
) longitude,
( CASE WHEN agency.latitude is null THEN
( SELECT latitude FROM customer_agency
WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = agency.id)
ORDER BY pid ASC LIMIT 1
)
ELSE agency.latitude
END
) latitude
agency.longitude,
agency.latitude
FROM
CUSTOMER_AGENCY agency
WHERE
@ -423,22 +381,8 @@
ca.pids pids,
ca.pid pid,
ca.level level,
( CASE WHEN ca.longitude is null THEN
( SELECT longitude FROM customer_agency
WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id)
ORDER BY pid ASC LIMIT 1
)
ELSE ca.longitude
END
) longitude,
( CASE WHEN ca.latitude is null THEN
( SELECT latitude FROM customer_agency
WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id)
ORDER BY pid ASC LIMIT 1
)
ELSE ca.latitude
END
) latitude
ca.longitude,
ca.latitude
FROM
customer_agency ca
INNER JOIN customer_staff_agency csa ON ca.id = csa.agency_id

116
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -94,7 +94,7 @@
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
order by a.CREATED_TIME asc
order by a.CREATED_TIME, a.BUILDING_NAME
</select>
<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select
@ -138,117 +138,6 @@
</select>
<!--<select id="searchBuildingByPage" resultType="map">
select
a.ID as buildingId,
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighborHoodName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND b.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND b.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND b.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND b.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
<where>
<if test="building.id != null and building.id.trim() != ''">
AND a.ID = #{building.id}
</if>
<if test="building.buildingName != null and building.buildingName.trim() != ''">
AND a.BUILDING_NAME like concat('%',trim(#{building.buildingName}),'%')
</if>
<if test="building.delFlag != null and building.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>-->
<!--<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
b.NEIGHBOR_HOOD_NAME as neighborHoodName,
f.ORGANIZATION_NAME as agencyName,
g.GRID_NAME as gridName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
and b.ID in (
select c.id from ic_neighbor_hood c
INNER JOIN customer_agency d on c.AGENCY_ID = d.ID
INNER JOIN customer_grid e on c.GRID_ID = e.ID
${ew.customSqlSegment}
)
LEFT JOIN customer_agency f on b.AGENCY_ID = f.ID
LEFT JOIN customer_grid g on b.GRID_ID = g.ID
${ew1.customSqlSegment}
</select>-->
<!--<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select
a.ID as buildingId,
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighborHoodName,
c.ORGANIZATION_NAME as agencyName,
d.GRID_NAME as gridName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
LEFT JOIN customer_agency c on b.AGENCY_ID = c.ID
LEFT JOIN customer_grid c on b.GRID_ID = d.ID
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND b.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND b.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND b.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND b.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
<where>
<if test="building.id != null and building.id.trim() != ''">
AND a.ID = #{building.id}
</if>
<if test="building.buildingName != null and building.buildingName.trim() != ''">
AND a.BUILDING_NAME like concat('%',trim(#{building.buildingName}),'%')
</if>
<if test="building.delFlag != null and building.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>-->
<select id="selectAgencyChildrenList" resultType="com.epmet.entity.CustomerAgencyEntity">
SELECT
@ -330,7 +219,6 @@
#{val}
</foreach>
order by gridName,neighborHoodName,buildingName
</select>
</mapper>
</mapper>

1
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -144,6 +144,7 @@
</if>
</where>
ORDER BY CAST(d.UNIT_NUM AS SIGNED), a.DOOR_NAME
</select>
<select id="searchAllHouse" resultType="com.epmet.excel.IcHouseExcel">
select

3
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml

@ -106,6 +106,7 @@
AND a.DEL_FLAG = #{neighbor.delFlag}
</if>
</where>
ORDER BY a.CREATED_TIME
</select>
<select id="searchAllNeighborhood" resultType="com.epmet.excel.IcNeighborHoodExcel">
select
@ -213,4 +214,4 @@
and a.id !=#{neighborId}
</if>
</select>
</mapper>
</mapper>

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java

@ -34,7 +34,7 @@ public class ResiEventFormDTO implements Serializable {
/**
* 事件内容最多1000
*/
@Length(min = 1, max = 1000, message = "请填写内容,最多输入1000字", groups = AddUserShowGroup.class)
@Length(max = 1000, message = "请填写内容,最多输入1000字", groups = AddUserShowGroup.class)
private String eventContent;
/**

24
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -45,4 +46,27 @@ public class EventListResultDTO implements Serializable {
*/
private List<String> eventImgs;
/**
* 语音附件url集合
*/
private List<String> voiceList;
/**
* 事件附件
*/
@JsonIgnore
private List<Attachment> attachmentList;
@Data
public static class Attachment {
/**
* url
*/
private String url;
/**
* 附件类型
*/
private String type;
}
}

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/NewEventsResultDTO.java

@ -40,7 +40,7 @@ public class NewEventsResultDTO implements Serializable {
* 事件附件
*/
@JsonIgnore
private List<EventDetailResultDTO.Attachment> attachmentList;
private List<Attachment> attachmentList;
@Data
public static class Attachment {

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ResiEventListResultDTO.java

@ -69,7 +69,7 @@ public class ResiEventListResultDTO implements Serializable {
* 事件附件
*/
@JsonIgnore
private List<EventDetailResultDTO.Attachment> attachmentList;
private List<Attachment> attachmentList;
@Data
public static class Attachment {

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UserMentionResultDTO.java

@ -68,7 +68,7 @@ public class UserMentionResultDTO implements Serializable {
* 事件附件
*/
@JsonIgnore
private List<EventDetailResultDTO.Attachment> attachmentList;
private List<Attachment> attachmentList;
@Data
public static class Attachment {

112
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

@ -125,6 +125,20 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize());
List<EventListResultDTO> result = baseDao.eventUnDisposedList(formDTO.getOrgId(), formDTO.getEventType());
if (!CollectionUtils.isEmpty(result)){
//附件按类型分组【图片、语音】
result.forEach(re->{
List<String> eventImgs = new ArrayList<>();
List<String> voiceList = new ArrayList<>();
re.getAttachmentList().forEach(file->{
if ("image".equals(file.getType())) {
eventImgs.add(file.getUrl());
} else if ("voice".equals(file.getType())) {
voiceList.add(file.getUrl());
}
});
re.setEventImgs(eventImgs);
re.setVoiceList(voiceList);
});
return result;
}
return new ArrayList<>();
@ -322,7 +336,50 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
});
//5-2.插入语音附件
if(!org.apache.commons.collections4.CollectionUtils.isEmpty(formDTO.getVoiceList())) {
eventVoiceAttachment(formDTO.getCustomerId(), resiEventEntity.getId(), formDTO.getVoiceList());
//语音附件处理【创建阿里安全审核任务】
//5-2-1.语音附件存入表中
List<VoiceTaskDTO> voiceDTOList = new ArrayList<>();
int sort = 1;//原本下标从0开始 图片的用了1就保持一致从1开始
for (FileCommonDTO file : formDTO.getVoiceList()) {
ResiEventAttachmentEntity entity = new ResiEventAttachmentEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setResiEventId(resiEventEntity.getId());
entity.setAttachmentName(file.getName());
entity.setAttachmentFormat(file.getFormat());
entity.setAttachmentType(file.getType());
entity.setAttachmentUrl(file.getUrl());
entity.setSort(sort);
entity.setStatus(TopicConstant.AUDITING);
sort++;
resiEventAttachmentDao.insert(entity);
VoiceTaskDTO task = new VoiceTaskDTO();
task.setDataId(entity.getId());
task.setUrl(file.getUrl());
voiceDTOList.add(task);
}
//5-2-2.语音创建审核任务【定时任务会处理待审核语音后修改数据库数据】
VoiceScanParamDTO voiceScanParamDTO = new VoiceScanParamDTO();
voiceScanParamDTO.setTasks(voiceDTOList);
voiceScanParamDTO.setOpenCallBack(false);
Result<AsyncScanResult> voiceScanResult = ScanContentUtils.voiceAsyncScan(scanApiUrl.concat(voiceAsyncScanMethod), voiceScanParamDTO);
if (!voiceScanResult.success() || !voiceScanResult.getData().isAllSuccess()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
List<AsyncScanTaskDTO> taskList = voiceScanResult.getData().getSuccessTasks();
//提交记录存入task表
List<ResiEventScanTaskEntity> scanTaskEntityList = taskList.stream().map(item -> {
ResiEventScanTaskEntity taskEntity = new ResiEventScanTaskEntity();
taskEntity.setCustomerId(formDTO.getCustomerId());
taskEntity.setResiEventId(resiEventEntity.getId());
taskEntity.setResiEventAttachmentId(item.getDataId());
taskEntity.setTaskId(item.getTaskId());
taskEntity.setStatus(TopicConstant.AUDITING);
taskEntity.setAttachmentType(TopicConstant.VOICE);
return taskEntity;
}).collect(Collectors.toList());
resiEventScanTaskService.insertBatch(scanTaskEntityList);
}
}
//6、插入组织表
List<ResiEventReportOrgEntity> orgEntityList=getOrgList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getOrgList());
@ -401,62 +458,13 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
entity.setAttachmentType(img.getType());
entity.setAttachmentUrl(img.getUrl());
entity.setSort(sort);
entity.setStatus(TopicConstant.AUTO_PASSED);
sort++;
list.add(entity);
}
return list;
}
/**
* @Author sun
* @Description 事件-语音附件处理创建审核任务
**/
private void eventVoiceAttachment(String customerId, String resiEventId, List<FileCommonDTO> voiceList) {
//1.语音附件存入表中
List<VoiceTaskDTO> voiceDTOList = new ArrayList<>();
int sort = 0;
for (FileCommonDTO file : voiceList) {
ResiEventAttachmentEntity entity = new ResiEventAttachmentEntity();
entity.setCustomerId(customerId);
entity.setResiEventId(resiEventId);
entity.setAttachmentName(file.getName());
entity.setAttachmentFormat(file.getFormat());
entity.setAttachmentType(file.getType());
entity.setAttachmentUrl(file.getUrl());
entity.setSort(sort);
sort++;
resiEventAttachmentDao.insert(entity);
VoiceTaskDTO task = new VoiceTaskDTO();
task.setDataId(entity.getId());
task.setUrl(file.getUrl());
voiceDTOList.add(task);
}
//2.语音创建审核任务【定时任务会处理待审核语音后修改数据库数据】
VoiceScanParamDTO voiceScanParamDTO = new VoiceScanParamDTO();
voiceScanParamDTO.setTasks(voiceDTOList);
voiceScanParamDTO.setOpenCallBack(false);
Result<AsyncScanResult> voiceScanResult = ScanContentUtils.voiceAsyncScan(scanApiUrl.concat(voiceAsyncScanMethod), voiceScanParamDTO);
if (!voiceScanResult.success() || !voiceScanResult.getData().isAllSuccess()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
List<AsyncScanTaskDTO> taskList = voiceScanResult.getData().getSuccessTasks();
List<String> taskIds = taskList.stream().map(AsyncScanTaskDTO::getTaskId).collect(Collectors.toList());
//提交记录存入task表
List<ResiEventScanTaskEntity> scanTaskEntityList = taskList.stream().map(item -> {
ResiEventScanTaskEntity taskEntity = new ResiEventScanTaskEntity();
taskEntity.setCustomerId(customerId);
taskEntity.setResiEventId(resiEventId);
taskEntity.setResiEventAttachmentId(item.getDataId());
taskEntity.setTaskId(item.getTaskId());
taskEntity.setStatus(TopicConstant.AUDITING);
taskEntity.setAttachmentType(TopicConstant.VOICE);
return taskEntity;
}).collect(Collectors.toList());
resiEventScanTaskService.insertBatch(scanTaskEntityList);
}
}
private void scanContent(String eventContent, List<FileCommonDTO> attachmentList) {
//事件内容
if (StringUtils.isNotBlank(eventContent)) {
@ -1017,7 +1025,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
//草稿状态更新为auto_passed
ResiEventEntity draftEntity = new ResiEventEntity();
draftEntity.setId(draftId);
draftEntity.setAuditStatus(EventConstant.REVIEW);
draftEntity.setAuditStatus(EventConstant.AUTO_PASSED);
baseDao.updateById(draftEntity);
}
});

2
epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml

@ -122,6 +122,8 @@ openapi:
method:
imgSyncScan: /imgSyncScan
textSyncScan: /textSyncScan
voiceAsyncScan: /voiceAsyncScan
voiceResults: /voiceResults
#pageHelper分页插件
pagehelper:

26
epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.17__event_scan.sql

@ -0,0 +1,26 @@
ALTER TABLE `resi_event`
ADD COLUMN `AUDIT_STATUS` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'auto_passed' COMMENT '事件审核状态[涉及附件审核需要加的状态](审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)' AFTER `UPDATED_TIME`,
ADD COLUMN `AUDIT_REASON` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核理由' AFTER `AUDIT_STATUS`;
CREATE TABLE `resi_event_scan_task` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`RESI_EVENT_ID` varchar(64) NOT NULL COMMENT '事件Id,关联resi_event的id',
`RESI_EVENT_ATTACHMENT_ID` varchar(64) NOT NULL COMMENT '事件附件表主键,对应dataId',
`TASK_ID` varchar(64) NOT NULL COMMENT '阿里云审核任务Id',
`STATUS` varchar(32) NOT NULL COMMENT '审核状态【auditing: 审核中;\r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;】',
`ATTACHMENT_TYPE` varchar(64) NOT NULL COMMENT '附件类型(视频 - video、 语音 - voice 文件 - doc)',
`DEL_FLAG` char(1) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '操作人,API审核结果,存储为SCAN_USER或者APP_USER',
`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='事件附件安全校验任务表';
ALTER TABLE `resi_event_attachment`
ADD COLUMN `STATUS` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'auto_passed' COMMENT '附件状态(审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)\r\n现在图片是同步审核的,所以图片只有auto_passed一种状态' AFTER `UPDATED_TIME`,
ADD COLUMN `REASON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '失败原因' AFTER `STATUS`;

83
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml

@ -10,46 +10,51 @@
<result property="eventTime" column="eventTime"/>
<result property="isProject" column="isProject"/>
<result property="redDot" column="redDot"/>
<collection property="eventImgs" ofType="java.lang.String">
<result column="img"/>
<collection property="attachmentList" ofType="com.epmet.dto.result.EventListResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
</resultMap>
<select id="eventUnDisposedList" resultMap="eventUnDisposedListMap">
SELECT rea.ATTACHMENT_URL AS img,t.* FROM
(SELECT
re.EVENT_CONTENT AS eventContent,
<if test='eventType == "undisposed" '>
IFNULL(DATE_FORMAT(re.CREATED_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
<if test='eventType == "processed" '>
IFNULL(DATE_FORMAT(re.LATEST_OPERATED_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
<if test='eventType == "transferred" '>
IFNULL(DATE_FORMAT(re.CLOSE_CASE_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
re.ID AS eventId,
(CASE WHEN re.SHIFT_PROJECT = 1 THEN TRUE ELSE FALSE END) AS isProject,
(CASE WHEN ro.RED_DOT = 1 THEN TRUE ELSE FALSE END) AS redDot
FROM resi_event_report_org ro
INNER JOIN resi_event re ON (ro.RESI_EVENT_ID = re.ID AND re.DEL_FLAG = '0' AND re.audit_status = 'auto_passed')
AND ro.DEL_FLAG = '0'
and ro.ORG_ID = #{orgId}
<if test='eventType == "undisposed" '>
AND ro.ORG_READ = 'un_read'
</if>
<if test='eventType == "processed" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'processing'
</if>
<if test='eventType == "transferred" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'closed_case'
</if>
SELECT
rea.id AS resiEventAttachmentId,
rea.ATTACHMENT_URL AS url,
rea.ATTACHMENT_TYPE AS type,
t.*
FROM
(
SELECT
re.EVENT_CONTENT AS eventContent,
<if test='eventType == "undisposed" '>
IFNULL(DATE_FORMAT(re.CREATED_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
<if test='eventType == "processed" '>
IFNULL(DATE_FORMAT(re.LATEST_OPERATED_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
<if test='eventType == "transferred" '>
IFNULL(DATE_FORMAT(re.CLOSE_CASE_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
re.ID AS eventId,
(CASE WHEN re.SHIFT_PROJECT = 1 THEN TRUE ELSE FALSE END) AS isProject,
(CASE WHEN ro.RED_DOT = 1 THEN TRUE ELSE FALSE END) AS redDot
FROM resi_event_report_org ro
INNER JOIN resi_event re ON (ro.RESI_EVENT_ID = re.ID AND re.DEL_FLAG = '0' AND re.audit_status = 'auto_passed')
AND ro.DEL_FLAG = '0'
AND ro.ORG_ID = #{orgId}
<if test='eventType == "undisposed" '>
AND ro.ORG_READ = 'un_read'
</if>
<if test='eventType == "processed" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'processing'
</if>
<if test='eventType == "transferred" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'closed_case'
</if>
)t
LEFT JOIN resi_event_attachment rea
ON (rea.RESI_EVENT_ID = t.eventId
and rea.DEL_FLAG = '0'
AND rea.ATTACHMENT_TYPE = 'image')
LEFT JOIN resi_event_attachment rea ON (rea.resi_event_id = t.eventId AND rea.del_flag = '0' AND rea.attachment_type = 'image')
<if test='eventType == "undisposed" '>
ORDER BY t.eventTime,rea.sort asc
</if>
@ -126,6 +131,7 @@
<result column="eventImg"/>
</collection>-->
<collection property="attachmentList" ofType="com.epmet.dto.result.EventDetailResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
@ -146,6 +152,7 @@
(CASE WHEN re.READ_FLAG = 1 THEN FALSE ELSE TRUE END) AS isRollback,
(CASE WHEN re.SHIFT_PROJECT = 1 THEN TRUE ELSE FALSE END) AS isProject,
IFNULL(re.project_id,'') AS projectId,
ea.id AS resiEventAttachmentId,
ea.ATTACHMENT_URL AS url,
ea.ATTACHMENT_TYPE AS type,
IF(ISNULL(em.USER_SHOW_NAME),NULL,concat('人大代表-',em.USER_SHOW_NAME)) AS person,
@ -186,6 +193,7 @@
<result property="eventTime" column="eventTime"/>
<result property="eventId" column="eventId"/>
<collection property="attachmentList" ofType="com.epmet.dto.result.NewEventsResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
@ -197,6 +205,7 @@
SELECT
IFNULL(re.EVENT_CONTENT,'') AS eventContent,
DATE_FORMAT(re.CREATED_TIME,'%Y-%m-%d %H:%i') AS eventTime,
ea.id AS resiEventAttachmentId,
ea.attachment_url AS url,
ea.attachment_type AS type,
re.id as eventId
@ -240,6 +249,7 @@
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<collection property="attachmentList" ofType="com.epmet.dto.result.ResiEventListResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
@ -257,6 +267,7 @@
re.`status`,
re.shift_project,
re.latest_operated_time,
rea.id AS resiEventAttachmentId,
rea.attachment_url AS url,
rea.attachment_type AS type,
re.read_flag,

2
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml

@ -11,6 +11,7 @@
<result property="shiftProject" column="SHIFT_PROJECT" />
<result property="showTime" column="LATEST_OPERATED_TIME" />
<collection property="attachmentList" ofType="com.epmet.dto.result.UserMentionResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
@ -33,6 +34,7 @@
re.`STATUS`,
re.SHIFT_PROJECT,
re.LATEST_OPERATED_TIME,
rea.id AS resiEventAttachmentId,
rea.attachment_url AS url,
rea.attachment_type AS type
FROM

Loading…
Cancel
Save