diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java
new file mode 100644
index 0000000000..767f03bc07
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.commons.tools.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+
+/**
+ * epmet-user端调用gov-org端的入参
+ * @author sun
+ */
+@Data
+public class CustomerGridFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ /**
+ * 网格Id
+ */
+ @NotBlank(message = "网格ID不能为空", groups = {Grid.class})
+ private String gridId;
+
+ public interface Grid{}
+
+}
\ No newline at end of file
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java
new file mode 100644
index 0000000000..bb6bfe423b
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java
@@ -0,0 +1,29 @@
+package com.epmet.commons.tools.feign;
+
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
+import com.epmet.commons.tools.feign.fallback.CommonGovOrgFeignClientFallBackFactory;
+import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
+import com.epmet.commons.tools.utils.Result;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @Author zxc
+ * @DateTime 2022/3/17 1:42 下午
+ * @DESC
+ */
+@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = CommonGovOrgFeignClientFallBackFactory.class)
+public interface CommonGovOrgFeignClient {
+
+ /**
+ * @Description 查询网格信息
+ * @param customerGridFormDTO
+ * @author zxc
+ * @date 2021/11/5 2:54 下午
+ */
+ @PostMapping("/gov/org/grid/getbaseinfo")
+ Result getGridInfo(@RequestBody CustomerGridFormDTO customerGridFormDTO);
+
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java
new file mode 100644
index 0000000000..8cde59e6e1
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java
@@ -0,0 +1,24 @@
+package com.epmet.commons.tools.feign.fallback;
+
+import com.epmet.commons.tools.exception.ExceptionUtils;
+import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
+import feign.hystrix.FallbackFactory;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author zxc
+ * @DateTime 2022/3/17 1:46 下午
+ * @DESC
+ */
+@Slf4j
+@Component
+public class CommonGovOrgFeignClientFallBackFactory implements FallbackFactory {
+ private CommonGovOrgFeignClientFallback fallback = new CommonGovOrgFeignClientFallback();
+ @Override
+ public CommonGovOrgFeignClient 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/feign/fallback/CommonGovOrgFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallback.java
new file mode 100644
index 0000000000..c54567c350
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallback.java
@@ -0,0 +1,26 @@
+package com.epmet.commons.tools.feign.fallback;
+
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
+import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
+import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
+import com.epmet.commons.tools.utils.ModuleUtils;
+import com.epmet.commons.tools.utils.Result;
+import org.springframework.stereotype.Component;
+
+/**
+ * 调用政府端权限
+ * @Author wxz
+ * @Description
+ * @Date 2020/4/24 11:17
+ **/
+@Component
+public class CommonGovOrgFeignClientFallback implements CommonGovOrgFeignClient {
+
+ @Override
+ public Result getGridInfo(CustomerGridFormDTO customerGridFormDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfo", customerGridFormDTO);
+ }
+
+
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
index 4e3daf80bc..7cb132b0f5 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
@@ -1,8 +1,11 @@
package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
+import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
@@ -31,6 +34,8 @@ public class CustomerOrgRedis {
@Autowired
private CommonAggFeignClient commonAggFeignClient;
+ @Autowired
+ private CommonGovOrgFeignClient govOrgFeignClient;
private static CustomerOrgRedis customerOrgRedis;
@@ -40,6 +45,7 @@ public class CustomerOrgRedis {
customerOrgRedis = this;
customerOrgRedis.redisUtils = this.redisUtils;
customerOrgRedis.commonAggFeignClient = this.commonAggFeignClient;
+ customerOrgRedis.govOrgFeignClient = this.govOrgFeignClient;
}
/**
@@ -51,10 +57,13 @@ public class CustomerOrgRedis {
public static GridInfoCache getGridInfo(String gridId){
String key = RedisKeys.getGridInfoKey(gridId);
Map grid = customerOrgRedis.redisUtils.hGetAll(key);
+ log.info("grid is {}", JSON.toJSONString(grid));
if (!CollectionUtils.isEmpty(grid)) {
return ConvertUtils.mapToEntity(grid, GridInfoCache.class);
}
- Result gridInfoResult = customerOrgRedis.commonAggFeignClient.getGridInfo(gridId);
+ CustomerGridFormDTO formDTO = new CustomerGridFormDTO();
+ formDTO.setGridId(gridId);
+ Result gridInfoResult = customerOrgRedis.govOrgFeignClient.getGridInfo(formDTO);
if (!gridInfoResult.success()){
throw new RenException("查询网格信息失败...");
}
@@ -62,8 +71,10 @@ public class CustomerOrgRedis {
//throw new RenException("没有此网格信息...");
return null;
}
+ // feign 方法中已经放缓存
+ /*log.info("select grid info is {}", JSON.toJSONString(gridInfoResult.getData()));
Map map = BeanUtil.beanToMap(gridInfoResult.getData(), false, true);
- customerOrgRedis.redisUtils.hMSet(key, map);
+ customerOrgRedis.redisUtils.hMSet(key, map);*/
return gridInfoResult.getData();
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
index adc659eae6..0625e55ce5 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
@@ -174,8 +174,8 @@
cg.*
FROM customer_grid cg
LEFT JOIN customer_agency ca ON (ca.ID = cg.PID AND ca.DEL_FLAG = '0')
- WHERE cg.DEL_FLAG = '0'
- AND cg.ID = #{gridId}
+ WHERE cg.ID = #{gridId}
+ AND cg.DEL_FLAG = '0'
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java
index b792e6ea15..3e318c72d4 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java
@@ -20,7 +20,6 @@ package com.epmet.dto.org;
import lombok.Data;
import java.io.Serializable;
-import java.util.Date;
/**
@@ -46,6 +45,7 @@ public class CustomerStaffGridDTO implements Serializable {
* 网格ID
*/
private String gridId;
+ private String gridName;
/**
* 上级组织ID
*/
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java
index 752bb721cd..9c2d142132 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java
@@ -131,4 +131,9 @@ public class CustomerGridDTO implements Serializable {
* 所有上级组织名
*/
private String allParentName;
+
+ /**
+ * 弃用标记
+ */
+ private Integer abandonFlag;
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
index 84cb0c6964..b84b8bc30b 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
@@ -41,6 +41,7 @@ import com.epmet.entity.stats.DimAgencyEntity;
import com.epmet.entity.stats.DimCustomerEntity;
import com.epmet.entity.stats.DimDateEntity;
import com.epmet.entity.stats.DimMonthEntity;
+import com.epmet.service.HistoryDataService;
import com.epmet.service.StatsDemoService;
import com.epmet.service.StatsPartyMemberVanguardService;
import com.epmet.service.evaluationindex.extract.dataToIndex.*;
@@ -60,6 +61,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -139,6 +141,8 @@ public class DemoController {
private DimCustomerService dimCustomerService;
@Autowired
private ScreenProjectDataService screenProjectDataService;
+ @Resource
+ private HistoryDataService historyDataService;
@GetMapping("testAlarm")
public void testAlarm() {
@@ -1139,4 +1143,11 @@ public class DemoController {
long l = (end - start) / 1000;
return new Result().ok("gridAndOrgDaily耗时" + l+ "s");
}
+
+
+ @PostMapping("projectHistoryData")
+ public Result projectHistoryData(@RequestBody ExtractOriginFormDTO formDTO) {
+ historyDataService.projectAddGridId(formDTO.getCustomerId());
+ return new Result();
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
index 7d1c6903ab..66d2d286f9 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
@@ -23,6 +23,7 @@ import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.extract.result.TransferRightRatioResultDTO;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
+import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.pingyin.result.*;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.form.ProjectSourceMapFormDTO;
@@ -550,4 +551,13 @@ public interface FactOriginProjectMainDailyDao extends BaseDao getMemberProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId);
+ /**
+ * 更新历史数据
+ * @Param dto
+ * @Return
+ * @Author zhaoqifeng
+ * @Date 2022/3/16 9:48
+ */
+ void updateHistoryData(CustomerStaffGridDTO dto);
+
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
index bf82610651..db2b42ba5b 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
@@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
+import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.result.DataCheckDTO;
import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO;
@@ -122,4 +123,13 @@ public interface ScreenProjectDataDao extends BaseDao {
* @Date 2022/3/7 16:00
*/
List getCheckResult(ExtractOriginFormDTO formDTO);
+
+ /**
+ * 更新历史数据
+ * @Param list
+ * @Return
+ * @Author zhaoqifeng
+ * @Date 2022/3/16 9:48
+ */
+ void updateHistoryData(CustomerStaffGridDTO dto);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
index e154508f30..5930a90611 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
@@ -19,6 +19,7 @@ package com.epmet.dao.project;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ProjectDTO;
+import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.project.*;
import com.epmet.dto.project.result.ProjectExceedParamsResultDTO;
import com.epmet.entity.project.ProjectEntity;
@@ -204,4 +205,13 @@ public interface ProjectDao extends BaseDao {
* @return
*/
List getEventList(@Param("customerId") String customerId, @Param("projectId") String projectId);
+
+ /**
+ * 更新历史数据
+ * @Param dto
+ * @Return
+ * @Author zhaoqifeng
+ * @Date 2022/3/16 9:48
+ */
+ void updateHistoryData(CustomerStaffGridDTO dto);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/HistoryDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/HistoryDataService.java
new file mode 100644
index 0000000000..f2ac7a321d
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/HistoryDataService.java
@@ -0,0 +1,19 @@
+package com.epmet.service;
+
+/**
+ * @Description
+ * @Author zhaoqifeng
+ * @Date 2022/3/15 10:09
+ */
+public interface HistoryDataService {
+ /**
+ * 网格员立项来源改为work_event
+ *
+ * @Param customerId
+ * @Return
+ * @Author zhaoqifeng
+ * @Date 2022/3/15 10:13
+ */
+ void projectAddGridId(String customerId);
+
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
index 6e1268f727..965b6536db 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
@@ -23,6 +23,7 @@ import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.extract.result.TransferRightRatioResultDTO;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
+import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.pingyin.result.*;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.form.ProjectSourceMapFormDTO;
@@ -490,4 +491,13 @@ public interface FactOriginProjectMainDailyService extends BaseService>
*/
Map> getMemberProjectCount(String customerId, String dateId, Integer type);
+
+ /**
+ * 更新项目表历史数据
+ * @Param dto
+ * @Return
+ * @Author zhaoqifeng
+ * @Date 2022/3/16 9:46
+ */
+ void updateHistoryData(CustomerStaffGridDTO dto);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
index a307aaf171..d0ee740780 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
@@ -31,6 +31,7 @@ import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.extract.result.TransferRightRatioResultDTO;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
+import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.pingyin.result.*;
import com.epmet.dto.result.CostDayResultDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
@@ -44,6 +45,7 @@ import lombok.extern.slf4j.Slf4j;
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 org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
@@ -734,5 +736,19 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl staffGridList = customerGridService.getCustomerStaffGridList(customerId);
+ List staffInfoList = userService.getStaffByRoleKey(customerId, RoleKeyConstants.ROLE_KEY_GRID_MEMBER);
+ if (CollectionUtils.isEmpty(staffGridList) || CollectionUtils.isEmpty(staffInfoList)) {
+ return;
+ }
+ Map staffMap = staffInfoList.stream().collect(Collectors.toMap(StaffRoleInfoDTO :: getStaffId,
+ Function.identity()));
+ List list = staffGridList.stream().filter(p -> null != staffMap.get(p.getStaffId())).map(item -> {
+ StaffRoleInfoDTO staffInfo = staffMap.get(item.getStaffId());
+ CustomerStaffGridDTO dto = ConvertUtils.sourceToTarget(item, CustomerStaffGridDTO.class);
+ dto.setStaffId(staffInfo.getStaffId());
+ return dto;
+ }).collect(Collectors.toList());
+
+ list.forEach(part -> {
+ //更新project表
+ projectService.updateHistoryData(part);
+ //更新fact_origin_project_main_daily
+ factOriginProjectMainDailyService.updateHistoryData(part);
+ //更新screen_project_data
+ screenProjectDataService.updateHistoryData(part);
+ });
+
+ }
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
index 23367bfa06..bd8584c7c1 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
@@ -20,6 +20,7 @@ package com.epmet.service.project;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.ProjectCategoryDTO;
import com.epmet.dto.ProjectDTO;
+import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.project.ProjectAgencyDTO;
import com.epmet.dto.project.ProjectGridDTO;
import com.epmet.dto.project.ResiEventDTO;
@@ -204,4 +205,13 @@ public interface ProjectService extends BaseService {
* @return
*/
Map getEventList(String customerId, String projectId);
+
+ /**
+ * 更新项目表历史数据
+ * @Param dto
+ * @Return
+ * @Author zhaoqifeng
+ * @Date 2022/3/16 9:46
+ */
+ void updateHistoryData(CustomerStaffGridDTO dto);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
index 9b409ce75f..75cd4ff714 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
@@ -23,6 +23,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.project.ProjectDao;
import com.epmet.dto.ProjectDTO;
+import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.project.*;
import com.epmet.dto.project.result.ProjectExceedParamsResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
@@ -31,6 +32,7 @@ import com.epmet.service.project.ProjectService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
@@ -263,5 +265,19 @@ public class ProjectServiceImpl extends BaseServiceImpl
+
+
+ UPDATE
+ fact_origin_project_main_daily
+ SET
+ ORIGIN = 'work_event',
+ ORIGIN_ID = #{gridId},
+ GRID_ID = #{gridId}
+ WHERE
+ PROJECT_CREATOR = #{staffId}
+ AND CUSTOMER_ID = #{customerId}
+ AND AGENCY_ID = #{agencyId}
+ AND ORIGIN = 'agency'
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml
index 95c907ce97..51f9a0fcb6 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml
@@ -458,4 +458,19 @@
AGENCY_ID,
DATE_ID DESC
+
+
+ UPDATE
+ screen_project_data
+ SET
+ ORIGIN = 'work_event',
+ ORG_TYPE = 'grid',
+ ORG_ID = #{gridId},
+ ORG_NAME = #{gridName}
+ WHERE
+ PROJECT_CREATOR = #{staffId}
+ AND CUSTOMER_ID = #{customerId}
+ AND ORG_ID = #{agencyId}
+ AND ORIGIN = 'agency'
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
index 830dbbfdf9..7ab6ca322c 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
@@ -121,6 +121,7 @@
ca.PID,
cg.PIDS,
csg.GRID_ID,
+ cg.GRID_NAME,
csg.USER_ID AS staffId
FROM
customer_staff_grid csg
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
index 7b92a7b440..f309d79bf4 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
@@ -268,4 +268,16 @@
and rero.CUSTOMER_ID = #{customerId}
+
+ UPDATE
+ project
+ SET
+ ORIGIN = 'work_event',
+ ORIGIN_ID = #{gridId}
+ WHERE
+ CREATED_BY = #{staffId}
+ AND CUSTOMER_ID = #{customerId}
+ AND AGENCY_ID = #{agencyId}
+ AND ORIGIN = 'agency'
+
diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
index 1a3f20439a..25cf270549 100644
--- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
+++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
@@ -84,4 +84,12 @@ public interface EpmetHeartOpenFeignClient {
*/
@PostMapping("/heart/resi/volunteer/count")
Result getVolunteerCount(@RequestBody VolunteerCommonFormDTO input);
+
+ /**
+ * 修改志愿者的注册网格
+ * @param volunteerInfoDTO
+ * @return
+ */
+ @PostMapping("/heart/resi/volunteer/modifyVolunteerGrid")
+ Result modifyVolunteerGrid(@RequestBody VolunteerInfoDTO volunteerInfoDTO);
}
diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
index aab5bdb70d..06bdc642c9 100644
--- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
+++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
@@ -77,4 +77,15 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli
public Result getVolunteerCount(VolunteerCommonFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getVolunteerCount", input);
}
+
+ /**
+ * 修改志愿者的注册网格
+ *
+ * @param volunteerInfoDTO
+ * @return
+ */
+ @Override
+ public Result modifyVolunteerGrid(VolunteerInfoDTO volunteerInfoDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "modifyVolunteerGrid", volunteerInfoDTO);
+ }
}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
index 39da0690af..410cbdf981 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
@@ -159,4 +159,15 @@ public class ResiVolunteerController {
Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId, agencyId);
return new Result().ok(volunteerCount);
}
+
+ /**
+ * 修改志愿者注册信息_的网格信息
+ * @param volunteerInfoDTO
+ * @return
+ */
+ @PostMapping("modifyVolunteerGrid")
+ public Result modifyVolunteerGrid(@RequestBody VolunteerInfoDTO volunteerInfoDTO){
+ volunteerInfoService.modifyVolunteerGrid(volunteerInfoDTO);
+ return new Result();
+ }
}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java
index ab0b65bf9c..2aa3afa166 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java
@@ -74,4 +74,11 @@ public interface VolunteerInfoDao extends BaseDao {
* @date 2020.08.13 10:06
**/
List selectVolunteerIds(@Param("customerId")String customerId);
+
+ /**
+ * 修改志愿者注册信息_网格信息
+ * @param volunteerInfoDTO
+ * @return
+ */
+ int updateVolunteerGrid(VolunteerInfoDTO volunteerInfoDTO);
}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
index f9db916bbe..7cd4d30769 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
@@ -111,4 +111,10 @@ public interface VolunteerInfoService extends BaseService {
* @return
*/
Integer getVolunteerCount(String customerId, String agencyId);
+
+ /**
+ * 修改志愿者注册信息_的网格信息
+ * @param volunteerInfoDTO
+ */
+ void modifyVolunteerGrid(VolunteerInfoDTO volunteerInfoDTO);
}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
index ef5df1e3fe..0b5ee36509 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
@@ -420,4 +420,14 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl
+
+
+ UPDATE volunteer_info
+ SET GRID_ID = #{gridId},
+ GRID_NAME = #{gridName},
+ PID = #{pid},
+ PIDS = #{pids},
+ UPDATED_TIME = NOW()
+ WHERE
+ del_flag = '0'
+ AND customer_id = #{customerId}
+ AND user_id = #{userId}
+
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java
index 78fecfca6d..0acd914fa6 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java
@@ -154,5 +154,5 @@ public class CustomerGridDTO implements Serializable {
/**
* 弃用:1;正常使用:0
*/
- private Boolean abandonFlag;
+ private Integer abandonFlag;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AbandonGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AbandonGridFormDTO.java
index 1d1aca23e1..85f8d7fd34 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AbandonGridFormDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AbandonGridFormDTO.java
@@ -11,4 +11,5 @@ import java.io.Serializable;
public class AbandonGridFormDTO implements Serializable {
@NotBlank(message = "网格id不能为空",groups = AddGroup.class)
private String gridId;
+ private String userId;
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
index 0c1470d26f..8f026e9f44 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
@@ -235,21 +235,11 @@ public class GridController {
*/
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_DELETE)
@PostMapping("abandon")
- public Result abandonGrid(@RequestBody AbandonGridFormDTO formDTO){
+ public Result abandonGrid(@LoginUser TokenDto tokenDto,@RequestBody AbandonGridFormDTO formDTO){
+ formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
customerGridService.abandonGrid(formDTO);
return new Result();
}
- /**
- * desc:移除网格内的工作人员关系 并迁移到组织
- * @author jianjun liu
- * @remark: 如果是网格添加的则解除关系后将注册关系改为对应的组织 如果不是则直接解除关系(相当于移除该人员与网格的关系)
- */
- @PostMapping("removeGridStaff2Agency/{gridId}")
- //@RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_TRANSFER)
- public Result removeGridStaff2Agency( @PathVariable String gridId){
- customerGridService.abandonGridForDealBizData(gridId);
- return new Result();
- }
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java
index 379d916654..70f73c89da 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java
@@ -113,5 +113,5 @@ public class CustomerGridEntity extends BaseEpmetEntity {
/**
* 弃用:1;正常使用:0
*/
- private Boolean abandonFlag;
+ private Integer abandonFlag;
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
index 504555fbc7..c3ba7c1286 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
@@ -384,7 +384,7 @@ public interface CustomerGridService extends BaseService {
/**
* desc:移除网格内的工作人员关系 并迁移到组织
- * @param gridId
+ * @param formDTO
*/
- void abandonGridForDealBizData(String gridId);
+ void abandonGridForDealBizData(AbandonGridFormDTO formDTO);
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
index 87b3c6163e..c337f989e3 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
@@ -40,6 +40,7 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
+import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerGridConstant;
@@ -98,6 +99,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl updateGrid=new LambdaUpdateWrapper<>();
- updateGrid.set(CustomerGridEntity::getAbandonFlag,true);
- updateGrid.eq(CustomerGridEntity::getId,formDTO.getGridId());
- baseDao.update(null,updateGrid);
+ //可以弃用、处理数据(网格工作人员所属关系(网格工作人员人数), 删除正在审核中的徽章认证)
+ this.abandonGridForDealBizData(formDTO);
CustomerOrgRedis.delGridInfo(formDTO.getGridId());
}
@Override
- public void abandonGridForDealBizData(String gridId) {
+ public void abandonGridForDealBizData(AbandonGridFormDTO formDTO) {
try {
//根据网格id 获取网格内工作人员及其添加关系
- List staffList = customerStaffGridDao.getGridStaffList(gridId);
- if (CollectionUtils.isEmpty(staffList)){
- log.info("abandonGridForDealBizData gridId:{} have any staff", gridId);
- return;
+ List staffList = customerStaffGridDao.getGridStaffList(formDTO.getGridId());
+ if (staffList == null){
+ staffList = new ArrayList<>();
}
logger.debug("abandonGridForDealBizData staffList:{}", JSON.toJSONString(staffList));
List updateList = new ArrayList<>();
staffList.forEach(staffOrg->{
- if(OrgTypeEnum.GRID.getCode().equals(staffOrg.getOrgType())){
- StaffOrgRelationEntity entity = new StaffOrgRelationEntity();
- entity.setId(staffOrg.getId());
- entity.setOrgType(OrgTypeEnum.AGENCY.getCode());
- GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(staffOrg.getOrgId());
- if (gridInfo == null || StringUtils.isBlank(gridInfo.getPid())){
- log.error("abandonGridForDealBizData agencyId:{} is not exist",gridInfo.getPid());
- return;
- }
- entity.setOrgId(gridInfo.getPid());
- updateList.add(entity);
+ //只有工作人员是网格添加的才处理
+ if(!OrgTypeEnum.GRID.getCode().equals(staffOrg.getOrgType())) {
+ return;
+ }
+ StaffOrgRelationEntity entity = new StaffOrgRelationEntity();
+ entity.setId(staffOrg.getId());
+ entity.setOrgType(OrgTypeEnum.AGENCY.getCode());
+ GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(staffOrg.getOrgId());
+ if (gridInfo == null || StringUtils.isBlank(gridInfo.getPid())) {
+ assert gridInfo != null;
+ log.error("abandonGridForDealBizData grid:{} pid is not exist", JSON.toJSONString(gridInfo));
+ return;
}
+ entity.setOrgId(gridInfo.getPid());
+ updateList.add(entity);
});
+ String customerId = loginUserUtil.getLoginUserCustomerId();
//更新工作人员组织关系
- String customerId = staffList.get(NumConstant.ZERO).getCustomerId();
- updateGridStaff2Agency(customerId,gridId, staffList, updateList);
+ dealBizDataForAbandon(customerId,formDTO.getGridId(),formDTO.getUserId(), staffList, updateList);
//清空工作人员缓存
staffList.forEach(staff->CustomerStaffRedis.delStaffInfoFormCache(customerId,staff.getStaffId()));
+
} catch (Exception e) {
log.error("abandonGridForDealBizData exception", e);
throw e;
@@ -1039,7 +1028,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl staffList, List updateList) {
+ public void dealBizDataForAbandon(String customerId, String gridId, String userId,List staffList, List updateList) {
//1.删除工作人员与网格的关系
LambdaQueryWrapper updateWrapper = new LambdaQueryWrapper<>();
updateWrapper.eq(CustomerStaffGridEntity::getGridId,gridId);
@@ -1050,12 +1039,21 @@ public class CustomerGridServiceImpl extends BaseServiceImpl badgeResult = epmetUserFeignClient.deleteBadgeCertificateAuditing(customerId,gridId);
if (badgeResult == null || !badgeResult.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"删除未审核徽章失败,请稍后重试");
}
+
+ //处理成功,隐藏网格
+ LambdaUpdateWrapper updateGrid=new LambdaUpdateWrapper<>();
+ updateGrid.set(CustomerGridEntity::getAbandonFlag,NumConstant.ONE);
+ updateGrid.set(CustomerGridEntity::getUpdatedBy,userId);
+ updateGrid.set(CustomerGridEntity::getUpdatedTime,new Date());
+ updateGrid.eq(CustomerGridEntity::getId,gridId);
+ baseDao.update(null,updateGrid);
}
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.13__abandon_grid.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.13__abandon_grid.sql
index 1822215609..37fbf05faa 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.13__abandon_grid.sql
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.13__abandon_grid.sql
@@ -1,3 +1,3 @@
alter table customer_grid
-add column ABANDON_FLAG TINYINT(1) default '0'
+add column ABANDON_FLAG TINYINT(1) NOT NULL default '0'
comment '弃用:1;正常使用:0' after SYNC_FLAG;
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
index 4690b1f384..426b4fbb0a 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
@@ -766,7 +766,8 @@
cg.mobile,
IFNULL(cg.longitude,ca.longitude) longitude,
- IFNULL(cg.latitude,ca.latitude) latitude
+ IFNULL(cg.latitude,ca.latitude) latitude,
+ cg.ABANDON_FLAG
FROM
customer_grid cg
INNER JOIN customer_agency ca ON ca.pid = '0' AND ca.customer_id = cg.customer_id
diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoConcernDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoConcernDTO.java
index 7ccc04ee24..eb1a825736 100644
--- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoConcernDTO.java
+++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoConcernDTO.java
@@ -61,13 +61,13 @@ public class MemoConcernDTO implements Serializable {
private String content;
/**
- * 计划执行时间
+ * 预计关怀时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date scheduledTime;
/**
- * 实际执行时间
+ * 实际执行时间(预留字段)
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date actualTime;
diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoDifficultyDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoDifficultyDTO.java
index 90b9505e75..0f1e94e071 100644
--- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoDifficultyDTO.java
+++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoDifficultyDTO.java
@@ -45,7 +45,7 @@ public class MemoDifficultyDTO implements Serializable {
private String remark;
/**
- * 计划执行时间
+ * 预计处理时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date scheduledTime;
diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/AddMemoDifficultyFromDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/AddMemoDifficultyFromDTO.java
index dda956c0b6..3fe64af31d 100644
--- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/AddMemoDifficultyFromDTO.java
+++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/AddMemoDifficultyFromDTO.java
@@ -5,7 +5,6 @@ import com.epmet.dto.MemoAttachmentDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
-import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@@ -34,21 +33,23 @@ public class AddMemoDifficultyFromDTO implements Serializable {
* 内容
*/
@NotBlank(message = "难点堵点内容不能为空", groups = { AddMemoDifficulty.class })
- @Length(max = 500, message = "难点堵点内容最长为50个字", groups = { AddMemoDifficulty.class })
+ @Length(max = 500, message = "难点堵点内容最多为50个字", groups = { AddMemoDifficulty.class })
private String content;
/**
* 解决方式
*/
+ @Length(max = 500, message = "解决方式最多为500个字", groups = { AddMemoDifficulty.class })
private String resolveWay;
/**
* 备注
*/
+ @Length(max = 200, message = "备注最多为200个字", groups = { AddMemoDifficulty.class })
private String remark;
/**
- * 计划执行时间
+ * 预计处理时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date scheduledTime;
diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/MemoDifficultyController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/MemoDifficultyController.java
index 07fca9ad3c..def6d05162 100644
--- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/MemoDifficultyController.java
+++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/MemoDifficultyController.java
@@ -92,6 +92,7 @@ public class MemoDifficultyController {
@PostMapping("detail")
public Result detail(@RequestBody MemoDifficultyDetailFromDTO fromDTO){
+ ValidatorUtils.validateEntity(fromDTO, MemoDifficultyDetailFromDTO.Detail.class);
return new Result().ok(memoDifficultyService.detail(fromDTO));
}
diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoConcernEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoConcernEntity.java
index 59a2770876..dce8dc6672 100644
--- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoConcernEntity.java
+++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoConcernEntity.java
@@ -51,12 +51,12 @@ public class MemoConcernEntity extends BaseEpmetEntity {
private String content;
/**
- * 计划执行时间
+ * 预计关怀时间
*/
private Date scheduledTime;
/**
- * 实际执行时间
+ * 实际执行时间(预留字段)
*/
private Date actualTime;
diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoDifficultyEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoDifficultyEntity.java
index 32d6263849..e73a444598 100644
--- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoDifficultyEntity.java
+++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoDifficultyEntity.java
@@ -41,7 +41,7 @@ public class MemoDifficultyEntity extends BaseEpmetEntity {
private String remark;
/**
- * 计划执行时间
+ * 预计处理时间
*/
private Date scheduledTime;
diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.21__create_memo_table.sql b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.21__create_memo_table.sql
new file mode 100644
index 0000000000..e719505e40
--- /dev/null
+++ b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.21__create_memo_table.sql
@@ -0,0 +1,86 @@
+CREATE TABLE `memo_attachment` (
+ `ID` varchar(64) NOT NULL COMMENT '主键',
+ `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
+ `REMIND_MSG_ID` varchar(64) NOT NULL COMMENT 'REMIND_MSG.ID 业务(工作日志、难点堵点、人员关怀)表Id',
+ `FILE_NAME` varchar(255) DEFAULT NULL COMMENT '文件名',
+ `ATTACHMENT_NAME` varchar(64) DEFAULT NULL COMMENT '附件名(uuid随机生成)',
+ `ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小,单位b',
+ `ATTACHMENT_FORMAT` varchar(64) NOT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)',
+ `ATTACHMENT_TYPE` varchar(64) NOT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))',
+ `ATTACHMENT_URL` varchar(255) NOT NULL COMMENT '附件地址',
+ `DURATION` int(11) DEFAULT '0' COMMENT '语音或视频时长,秒',
+ `SORT` int(1) NOT NULL COMMENT '排序字段',
+ `DEL_FLAG` varchar(1) 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`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='备忘录-附件表';
+
+CREATE TABLE `memo_attr` (
+ `ID` varchar(32) NOT NULL COMMENT '唯一标识',
+ `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
+ `REMIND_TIME` datetime DEFAULT NULL COMMENT '提醒时间',
+ `TYPE` varchar(32) NOT NULL COMMENT '业务类型 人员关怀:concern;难点堵点:difficulty;工作日志:work_diary',
+ `READ_FLAG` tinyint(1) NOT NULL DEFAULT '0' COMMENT '阅读标记1 已读;0未读',
+ `RECEIVER` varchar(32) NOT NULL COMMENT '接收人ID',
+ `DEL_FLAG` char(1) 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`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='备忘录-属性(通知)表';
+
+CREATE TABLE `memo_concern` (
+ `ID` varchar(32) NOT NULL COMMENT '唯一标识(同memo_attr表Id)',
+ `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID',
+ `CONCERN_TYPE` varchar(64) DEFAULT NULL COMMENT '关怀类型',
+ `RESI_NAME` varchar(64) NOT NULL COMMENT '关怀人员',
+ `PHONE` varchar(64) DEFAULT NULL COMMENT '关怀对象电话',
+ `ADDRESS` varchar(64) DEFAULT NULL COMMENT '关怀对象地址',
+ `CONTENT` varchar(1024) NOT NULL COMMENT '关怀事项',
+ `SCHEDULED_TIME` datetime DEFAULT NULL COMMENT '预计关怀时间',
+ `ACTUAL_TIME` datetime DEFAULT NULL COMMENT '实际执行时间(预留字段)',
+ `STATUS` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态 0未完成 1已完成',
+ `DEL_FLAG` char(1) 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`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='备忘录-人文关怀';
+
+CREATE TABLE `memo_difficulty` (
+ `ID` varchar(32) NOT NULL COMMENT '唯一标识(同memo_attr表Id)',
+ `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID',
+ `CONTENT` varchar(1024) NOT NULL COMMENT '内容',
+ `RESOLVE_WAY` varchar(512) DEFAULT NULL COMMENT '解决方式',
+ `REMARK` varchar(255) DEFAULT NULL COMMENT '备注',
+ `SCHEDULED_TIME` datetime DEFAULT NULL COMMENT '预计处理时间',
+ `DEL_FLAG` char(1) 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`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='备忘录-难点读点';
+
+CREATE TABLE `memo_work_diary` (
+ `ID` varchar(32) NOT NULL COMMENT '唯一标识(同memo_attr表Id)',
+ `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
+ `CONTENT` varchar(1024) NOT NULL COMMENT '内容',
+ `WORK_TYPE` varchar(64) DEFAULT NULL COMMENT '工作事项',
+ `DEL_FLAG` char(1) 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`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='备忘录-工作日志';
\ No newline at end of file
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java
index 7c0989aa64..928489f8b0 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java
@@ -83,6 +83,7 @@ public class OpenDataOrgChangeEventListener implements MessageListenerConcurrent
dto.setType(obj.getType());
List orgIdList = new ArrayList<>();
orgIdList.add(obj.getOrgId());
+ dto.setOrgIdList(orgIdList);
if ("agency".equals(obj.getOrgType())) {
SpringContextUtils.getBean(ExDeptService.class).getAgencyBaseInfo(dto);
} else {
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java
index 96f0301bb7..ad7bd79b62 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java
@@ -85,6 +85,7 @@ public class OpenDataStaffChangeEventListener implements MessageListenerConcurre
dto.setType(obj.getType());
List staffIdList = new ArrayList<>();
staffIdList.add(obj.getOrgId());
+ dto.setStaffIdList(staffIdList);
SpringContextUtils.getBean(ExUserService.class).getStaffBaseInfo(dto);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
index c32e1809d6..064b6c9219 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
@@ -85,7 +85,7 @@ public class UserPatrolRecordServiceImpl extends BaseServiceImpl{
UserPatrolRecordEntity recordEntity = buildEntity(o);
- //update
- int effectRow = baseDao.updateById(recordEntity);
- if (effectRow == NumConstant.ZERO) {
- baseDao.insert(recordEntity);
- }
+ this.saveOrUpdate(recordEntity);
UserPatrolDetailEntity detailEntity = buildDetailEntity(o);
- //先删除再新增
- userPatrolDetailService.deleteByPatrolId(recordEntity.getId());
- boolean insert = userPatrolDetailService.insert(detailEntity);
+ userPatrolDetailService.saveOrUpdate(detailEntity);
});
return true;
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml
index 0d7af2fa2b..0de6a47003 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml
@@ -10,7 +10,7 @@
- when qx_dept_name = #{item.qxDeptName} then #{item.qxDeptId}
+ when dept_name = #{item.qxDeptName} then #{item.qxDeptId}
@@ -18,7 +18,7 @@
- when qx_dept_name = #{item.qxDeptName} then #{item.qxDeptId}
+ when dept_name = #{item.qxDeptName} then #{item.qxDeptName}
@@ -26,7 +26,7 @@
- when qx_dept_name = #{item.qxDeptName} then #{item.qxDeptCode}
+ when dept_name = #{item.qxDeptName} then #{item.qxDeptCode}
@@ -34,7 +34,7 @@
- when qx_dept_name = #{item.qxDeptName} then #{item.qxCustomerId}
+ when dept_name = #{item.qxDeptName} then #{item.qxCustomerId}
@@ -43,7 +43,7 @@
WHERE
1=1
- qx_dept_name = #{item.qxDeptName}
+ dept_name = #{item.qxDeptName}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExUserDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExUserDao.xml
index 3d904577fd..c56d93b581 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExUserDao.xml
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExUserDao.xml
@@ -7,10 +7,18 @@
UPDATE ex_user
+
+
+
+ when (login_name = #{item.qxMobile} ) then #{item.qxUserId}
+
+
+
+
- when (qx_user_id = #{item.qxUserId} ) then #{item.qxUserName}
+ when (login_name = #{item.qxMobile} ) then #{item.qxUserName}
@@ -18,7 +26,7 @@
- when (qx_user_id = #{item.qxUserId} ) then #{item.qxMobile}
+ when (login_name = #{item.qxMobile} ) then #{item.qxMobile}
@@ -26,7 +34,7 @@
- when (qx_user_id = #{item.qxUserId} ) then #{item.qxCustomerId}
+ when (login_name = #{item.qxMobile} ) then #{item.qxCustomerId}
@@ -34,7 +42,7 @@
WHERE 1=1
- (qx_user_id = #{item.qxUserId} )
+ (login_name = #{item.qxMobile} )
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java
index 3a881b52d8..3afb6df67e 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java
@@ -81,6 +81,7 @@ public class IcFormItemServiceImpl extends BaseServiceImpl());
+ categoryName.setWidth(120);
list.add(categoryName);
TableHeaderResultDTO houseType=new TableHeaderResultDTO();
@@ -88,6 +89,7 @@ public class IcFormItemServiceImpl extends BaseServiceImpl());
list.add(houseType);
return list;
diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java
index 42920ff788..94c19dfdfe 100644
--- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java
+++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java
@@ -2,6 +2,7 @@ package com.epmet.controller;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
+import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@@ -29,6 +30,7 @@ public class UserGuideController {
@Autowired
private UserAccessService userAccessService;
+ @NoRepeatSubmit
@PostMapping("entergrid")
Result enterGrid(@LoginUser TokenDto token, @RequestBody UserEnterGridFormDTO userEnterGridFormDTO){
logger.info("进网格TokenDto:"+ JSON.toJSON(token));
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ModifyRegGridFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ModifyRegGridFormDTO.java
new file mode 100644
index 0000000000..b54c57ca09
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ModifyRegGridFormDTO.java
@@ -0,0 +1,26 @@
+package com.epmet.dto.form;
+
+import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+
+@Data
+public class ModifyRegGridFormDTO implements Serializable {
+ public interface AddUserInternalGroup {
+ }
+
+ public interface AddUserShowGroup extends CustomerClientShowGroup {
+ }
+
+ @NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class)
+ private String userId;
+ @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
+ private String customerId;
+
+ @NotBlank(message = "请选择您所在的网格", groups = AddUserShowGroup.class)
+ private String gridId;
+
+}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
index 5d5870439e..3f8b17f323 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
@@ -210,4 +210,20 @@ public class UserController {
ValidatorUtils.validateEntity(findIcUserFormDTO,FindIcUserFormDTO.AddUserInternalGroup.class);
return new Result().ok(userService.findIcUser(findIcUserFormDTO));
}
+
+ /**
+ * 居民端-修改注册网格
+ * @param tokenDto
+ * @param formDTO
+ * @return
+ */
+ @PostMapping(value = "modify-reg-grid")
+ public Result modifyRegGrid(@LoginUser TokenDto tokenDto,@RequestBody ModifyRegGridFormDTO formDTO){
+ formDTO.setUserId(tokenDto.getUserId());
+ formDTO.setCustomerId(tokenDto.getCustomerId());
+ ValidatorUtils.validateEntity(formDTO,ModifyRegGridFormDTO.AddUserShowGroup.class,
+ ModifyRegGridFormDTO.AddUserInternalGroup.class);
+ userService.modifyRegGrid(formDTO);
+ return new Result();
+ }
}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java
index 132ef019a7..5ee692c7de 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java
@@ -121,4 +121,10 @@ public interface UserService extends BaseService {
* @return
*/
EpmetUserFamilyDTO findIcUser(FindIcUserFormDTO findIcUserFormDTO);
+
+ /**
+ * 居民端-修改注册网格
+ * @param formDTO
+ */
+ void modifyRegGrid(ModifyRegGridFormDTO formDTO);
}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java
index af2a9e2513..a6f88e5c0f 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java
@@ -1,26 +1,27 @@
package com.epmet.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
+import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
-import com.epmet.dao.UserDao;
-import com.epmet.dao.UserResiInfoDao;
-import com.epmet.dao.UserRoleDao;
-import com.epmet.dao.UserWechatDao;
+import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
-import com.epmet.entity.UserBaseInfoEntity;
-import com.epmet.entity.UserEntity;
-import com.epmet.entity.UserWechatEntity;
+import com.epmet.entity.*;
+import com.epmet.feign.EpmetHeartOpenFeignClient;
import com.epmet.feign.EpmetPointOpenFeignClient;
import com.epmet.feign.GovOrgFeignClient;
+import com.epmet.redis.UserBaseInfoRedis;
import com.epmet.service.IcResiUserService;
import com.epmet.service.UserBaseInfoService;
import com.epmet.service.UserService;
@@ -31,6 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
@@ -63,6 +65,16 @@ public class UserServiceImpl extends BaseServiceImpl implem
private UserResiInfoDao userResiInfoDao;
@Autowired
private IcResiUserService icResiUserService;
+ @Autowired
+ private RegisterRelationDao registerRelationDao;
+ @Autowired
+ private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient;
+ @Autowired
+ private ResiUserBadgeDao resiUserBadgeDao;
+ @Autowired
+ private UserBadgeCertificateRecordDao userBadgeCertificateRecordDao;
+ @Autowired
+ private UserBaseInfoRedis userBaseInfoRedis;
private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class);
@@ -417,4 +429,69 @@ public class UserServiceImpl extends BaseServiceImpl implem
return result;
}
+ /**
+ * 居民端-修改注册网格
+ *
+ * @param formDTO
+ */
+ @Transactional(rollbackFor = Exception.class)
+ @Override
+ public void modifyRegGrid(ModifyRegGridFormDTO formDTO) {
+ GridInfoCache newGridInfo= CustomerOrgRedis.getGridInfo(formDTO.getGridId());
+ if (null == newGridInfo) {
+ throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:查询当前网格信息异常", "服务器开小差了...");
+ }
+ //修改register_relation表
+ LambdaQueryWrapper originWrapper=new LambdaQueryWrapper();
+ originWrapper.eq(RegisterRelationEntity::getCustomerId,formDTO.getCustomerId())
+ .eq(RegisterRelationEntity::getUserId,formDTO.getUserId())
+ .eq(RegisterRelationEntity::getFirstRegister, NumConstant.ONE_STR);
+ //1、删除废弃网格的(现在生产存在同一个用户相同的网格id多条记录,所以用delete方法)
+ registerRelationDao.delete(originWrapper);
+
+ //2、删除用户与当前选择的网格的关系,新插入一条注册关系,
+ LambdaQueryWrapper deleteWrapper=new LambdaQueryWrapper();
+ deleteWrapper.eq(RegisterRelationEntity::getCustomerId,formDTO.getCustomerId())
+ .eq(RegisterRelationEntity::getUserId,formDTO.getUserId())
+ .eq(RegisterRelationEntity::getGridId, formDTO.getGridId());
+ registerRelationDao.delete(deleteWrapper);
+
+ RegisterRelationEntity insert=new RegisterRelationEntity();
+ insert.setCustomerId(formDTO.getCustomerId());
+ insert.setGridId(formDTO.getGridId());
+ insert.setUserId(formDTO.getUserId());
+ insert.setFirstRegister(NumConstant.ONE_STR);
+ insert.setRegister(NumConstant.ONE_STR);
+ insert.setParticipation(NumConstant.ONE_STR);
+ registerRelationDao.insert(insert);
+
+ //2、修改历史徽章表
+ LambdaUpdateWrapper recUpdate=new LambdaUpdateWrapper<>();
+ recUpdate.set(UserBadgeCertificateRecordEntity::getGridId,newGridInfo.getId());
+ recUpdate.eq(UserBadgeCertificateRecordEntity::getCustomerId,formDTO.getCustomerId())
+ .eq(UserBadgeCertificateRecordEntity::getUserId,formDTO.getUserId());
+ userBadgeCertificateRecordDao.update(null,recUpdate);
+
+ LambdaUpdateWrapper badgeUpdate=new LambdaUpdateWrapper<>();
+ badgeUpdate.set(ResiUserBadgeEntity::getGridId,newGridInfo.getId());
+ badgeUpdate.eq(ResiUserBadgeEntity::getCustomerId,formDTO.getCustomerId())
+ .eq(ResiUserBadgeEntity::getUserId,formDTO.getUserId());
+ resiUserBadgeDao.update(null,badgeUpdate);
+
+ //3、修改支援者信息表
+ VolunteerInfoDTO volunteerInfoDTO=new VolunteerInfoDTO();
+ volunteerInfoDTO.setCustomerId(formDTO.getCustomerId());
+ volunteerInfoDTO.setUserId(formDTO.getUserId());
+ volunteerInfoDTO.setGridId(newGridInfo.getId());
+ volunteerInfoDTO.setPid(newGridInfo.getPid());
+ volunteerInfoDTO.setPids(newGridInfo.getPids());
+ volunteerInfoDTO.setGridName(newGridInfo.getGridName());
+ Result volunteerRes=epmetHeartOpenFeignClient.modifyVolunteerGrid(volunteerInfoDTO);
+ if (!volunteerRes.success()) {
+ throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:修改用户志愿者信息异常", "服务器开小差了...");
+ }
+ //4、删除用户缓存信息
+ userBaseInfoRedis.clearUserCache(Arrays.asList(formDTO.getUserId()));
+ }
+
}