|
@@ -7,16 +7,12 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
+import com.usky.common.core.exception.BusinessException;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
-import com.usky.fire.domain.BaseCompany;
|
|
|
-import com.usky.fire.domain.BaseCompanyAttach1;
|
|
|
-import com.usky.fire.domain.BaseCompanyPerson;
|
|
|
+import com.usky.fire.domain.*;
|
|
|
import com.usky.fire.mapper.BaseCompanyMapper;
|
|
|
-import com.usky.fire.service.BaseCompanyAttach1Service;
|
|
|
-import com.usky.fire.service.BaseCompanyPersonService;
|
|
|
-import com.usky.fire.service.BaseCompanyService;
|
|
|
-import com.usky.fire.service.BaseUserCompanyService;
|
|
|
+import com.usky.fire.service.*;
|
|
|
import com.usky.fire.service.util.OnlineMethod;
|
|
|
import com.usky.fire.service.vo.CompanyDataVo;
|
|
|
import com.usky.fire.service.vo.LocateInfo;
|
|
@@ -50,6 +46,15 @@ public class BaseCompanyServiceImpl extends AbstractCrudService<BaseCompanyMappe
|
|
|
@Autowired
|
|
|
private BaseCompanyAttach1Service baseCompanyAttach1Service;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DemLawStatisticsService demLawStatisticsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DemAtlInspectDeclareService demAtlInspectDeclareService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DemEnforceReportComplaintService demEnforceReportComplaintService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<BaseCompany> userCompanySelect() {
|
|
|
List<String> companyIdList = baseUserCompanyService.companyIdList();
|
|
@@ -214,8 +219,212 @@ public class BaseCompanyServiceImpl extends AbstractCrudService<BaseCompanyMappe
|
|
|
this.updateById(baseCompany);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> lawTrendScatterer(String streetTown, String sattererType) {
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ List<String> companyCodeList = new ArrayList<>();
|
|
|
+ switch (sattererType) {
|
|
|
+ case "双随机执法单位":
|
|
|
+ companyCodeList = this.lawStatistics();
|
|
|
+ if (CollectionUtils.isNotEmpty(companyCodeList)) {
|
|
|
+ list = this.companyData(streetTown, companyCodeList);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "安全检查单位":
|
|
|
+ companyCodeList = this.inspectDeclare();
|
|
|
+ if (CollectionUtils.isNotEmpty(companyCodeList)) {
|
|
|
+ list = this.companyData(streetTown, companyCodeList);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "举报投诉":
|
|
|
+ list = this.reportComplaint();
|
|
|
+ break;
|
|
|
+// case "执法记录仪":
|
|
|
+// break;
|
|
|
+ default:
|
|
|
+ throw new BusinessException("该类型点位未定义");
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> reportComplaint() {
|
|
|
+ List<Map<String, Object>> list1 = new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<DemEnforceReportComplaint> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(DemEnforceReportComplaint::getReportAddress, DemEnforceReportComplaint::getLatitude,
|
|
|
+ DemEnforceReportComplaint::getLongitude, DemEnforceReportComplaint::getId)
|
|
|
+ .eq(DemEnforceReportComplaint::getEnable, 0);
|
|
|
+ List<DemEnforceReportComplaint> list = demEnforceReportComplaintService.list(queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (StringUtils.isNotBlank(list.get(i).getLongitude()) && StringUtils.isNotBlank(list.get(i).getLatitude())) {
|
|
|
+ map.put("longitude", list.get(i).getLongitude());
|
|
|
+ map.put("latitude", list.get(i).getLatitude());
|
|
|
+ map.put("name", list.get(i).getReportAddress());
|
|
|
+ map.put("number", list.get(i).getReportPhone());
|
|
|
+ } else {
|
|
|
+ List<LocateInfo> lonLat = OnlineMethod.getLonLat(list.get(i).getReportAddress());
|
|
|
+ if (CollectionUtils.isNotEmpty(lonLat)) {
|
|
|
+ map.put("longitude", lonLat.get(0).getLongitude());
|
|
|
+ map.put("latitude", lonLat.get(0).getLatitude());
|
|
|
+ map.put("name", list.get(i).getReportAddress());
|
|
|
+ map.put("number", list.get(i).getReportPhone());
|
|
|
+ DemEnforceReportComplaint demEnforceReportComplaint = new DemEnforceReportComplaint();
|
|
|
+ demEnforceReportComplaint.setId(list.get(i).getId());
|
|
|
+ demEnforceReportComplaint.setLatitude("" + lonLat.get(0).getLatitude());
|
|
|
+ demEnforceReportComplaint.setLongitude("" + lonLat.get(0).getLongitude());
|
|
|
+ demEnforceReportComplaintService.updateById(demEnforceReportComplaint);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (map.get("longitude")!=null&&map.get("latitude")!=null){
|
|
|
+ if (StringUtils.isNotBlank(map.get("longitude").toString()) && StringUtils.isNotBlank(map.get("latitude").toString())) {
|
|
|
+ list1.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list1;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<String> inspectDeclare() {
|
|
|
+ List<String> companyCodeList = new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<DemAtlInspectDeclare> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(DemAtlInspectDeclare::getDeclareCompanyCode)
|
|
|
+ .eq(DemAtlInspectDeclare::getDeleteFlag, 0)
|
|
|
+ .groupBy(DemAtlInspectDeclare::getDeclareCompanyCode);
|
|
|
+ List<DemAtlInspectDeclare> list = demAtlInspectDeclareService.list(queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ companyCodeList.add(list.get(i).getDeclareCompanyCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return companyCodeList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<String> lawStatistics() {
|
|
|
+ List<String> companyCodeList = new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<DemLawStatistics> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(DemLawStatistics::getCompanyCode)
|
|
|
+ .eq(DemLawStatistics::getDeleteFlag, 0)
|
|
|
+ .groupBy(DemLawStatistics::getCompanyCode);
|
|
|
+ List<DemLawStatistics> list = demLawStatisticsService.list(queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ companyCodeList.add(list.get(i).getCompanyCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return companyCodeList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> companyData(String streetTown, List<String> companyCodeList) {
|
|
|
+ List<String> streetTownList = new ArrayList<>();
|
|
|
+ streetTownList.add("华漕镇");
|
|
|
+ streetTownList.add("新虹街道");
|
|
|
+ streetTownList.add("七宝镇");
|
|
|
+ streetTownList.add("虹桥镇");
|
|
|
+ streetTownList.add("古美路街道");
|
|
|
+ streetTownList.add("莘庄镇");
|
|
|
+ streetTownList.add("梅陇镇");
|
|
|
+ streetTownList.add("颛桥镇");
|
|
|
+ streetTownList.add("马桥镇");
|
|
|
+ streetTownList.add("江川路街道");
|
|
|
+ streetTownList.add("吴泾镇");
|
|
|
+ streetTownList.add("浦锦街道");
|
|
|
+ streetTownList.add("浦江镇");
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<BaseCompany> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(BaseCompany::getId, BaseCompany::getCompanyId, BaseCompany::getCompanyName,
|
|
|
+ BaseCompany::getCompanyType, BaseCompany::getLinkPhone, BaseCompany::getAddress, BaseCompany::getStreetTown)
|
|
|
+ .eq(BaseCompany::getEnable, 0)
|
|
|
+ .eq(StringUtils.isNotBlank(streetTown), BaseCompany::getStreetTown, streetTown)
|
|
|
+ .in(CollectionUtils.isNotEmpty(companyCodeList), BaseCompany::getCompanyCode, companyCodeList);
|
|
|
+ List<BaseCompany> list1 = this.list(queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(list1)) {
|
|
|
+ List<String> companyIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < list1.size(); i++) {
|
|
|
+ companyIdList.add(list1.get(i).getCompanyId());
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<BaseCompanyAttach1> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper1.select(BaseCompanyAttach1::getId, BaseCompanyAttach1::getCompanyId, BaseCompanyAttach1::getLongitude,
|
|
|
+ BaseCompanyAttach1::getLatitude)
|
|
|
+ .in(BaseCompanyAttach1::getCompanyId, companyIdList);
|
|
|
+ List<BaseCompanyAttach1> list2 = baseCompanyAttach1Service.list(queryWrapper1);
|
|
|
+ for (int i = 0; i < list1.size(); i++) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("number", list1.get(i).getCompanyId());
|
|
|
+ map.put("name", list1.get(i).getCompanyName());
|
|
|
+ map.put("longitude", null);
|
|
|
+ map.put("latitude", null);
|
|
|
+ map.put("streetTown", null);
|
|
|
+ for (int j = 0; j < list2.size(); j++) {
|
|
|
+ if (list1.get(i).getCompanyId().equals(list2.get(j).getCompanyId())) {
|
|
|
+ String longitude = null;
|
|
|
+ String latitude = null;
|
|
|
+ if ((StringUtils.isBlank(list2.get(j).getLongitude()) && StringUtils.isNotBlank(list1.get(i).getAddress()))) {
|
|
|
+ List<LocateInfo> lonLat = OnlineMethod.getLonLat(list1.get(i).getAddress());
|
|
|
+ if (CollectionUtils.isNotEmpty(lonLat)) {
|
|
|
+ if (StringUtils.isBlank(list2.get(j).getLongitude()) && StringUtils.isBlank(list2.get(j).getLatitude())) {
|
|
|
+ longitude = "" + lonLat.get(0).getLongitude();
|
|
|
+ latitude = "" + lonLat.get(0).getLatitude();
|
|
|
+ } else {
|
|
|
+ longitude = list2.get(j).getLongitude();
|
|
|
+ latitude = list2.get(j).getLatitude();
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(list1.get(i).getStreetTown())) {
|
|
|
+ streetTown = lonLat.get(0).getStreet();
|
|
|
+ } else {
|
|
|
+ streetTown = list1.get(i).getStreetTown();
|
|
|
+ }
|
|
|
+ this.updateCompany1(list1.get(i).getId(), list2.get(j).getId(), longitude, latitude, streetTown);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ longitude = list2.get(j).getLongitude();
|
|
|
+ latitude = list2.get(j).getLatitude();
|
|
|
+ streetTown = list1.get(i).getStreetTown();
|
|
|
+ }
|
|
|
+ map.put("streetTown", streetTown);
|
|
|
+ map.put("longitude", longitude);
|
|
|
+ map.put("latitude", latitude);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (map.get("longitude") != null && map.get("latitude") != null && map.get("streetTown") != null) {
|
|
|
+ String streetTown1 = map.get("streetTown").toString();
|
|
|
+ if (streetTownList.contains(streetTown1)) {
|
|
|
+ if (StringUtils.isNotBlank(streetTown)) {
|
|
|
+ if (streetTown.equals(streetTown1)) {
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<Object> companyScatterer(String streetTown, String companyType) {
|
|
|
+ List<String> streetTownList = new ArrayList<>();
|
|
|
+ streetTownList.add("华漕镇");
|
|
|
+ streetTownList.add("新虹街道");
|
|
|
+ streetTownList.add("七宝镇");
|
|
|
+ streetTownList.add("虹桥镇");
|
|
|
+ streetTownList.add("古美路街道");
|
|
|
+ streetTownList.add("莘庄镇");
|
|
|
+ streetTownList.add("梅陇镇");
|
|
|
+ streetTownList.add("颛桥镇");
|
|
|
+ streetTownList.add("马桥镇");
|
|
|
+ streetTownList.add("江川路街道");
|
|
|
+ streetTownList.add("吴泾镇");
|
|
|
+ streetTownList.add("浦锦街道");
|
|
|
+ streetTownList.add("浦江镇");
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
LambdaQueryWrapper<BaseCompany> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.select(BaseCompany::getId, BaseCompany::getCompanyId, BaseCompany::getCompanyName,
|
|
@@ -288,11 +497,9 @@ public class BaseCompanyServiceImpl extends AbstractCrudService<BaseCompanyMappe
|
|
|
map.put("latitude", latitude);
|
|
|
}
|
|
|
}
|
|
|
- if (map.get("longitude") != null && map.get("latitude") != null) {
|
|
|
- Double longitude1 = Double.parseDouble(map.get("longitude").toString());
|
|
|
- Double latitude1 = Double.parseDouble(map.get("latitude").toString());
|
|
|
- if (121.236121 < longitude1 && 121.573493 > longitude1 &&
|
|
|
- 30.97747 < latitude1 && 31.259224 > latitude1) {
|
|
|
+ if (map.get("longitude") != null && map.get("latitude") != null&& map.get("streetTown") != null) {
|
|
|
+ String streetTown1 = map.get("streetTown").toString();
|
|
|
+ if (streetTownList.contains(streetTown1)) {
|
|
|
if (StringUtils.isNotBlank(streetTown)) {
|
|
|
if (streetTown.equals(map.get("streetTown").toString())) {
|
|
|
list.add(map);
|