diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java new file mode 100644 index 0000000000..59cf43ebf1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java @@ -0,0 +1,18 @@ +package com.epmet.dto.screen.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * desc:修改组织中心点 + * @author liujianjun + */ +@Data +public class CenterPointForm implements Serializable { + private static final long serialVersionUID = 6425114459278919896L; + private String title; + private List center = new ArrayList<>(); +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java new file mode 100644 index 0000000000..6859b4a1ee --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java @@ -0,0 +1,30 @@ +package com.epmet.dto.screen.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * desc:修改组织中心点 + * @author liujianjun + */ +@Data +public class GridCenterPointForm implements Serializable { + + private static final long serialVersionUID = -6988009829971668860L; + + private String customerId; + + private List centerDataList = new ArrayList<>(); + + + /* @Data + public class CenterData implements Serializable{ + + private static final long serialVersionUID = 6425114459278919896L; + private String title; + private List center = new ArrayList<>(); + }*/ +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java index 761c62bb0b..e15b66e188 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java @@ -2,14 +2,18 @@ package com.epmet.controller; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.screen.form.GridCenterPointForm; import com.epmet.service.EIDimService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Map; + /** * epmet_evaluation_index库的维度controller */ @@ -45,4 +49,14 @@ public class EIDimController { return new Result(); } + /** + * desc 更新网格的中心点位 + * @return + */ + @PostMapping("update/gridcenterpoint") + public Result upsertOrgCenterPoint(@RequestBody GridCenterPointForm param) { + Map effectRow = eiDimService.updateCenterPointByName(param); + return new Result().ok(effectRow); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java index 64ba669caf..f74e041940 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java @@ -1,7 +1,10 @@ package com.epmet.service; +import com.epmet.dto.screen.form.GridCenterPointForm; import org.springframework.stereotype.Service; +import java.util.Map; + /** * epmet_evaluation_index 维度的service */ @@ -10,4 +13,14 @@ public interface EIDimService { void initAgencies(); void initDepartments(); void initGrids(); + + /** + * desc: 更新中心点位 + * + * @param param + * @return java.lang.Integer + * @author LiuJanJun + * @date 2021/6/7 3:52 下午 + */ + Map updateCenterPointByName(GridCenterPointForm param); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java index ef39e1b781..eeb24aad81 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java @@ -102,4 +102,6 @@ public interface ScreenCustomerGridService extends BaseService selectBelongGridInfo(String customerId,String level); -} \ No newline at end of file + + Integer updateCenterPointByName(String customerId, String title, List center); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index 67dae90b1c..7253d1bc1b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -18,6 +18,8 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.utils.DateUtils; @@ -37,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.List; @@ -94,6 +97,12 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl w = new LambdaQueryWrapper<>(); + w.eq(ScreenCustomerGridEntity::getGridId, grid.getId()); + screenCustomerGridDao.delete(w); + } } } } @@ -179,4 +188,15 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl selectBelongGridInfo(String customerId, String level) { return baseDao.selectBelongGridInfo(customerId, level); } -} \ No newline at end of file + + @Override + public Integer updateCenterPointByName(String customerId, String title, List center) { + LambdaUpdateWrapper tWrapper = new LambdaUpdateWrapper<>(); + String val = center.toString(); + List array = new ArrayList<>(Collections.singleton(val)); + tWrapper.eq(ScreenCustomerGridEntity::getCustomerId,customerId) + .likeRight(ScreenCustomerGridEntity::getGridName,title) + .set(ScreenCustomerGridEntity::getCenterMark, array.toString()); + return baseDao.update(null,tWrapper); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java index d35aa6bec6..b80c287843 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java @@ -1,5 +1,7 @@ package com.epmet.service.impl; +import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; +import com.epmet.dto.screen.form.GridCenterPointForm; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; @@ -16,10 +18,7 @@ import com.epmet.service.org.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; @Service public class EIDimServiceImpl implements EIDimService { @@ -130,6 +129,20 @@ public class EIDimServiceImpl implements EIDimService { screenCustomerGridService.addAndUpdateGrids(grids2Add, grids2Update); } + @Override + public Map updateCenterPointByName(GridCenterPointForm param) { + //todo 怎么反向判断 左匹配 + List gridInfoList = screenCustomerGridService.selectAllGridInfo(param.getCustomerId()); + Map result = new HashMap<>(); + param.getCenterDataList().forEach(o ->{ + Integer integer = screenCustomerGridService.updateCenterPointByName(param.getCustomerId(), o.getTitle(), o.getCenter()); + if (integer == 0 || integer > 1){ + result.put(o.getTitle(),integer); + } + }); + return result; + } + private List listGrids2Update() { ScreenCustomerGridEntity lastUpdateGrid = screenCustomerGridService.getLastUpdateGrid(); if (lastUpdateGrid != null) {