Browse Source

根据名称 模糊修改 网格中心点位

master
jianjun 4 years ago
parent
commit
e980051aae
  1. 18
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java
  2. 30
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java
  3. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java
  4. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java
  5. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  6. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  7. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java

18
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<Double> center = new ArrayList<>();
}

30
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<CenterPointForm> centerDataList = new ArrayList<>();
/* @Data
public class CenterData implements Serializable{
private static final long serialVersionUID = 6425114459278919896L;
private String title;
private List<Double> center = new ArrayList<>();
}*/
}

14
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<String,Integer> effectRow = eiDimService.updateCenterPointByName(param);
return new Result().ok(effectRow);
}
}

13
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<String,Integer> updateCenterPointByName(GridCenterPointForm param);
}

4
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<ScreenCustomerGri
* @date 2021/3/23 下午4:02
*/
List<ScreenCustomerGridDTO> selectBelongGridInfo(String customerId,String level);
}
Integer updateCenterPointByName(String customerId, String title, List<Double> center);
}

22
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<ScreenCustome
screenGrid.setGridName(grid.getGridName());
screenGrid.setAreaCode(grid.getAreaCode());
screenCustomerGridDao.updateById(screenGrid);
if ("1".equals(grid.getDelFlag())) {
LambdaQueryWrapper<ScreenCustomerGridEntity> w = new LambdaQueryWrapper<>();
w.eq(ScreenCustomerGridEntity::getGridId, grid.getId());
screenCustomerGridDao.delete(w);
}
}
}
}
@ -179,4 +188,15 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
public List<ScreenCustomerGridDTO> selectBelongGridInfo(String customerId, String level) {
return baseDao.selectBelongGridInfo(customerId, level);
}
}
@Override
public Integer updateCenterPointByName(String customerId, String title, List<Double> center) {
LambdaUpdateWrapper<ScreenCustomerGridEntity> tWrapper = new LambdaUpdateWrapper<>();
String val = center.toString();
List<String> 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);
}
}

21
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<String,Integer> updateCenterPointByName(GridCenterPointForm param) {
//todo 怎么反向判断 左匹配
List<GovernAbilityGridMonthlyFormDTO> gridInfoList = screenCustomerGridService.selectAllGridInfo(param.getCustomerId());
Map<String,Integer> 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<CustomerGridEntity> listGrids2Update() {
ScreenCustomerGridEntity lastUpdateGrid = screenCustomerGridService.getLastUpdateGrid();
if (lastUpdateGrid != null) {

Loading…
Cancel
Save