Browse Source

一级分类里 如果是03 矛盾纠纷 则涉及人数写2(目前业务不支持 所以应产品需求 填2); 优化代码可读性;

dev_shibei_match
jianjun 4 years ago
parent
commit
077f5381cc
  1. 86
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java

86
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java

@ -31,6 +31,7 @@ import com.epmet.opendata.service.BaseConflictsResolveService;
import com.epmet.opendata.service.BaseDisputeProcessService;
import com.epmet.opendata.service.ExDeptService;
import com.epmet.opendata.service.ExUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -47,6 +48,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-15
*/
@Slf4j
@Service
public class BaseDisputeProcessServiceImpl extends BaseServiceImpl<BaseDisputeProcessDao, BaseDisputeProcessEntity> implements BaseDisputeProcessService {
@Resource
@ -90,48 +92,50 @@ public class BaseDisputeProcessServiceImpl extends BaseServiceImpl<BaseDisputePr
}
private void saveEvent(EventInfoFormDTO formDTO, Map<String, Integer> deptMap, Map<String, Integer> userMap, List<EventInfoResultDTO> list) {
if (CollectionUtils.isNotEmpty(list)) {
if (CollectionUtils.isEmpty(list)) {
log.warn("no event data to save table base_conflicts_resolve");
return;
}
List<BaseConflictsResolveEntity> resolveList = list.stream().map(item -> {
BaseConflictsResolveEntity entity = new BaseConflictsResolveEntity();
entity.setId(item.getId().concat("_PY"));
entity.setCustomerId(item.getCustomerId());
entity.setGridId(deptMap.get(item.getOrgId()));
entity.setGridName(item.getOrgName());
entity.setEventName(item.getEventName());
entity.setHappenDate(item.getHappenDate());
entity.setHappenPlace(item.getHappenPlace());
String eventDescription = item.getEventDescription();
//如果不为空 长度控制1000以内
if (StringUtils.isNotBlank(eventDescription) && eventDescription.length() > NumConstant.ONE_THOUSAND){
eventDescription = eventDescription.substring(NumConstant.ZERO,NumConstant.ONE_THOUSAND);
}
entity.setEventDescription(eventDescription);
entity.setLng(null == item.getLng()?null:item.getLng().toPlainString());
entity.setLat(null == item.getLat()?null:item.getLat().toPlainString());
entity.setCreateBy(null == userMap.get(item.getReporterId())?null:String.valueOf(userMap.get(item.getReporterId())));
entity.setCreateDate(item.getReportTime());
entity.setUpdateDate(new Date());
entity.setStatus(item.getStatus());
//业务不确定
if (("03").equals(item.getStatus())) {
entity.setSuccessfulOrNot("Y");
}
//一级分类里 如果是03 矛盾纠纷 则涉及人数写2(目前业务不支持 所以应产品需求 填2)
if ("03".equals(item.getParentEventCategory())){
entity.setNumberInvolved(NumConstant.TWO);
}
entity.setEventNo(("py_").concat(item.getId()));
entity.setFirstEventCategory(item.getParentEventCategory());
entity.setSource("01");
entity.setSecondEventCategory(item.getEventCategory());
entity.setResolveWay(item.getWaysOfResolving());
entity.setResolveGridLevel(item.getCompleteLevel());
entity.setResolveTime(item.getCompleteTime());
return entity;
}).collect(Collectors.toList());
List<BaseConflictsResolveEntity> resolveList = list.stream().map(item -> {
BaseConflictsResolveEntity entity = new BaseConflictsResolveEntity();
entity.setId(item.getId().concat("_PY"));
entity.setCustomerId(item.getCustomerId());
entity.setGridId(deptMap.get(item.getOrgId()));
entity.setGridName(item.getOrgName());
entity.setEventName(item.getEventName());
entity.setHappenDate(item.getHappenDate());
entity.setHappenPlace(item.getHappenPlace());
String eventDescription = item.getEventDescription();
//如果不为空 长度控制1000以内
if (StringUtils.isNotBlank(eventDescription) && eventDescription.length() > NumConstant.ONE_THOUSAND) {
eventDescription = eventDescription.substring(NumConstant.ZERO, NumConstant.ONE_THOUSAND);
}
entity.setEventDescription(eventDescription);
entity.setLng(null == item.getLng() ? null : item.getLng().toPlainString());
entity.setLat(null == item.getLat() ? null : item.getLat().toPlainString());
entity.setCreateBy(null == userMap.get(item.getReporterId()) ? null : String.valueOf(userMap.get(item.getReporterId())));
entity.setCreateDate(item.getReportTime());
entity.setUpdateDate(new Date());
entity.setStatus(item.getStatus());
//业务不确定
if (("03").equals(item.getStatus())) {
entity.setSuccessfulOrNot("Y");
}
//业务不包含 一级分类里 如果是03 矛盾纠纷 则涉及人数写2(目前业务不支持 所以应产品需求 填2)
if ("03".equals(item.getParentEventCategory())) {
entity.setNumberInvolved(NumConstant.TWO);
}
entity.setEventNo(("py_").concat(item.getId()));
entity.setFirstEventCategory(item.getParentEventCategory());
entity.setSource("01");
entity.setSecondEventCategory(item.getEventCategory());
entity.setResolveWay(item.getWaysOfResolving());
entity.setResolveGridLevel(item.getCompleteLevel());
entity.setResolveTime(item.getCompleteTime());
return entity;
}).collect(Collectors.toList());
baseConflictsResolveService.saveOrUpdateBatch(resolveList, formDTO.getPageSize());
}
baseConflictsResolveService.saveOrUpdateBatch(resolveList, formDTO.getPageSize());
}
}

Loading…
Cancel
Save