Commit 4a061395 authored by 赵啸非's avatar 赵啸非

重构部分功能模块

parent bccdb0a5
Pipeline #2323 failed with stages
...@@ -16,6 +16,7 @@ import com.mortals.xhx.feign.base.IApiBaseManagerFeign; ...@@ -16,6 +16,7 @@ import com.mortals.xhx.feign.base.IApiBaseManagerFeign;
import com.mortals.xhx.feign.base.pdu.DeptPdu; import com.mortals.xhx.feign.base.pdu.DeptPdu;
import com.mortals.xhx.feign.base.pdu.SitePdu; import com.mortals.xhx.feign.base.pdu.SitePdu;
import com.mortals.xhx.feign.rsp.ApiResp; import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.home.pdu.HomeQueryPdu; import com.mortals.xhx.module.home.pdu.HomeQueryPdu;
import com.mortals.xhx.module.hotword.model.HotwordEntity; import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.model.HotwordQuery; import com.mortals.xhx.module.hotword.model.HotwordQuery;
...@@ -26,6 +27,7 @@ import com.mortals.xhx.module.matter.model.MatterEntity; ...@@ -26,6 +27,7 @@ import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery; import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterDatumService; import com.mortals.xhx.module.matter.service.MatterDatumService;
import com.mortals.xhx.module.matter.service.MatterService; import com.mortals.xhx.module.matter.service.MatterService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -47,26 +49,28 @@ public class HomeController extends BaseJsonBodyController { ...@@ -47,26 +49,28 @@ public class HomeController extends BaseJsonBodyController {
private MatterService matterService; private MatterService matterService;
@Autowired @Autowired
private HotwordService hotwordService; private HotwordService hotwordService;
@Autowired
private ISiteFeign siteFeign;
@PostMapping({"site/list"}) @PostMapping({"site/list"})
public Rest<Object> list() { public Rest<Object> list() {
IUser user = this.getCurUser(); IUser user = this.getCurUser();
if(user==null){ if (user == null) {
throw new AppException("用户未登录"); throw new AppException("用户未登录");
} }
Rest<Object> ret = new Rest(); Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
String busiDesc = "查询用户站点列表" ; String busiDesc = "查询用户站点列表";
int code=1; int code = 1;
try { try {
if(StringUtils.isNotEmpty(user.getSiteIds())){ if (StringUtils.isNotEmpty(user.getSiteIds())) {
SitePdu sitePdu = new SitePdu(); SitePdu sitePdu = new SitePdu();
List<String> siteIds = Arrays.asList(user.getSiteIds().split(",")); List<String> siteIds = Arrays.asList(user.getSiteIds().split(","));
List<Long> idList = new ArrayList<>(); List<Long> idList = new ArrayList<>();
siteIds.forEach(s -> { siteIds.forEach(s -> {
idList.add(DataUtil.converStr2Long(s,0)); idList.add(DataUtil.converStr2Long(s, 0));
}); });
sitePdu.setIdList(idList); sitePdu.setIdList(idList);
String resp = iApiBaseManagerFeign.getSitesByQuery(sitePdu); String resp = iApiBaseManagerFeign.getSitesByQuery(sitePdu);
...@@ -74,12 +78,12 @@ public class HomeController extends BaseJsonBodyController { ...@@ -74,12 +78,12 @@ public class HomeController extends BaseJsonBodyController {
if (apiResp.getCode() != YesNoEnum.YES.getValue()) { if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取用户站点列表树数据失败:" + apiResp.getMsg()); throw new AppException("获取用户站点列表树数据失败:" + apiResp.getMsg());
} }
if(apiResp.getData().get("data")!=null) { if (apiResp.getData().get("data") != null) {
model.put("data", apiResp.getData().get("data")); model.put("data", apiResp.getData().get("data"));
}else { } else {
model.put("data", Collections.emptyList()); model.put("data", Collections.emptyList());
} }
}else { } else {
model.put("data", Collections.emptyList()); model.put("data", Collections.emptyList());
} }
model.put("message_info", busiDesc + "成功"); model.put("message_info", busiDesc + "成功");
...@@ -105,10 +109,10 @@ public class HomeController extends BaseJsonBodyController { ...@@ -105,10 +109,10 @@ public class HomeController extends BaseJsonBodyController {
// } // }
Rest<Object> ret = new Rest(); Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
String busiDesc = "查询站点部门列表" ; String busiDesc = "查询站点部门列表";
int code=1; int code = 1;
try { try {
if(queryPdu.getSiteId()!=null){ if (queryPdu.getSiteId() != null) {
DeptPdu deptPdu = new DeptPdu(); DeptPdu deptPdu = new DeptPdu();
deptPdu.setSiteId(queryPdu.getSiteId()); deptPdu.setSiteId(queryPdu.getSiteId());
deptPdu.setSize(-1); deptPdu.setSize(-1);
...@@ -117,12 +121,12 @@ public class HomeController extends BaseJsonBodyController { ...@@ -117,12 +121,12 @@ public class HomeController extends BaseJsonBodyController {
if (apiResp.getCode() != YesNoEnum.YES.getValue()) { if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取用户站点部门列表失败:" + apiResp.getMsg()); throw new AppException("获取用户站点部门列表失败:" + apiResp.getMsg());
} }
if(apiResp.getData().get("data")!=null) { if (apiResp.getData().get("data") != null) {
model.put("data", apiResp.getData().get("data")); model.put("data", apiResp.getData().get("data"));
}else { } else {
model.put("data", Collections.emptyList()); model.put("data", Collections.emptyList());
} }
}else { } else {
model.put("data", Collections.emptyList()); model.put("data", Collections.emptyList());
} }
model.put("message_info", busiDesc + "成功"); model.put("message_info", busiDesc + "成功");
...@@ -177,7 +181,7 @@ public class HomeController extends BaseJsonBodyController { ...@@ -177,7 +181,7 @@ public class HomeController extends BaseJsonBodyController {
try { try {
List<String> hotwordEntities = hotwordService.find(new HotwordQuery().siteId(homeQueryPdu.getSiteId())).stream() List<String> hotwordEntities = hotwordService.find(new HotwordQuery().siteId(homeQueryPdu.getSiteId())).stream()
.map(HotwordEntity::getHotwords) .map(HotwordEntity::getHotwords)
.flatMap(item-> StrUtil.split(item,",".charAt(0)).stream()) .flatMap(item -> StrUtil.split(item, ",".charAt(0)).stream())
.collect(Collectors.toList()); .collect(Collectors.toList());
model.put("hotWords", hotwordEntities); model.put("hotWords", hotwordEntities);
MatterQuery matterQuery = new MatterQuery(); MatterQuery matterQuery = new MatterQuery();
...@@ -199,6 +203,8 @@ public class HomeController extends BaseJsonBodyController { ...@@ -199,6 +203,8 @@ public class HomeController extends BaseJsonBodyController {
model.put("onlineSubmit", 20); //在线提交数量 model.put("onlineSubmit", 20); //在线提交数量
model.put("dayThrift", 66); //今日节约 model.put("dayThrift", 66); //今日节约
model.put("totalThrift", 996); //累计节约 model.put("totalThrift", 996); //累计节约
Rest<com.mortals.xhx.common.pdu.site.SitePdu> info = siteFeign.info(homeQueryPdu.getSiteId());
model.put("title", info.getData().getSiteName()); //标题
model.put("message_info", busiDesc + "成功"); model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】"); this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) { } catch (Exception var9) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment