推送功能新增。
This commit is contained in:
parent
c05e2ac12c
commit
9b87b24503
@ -23,7 +23,7 @@ public class PartyBuildingProperties {
|
||||
private String logoUrl;
|
||||
private String populationUrl;
|
||||
private String deptassesstUrl;
|
||||
|
||||
private String sendUrl;
|
||||
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
@ -80,4 +80,12 @@ public class PartyBuildingProperties {
|
||||
public void setDeptassesstUrl(String deptassesstUrl) {
|
||||
this.deptassesstUrl = deptassesstUrl;
|
||||
}
|
||||
|
||||
public String getSendUrl() {
|
||||
return sendUrl == null ? "" : sendUrl;
|
||||
}
|
||||
|
||||
public void setSendUrl(String sendUrl) {
|
||||
this.sendUrl = sendUrl;
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,8 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cm.bigdata.config.properties.PartyBuildingProperties;
|
||||
import com.cm.bigdata.config.properties.ScoreProperties;
|
||||
import com.cm.bigdata.dao.casesupervise.ICaseSuperviseDao;
|
||||
import com.cm.bigdata.pojo.dtos.boss.BossDTO;
|
||||
import com.cm.bigdata.pojo.dtos.casescore.CaseScoreDTO;
|
||||
import com.cm.bigdata.pojo.dtos.casesupervise.CaseSuperviseDTO;
|
||||
import com.cm.bigdata.pojo.dtos.configforscore.ConfigForScoreDTO;
|
||||
import com.cm.bigdata.pojo.dtos.scoredetail.ScoreDetailDTO;
|
||||
import com.cm.bigdata.pojo.dtos.worknote.WorkNoteForScoreDTO;
|
||||
import com.cm.bigdata.pojo.dtos.ztree.DictDTO;
|
||||
import com.cm.bigdata.pojo.vos.casesupervise.CaseSuperviseVO;
|
||||
import com.cm.bigdata.pojo.vos.scoredetail.ScoreDetailVO;
|
||||
import com.cm.bigdata.service.casesupervise.ICaseSuperviseService;
|
||||
@ -21,7 +15,6 @@ import com.cm.bigdata.utils.DateRange;
|
||||
import com.cm.bigdata.utils.DateUtils;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
||||
import com.cm.common.plugin.pojo.bos.ClientTokenBO;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
@ -102,6 +95,8 @@ public class CaseScoreController extends AbstractController {
|
||||
}
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
caseScoreDTOS = JSONArray.parseArray(str, CaseScoreDTO.class);
|
||||
// 推送用map
|
||||
Map<String, Object> tempMap = new HashMap<>();
|
||||
for(CaseScoreDTO caseScoreDTO: caseScoreDTOS) {
|
||||
int count = caseScoreDTO.getCloseTimeout().size() + caseScoreDTO.getInspectTimeout().size();
|
||||
// 保存考核详情
|
||||
@ -110,8 +105,31 @@ public class CaseScoreController extends AbstractController {
|
||||
if(count > 0) {
|
||||
saveCaseSupervise(quarter, caseScoreDTO, year);
|
||||
}
|
||||
}
|
||||
|
||||
if(caseScoreDTO.getInspectPushUserIds().size() > 0) {
|
||||
String userId = null;
|
||||
for(int i=0;i<caseScoreDTO.getInspectPushUserIds().size();i++) {
|
||||
Map<String, Object> map1 = caseScoreDTO.getInspectPushUserIds().get(i);
|
||||
if(i == 0) {
|
||||
userId = map1.get("inspectUserId").toString();
|
||||
tempMap.put(userId, 1);
|
||||
}
|
||||
if(i+1 >= caseScoreDTO.getInspectPushUserIds().size()) {
|
||||
break;
|
||||
}
|
||||
Map<String, Object> map2 = caseScoreDTO.getInspectPushUserIds().get(i+1);
|
||||
if(userId.equals(map2.get("inspectUserId"))) {
|
||||
tempMap.put(userId, Integer.valueOf(tempMap.get(userId).toString()) + 1);
|
||||
userId = map2.get("inspectUserId").toString();
|
||||
}else {
|
||||
userId = map2.get("inspectUserId").toString();
|
||||
tempMap.put(userId, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 向App推送消息
|
||||
sendMsgToApp(tempMap);
|
||||
return new SuccessResultList<>(caseScoreDTOS, page.getPage(), page.getTotal());
|
||||
}
|
||||
|
||||
@ -122,13 +140,13 @@ public class CaseScoreController extends AbstractController {
|
||||
*/
|
||||
public int dateAbout(Map<String, Object> params) {
|
||||
// 设置日期格式
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int year = cal.get(Calendar.YEAR);
|
||||
if(!StringUtils.isEmpty(params.get("year"))) {
|
||||
year = Integer.valueOf(params.get("year").toString());
|
||||
}
|
||||
String startDate = year + "-01-01 00:00:00";
|
||||
String startDate = year + "-01-01";
|
||||
String endDate = df.format(new Date());
|
||||
if(!StringUtils.isEmpty(params.get("startDate"))) {
|
||||
startDate = df.format(params.get("startDate"));
|
||||
@ -139,8 +157,8 @@ public class CaseScoreController extends AbstractController {
|
||||
|
||||
if(!StringUtils.isEmpty(params.get("quarter"))) {
|
||||
if(5 == Integer.valueOf(params.get("quarter").toString())) {
|
||||
startDate = year + "-01-01 00:00:00";
|
||||
endDate = year + "-12-31 23:59:59";
|
||||
startDate = year + "-01-01";
|
||||
endDate = year + "-12-31";
|
||||
}else {
|
||||
DateRange currentQuarter = DateUtils.returnQuarterCurrent(year, Integer.valueOf(params.get("quarter").toString()));
|
||||
startDate = df.format(currentQuarter.getStart());
|
||||
@ -215,4 +233,43 @@ public class CaseScoreController extends AbstractController {
|
||||
LOG.debug("定时请求督查数据结束");
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息推送用
|
||||
* @param sendMap
|
||||
*/
|
||||
public void sendMsgToApp(Map<String, Object> sendMap) {
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
List<String> userIds = new ArrayList<>();
|
||||
for(Map.Entry<String, Object> entry : sendMap.entrySet()) {
|
||||
String mapKey = entry.getKey();
|
||||
userIds.add(mapKey);
|
||||
}
|
||||
Map<String, Object> msgMap = new HashMap<>();
|
||||
msgMap.put("userIds", userIds);
|
||||
msgMap.put("title", "系统消息");
|
||||
msgMap.put("msg","你有未及时检查案件");
|
||||
msgMap.put("target", "uncheck");
|
||||
resultList.add(msgMap);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("noticies", resultList);
|
||||
String sendJson = JSONObject.toJSONString(resultMap);
|
||||
sendMsg(JSONObject.parseObject(sendJson));
|
||||
}
|
||||
|
||||
private void sendMsg(JSONObject jsonObject) {
|
||||
ClientTokenBO token = ClientTokenManager.getInstance().getClientToken();
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String url = partyBuildingProperties.getSendUrl();
|
||||
url += "/resource/message/noticewithtarget";
|
||||
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("access_token", token.getAccessToken());
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
||||
HttpEntity<JSONObject> entity = new HttpEntity<>(jsonObject, headers);
|
||||
ResponseEntity<JSONObject> responseEntity = restTemplate.exchange(builder.build().encode().toUri(), HttpMethod.POST, entity, JSONObject.class);
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -31,6 +32,10 @@ public class CaseScoreDTO {
|
||||
private List<String> closeTimeout;
|
||||
@ApiModelProperty(name = "inspectTimeout", value = "未及时结案案件")
|
||||
private List<String> inspectTimeout;
|
||||
@ApiModelProperty(name = "closePushUserIds", value = "未及时处理案件user集合")
|
||||
private List<Map<String, Object>> closePushUserIds;
|
||||
@ApiModelProperty(name = "inspectPushUserIds", value = "未及时结案案件user集合")
|
||||
private List<Map<String, Object>> inspectPushUserIds;
|
||||
|
||||
public String getAreaId() {
|
||||
return areaId == null ? "" : areaId;
|
||||
@ -93,4 +98,26 @@ public class CaseScoreDTO {
|
||||
public void setInspectTimeout(List<String> inspectTimeout) {
|
||||
this.inspectTimeout = inspectTimeout;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getClosePushUserIds() {
|
||||
if (closePushUserIds == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return closePushUserIds;
|
||||
}
|
||||
|
||||
public void setClosePushUserIds(List<Map<String, Object>> closePushUserIds) {
|
||||
this.closePushUserIds = closePushUserIds;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getInspectPushUserIds() {
|
||||
if (inspectPushUserIds == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return inspectPushUserIds;
|
||||
}
|
||||
|
||||
public void setInspectPushUserIds(List<Map<String, Object>> inspectPushUserIds) {
|
||||
this.inspectPushUserIds = inspectPushUserIds;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
server:
|
||||
port: 8080
|
||||
url: http://192.168.0.120:8080/bigdata
|
||||
port: 8087
|
||||
url: http://192.168.0.111:8087/bigdata
|
||||
title: bigdata
|
||||
servlet:
|
||||
context-path: /bigdata
|
||||
@ -71,11 +71,13 @@ file:
|
||||
# 安全
|
||||
security:
|
||||
oauth2:
|
||||
oauth-server: http://49.233.36.36:8868/usercenter
|
||||
oauth-server: http://192.168.0.103:7001/usercenter
|
||||
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
|
||||
client:
|
||||
client-id: 23ee73bf31b54084b2eb977d58435be0
|
||||
client-secret: dnljSTJGLzdWSjBudTNyV2MxUXNudStsbndpMFpwbHRKRnlzRkFjNTgrVW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
|
||||
# client-id: 23ee73bf31b54084b2eb977d58435be0
|
||||
# client-secret: dnljSTJGLzdWSjBudTNyV2MxUXNudStsbndpMFpwbHRKRnlzRkFjNTgrVW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
|
||||
client-id: 26c7aaa37d0f4137a0b4d3bd696d2afd
|
||||
client-secret: QWZXc0kvVzd2eXlaMXRYdUFlUVFUb2x4K1Y3Um1jNnFQSklZSkNFZ3lXQW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
|
||||
user-authorization-uri: ${security.oauth2.oauth-server}/oauth_client/authorize
|
||||
access-token-uri: ${security.oauth2.oauth-server}/oauth_client/token
|
||||
grant-type: authorization_code
|
||||
@ -125,13 +127,15 @@ server-other:
|
||||
port: 8085
|
||||
|
||||
titile: 党建
|
||||
servicecity-url: http://192.168.0.111:8084/servicecity
|
||||
# servicecity-url: http://192.168.0.111:8084/servicecity
|
||||
servicecity-url: http://192.168.0.109:8083/servicecity
|
||||
party-url: http://192.168.0.111:8085/partybuilding
|
||||
deptassesst-Url: http://192.168.0.111:8084/servicecity
|
||||
#party-url: http://192.168.0.109:8082/partybuilding
|
||||
logo-url: http://192.168.0.111:8085/partybuilding
|
||||
population-url: http://192.168.0.111:8086/population
|
||||
#servicecity-url: http://219.147.99.164:8082/servicecity
|
||||
send-url: http://192.168.0.103:7002/social
|
||||
|
||||
# 考核相关配置
|
||||
score:
|
||||
|
Loading…
Reference in New Issue
Block a user