|
@@ -0,0 +1,69 @@
|
|
|
+package com.rongwei.zhsw.system.service.impl;
|
|
|
+
|
|
|
+import com.rongwe.zhsw.system.domain.SwBusinesshallDo;
|
|
|
+import com.rongwe.zhsw.system.domain.SwEnterpriseConfigInfoDo;
|
|
|
+import com.rongwe.zhsw.system.vo.WeChatPickerVo;
|
|
|
+import com.rongwei.rwcommon.base.R;
|
|
|
+import com.rongwei.rwcommonentity.commonservers.domain.TenantDo;
|
|
|
+import com.rongwei.zhsw.system.dao.CommonBusinessDao;
|
|
|
+import com.rongwei.zhsw.system.dao.SwNotificationAnnouncementDao;
|
|
|
+import com.rongwei.zhsw.system.service.WaterWorksService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * WaterWorksServiceImpl class
|
|
|
+ *
|
|
|
+ * @author XH
|
|
|
+ * @date 2025/04/03
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class WaterWorksServiceImpl implements WaterWorksService {
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(WaterWorksServiceImpl.class);
|
|
|
+ @Autowired
|
|
|
+ private SwBusinesshallServiceImpl swBusinesshallService;
|
|
|
+ @Autowired
|
|
|
+ private SwEnterpriseConfigInfoServiceImpl swEnterpriseConfigInfoService;
|
|
|
+ @Autowired
|
|
|
+ private SwNotificationAnnouncementDao swNotificationAnnouncementDao;
|
|
|
+ @Autowired
|
|
|
+ private CommonBusinessDao commonBusinessDao;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R getList(Map<String,String> dsKey) {
|
|
|
+ // 设置水务公司数据字典
|
|
|
+ List<TenantDo> tenantDos = commonBusinessDao.getByDsKey(dsKey.getOrDefault("dsKey",""));
|
|
|
+ List<String> dsKeys = tenantDos.stream().filter(data -> !"incontrol".equals(data.getDskey()))
|
|
|
+ .map(TenantDo::getDskey)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ // 获取营业厅信息
|
|
|
+ List<SwBusinesshallDo> swBusinesshallDos = swBusinesshallService.getBaseMapper().selectListByDsKey(dsKeys);
|
|
|
+ // 获取水站基本配置
|
|
|
+ List<SwEnterpriseConfigInfoDo> swEnterpriseConfigInfoDos = swEnterpriseConfigInfoService.getBaseMapper().selectListByDsKey(dsKeys);
|
|
|
+ // 缓存当前用户可以读取到的水站信息
|
|
|
+ List<WeChatPickerVo> waterCompanys = tenantDos.stream()
|
|
|
+ .filter(data -> !"incontrol".equals(data.getDskey()))
|
|
|
+ .map(data -> {
|
|
|
+ WeChatPickerVo weChatPickerVo = new WeChatPickerVo();
|
|
|
+ weChatPickerVo.setId(data.getDskey());
|
|
|
+ weChatPickerVo.setName(data.getTenantname());
|
|
|
+ weChatPickerVo.setSwCompanyInfo(swEnterpriseConfigInfoDos.stream()
|
|
|
+ .filter(info->data.getDskey().equals(info.getRoption()))
|
|
|
+ .findFirst()
|
|
|
+ .orElse(null));
|
|
|
+ weChatPickerVo.setBusinessPoint(swBusinesshallDos.stream()
|
|
|
+ .filter(sw->data.getDskey().equals(sw.getRoption()))
|
|
|
+ .sorted(Comparator.comparing(SwBusinesshallDo::getOrdernumber))
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ return weChatPickerVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return R.ok(waterCompanys);
|
|
|
+ }
|
|
|
+}
|