Commit 6fd55a6f by dupengfei

侦查指令 新增发送短信功能

parent af4031e0
......@@ -26,32 +26,6 @@
</properties>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
......
package com.founder.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.AsyncRestTemplate;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
/*
* @Description TODO
* @Author du_pengfei
* @Date 2022/5/18
* @Version 1.0
*/
@Configuration
public class RestConfig {
@Bean
public AsyncRestTemplate restTemplate(){
AsyncRestTemplate restTemplate = new AsyncRestTemplate();
restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));
return restTemplate;
}
}
......@@ -10,7 +10,8 @@ import com.founder.util.MessageService;
import jxl.Workbook;
import jxl.write.*;
import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
......
......@@ -1947,6 +1947,7 @@ public class ZczlController {
usersIdentitycard.add(llys.get(i).getSfzh());
}
messageService.sendMessage(usersIdentitycard,user.getIdentitycard(),xxnr,zczlXX.getZczlbh(),"000000");
zczlService.sendSms(usersIdentitycard, xxnr, user.getPolicemanid());
}
}
if(bool){
......@@ -2052,23 +2053,28 @@ public class ZczlController {
String qqfqrgmsfhm = zczlxx.getQqfqrgmsfhm();//请求发起人公民身份证号码
String sfqqzl = zczlxx.getSfqqzl();//是否请求发起人指令
String xxnr = "";
String smsXxnr = "";
if(zlfqrgmsfhm.equals(fprgmsfhm)){//指令发起人和分派人是同一个人------我发起的或者我请求发起的
if("1".equals(sfqqzl)){//我请求发起的
pjUrl ="<a href='"+zczlUrl+"/toHbDetail?sfwfzdzczl=1&sfqqfbzl=1&zczlbh="+zczlxx.getZczlbh()+"' target=\"_blank\"><font style=\"color:#00f!important\">查看并评价</font></a>" ;
xxnr = "北京时间"+nowDate+","+fpxx.getQsrdwmc()+"的"+fpxx.getQsrxm()+"已对您申请发布的指令文号为"+zczlxx.getZlwh()+"的侦查指令进行"+tempStr+",请注意"+pjUrl;
smsXxnr = "北京时间"+nowDate+","+fpxx.getQsrdwmc()+"的"+fpxx.getQsrxm()+"已对您申请发布的指令文号为"+zczlxx.getZlwh()+"的侦查指令进行"+tempStr;
usersIdentitycard.add(qqfqrgmsfhm);
}else{//我发起的
pjUrl ="<a href='"+zczlUrl+"/toHbDetail?sfwfzdzczl=1&sfqqfbzl=0&zczlbh="+zczlxx.getZczlbh()+"'target=\"_blank\"><font style=\"color:#00f!important\">查看并评价</font></a>" ;
xxnr = "北京时间"+nowDate+","+fpxx.getQsrdwmc()+"的"+fpxx.getQsrxm()+"已对指令文号为"+zczlxx.getZlwh()+"的侦查指令进行"+tempStr+",请注意"+pjUrl;
smsXxnr = "北京时间"+nowDate+","+fpxx.getQsrdwmc()+"的"+fpxx.getQsrxm()+"已对指令文号为"+zczlxx.getZlwh()+"的侦查指令进行"+tempStr;
usersIdentitycard.add(fprgmsfhm);
}
}else{//指令发起人和分派人不是同一个人,证明需要在我负责的侦查指令中查看详情
pjUrl ="<a href='"+zczlUrl+"/toHbDetail?sfwfzdzczl=1&zczlbh="+zczlxx.getZczlbh()+"' target=\"_blank\"><font style=\"color:#00f!important\">查看并评价</font></a>" ;
xxnr = "北京时间"+nowDate+","+fpxx.getQsrdwmc()+"的"+fpxx.getQsrxm()+"已对指令文号为"+zczlxx.getZlwh()+"的侦查指令进行"+tempStr+",请注意"+pjUrl;
smsXxnr = "北京时间"+nowDate+","+fpxx.getQsrdwmc()+"的"+fpxx.getQsrxm()+"已对指令文号为"+zczlxx.getZlwh()+"的侦查指令进行"+tempStr;
usersIdentitycard.add(fprgmsfhm);
}
messageService.sendMessage(usersIdentitycard,user.getIdentitycard(),xxnr,zczlxx.getZczlbh(),"020500");
//2021.01.29 新增回报新增积分功能
zczlService.sendSms(usersIdentitycard, smsXxnr, user.getPolicemanid());
if("0".equals(sfxb)){
//首次回报新增积分
String grade = zczlService.getJfGzByType();
......@@ -2356,6 +2362,7 @@ public class ZczlController {
}
messageService.sendMessage(usersIdentitycard,user.getIdentitycard(),xxnr,zczlXX.getZczlbh(),"000000");
zczlService.sendSms(usersIdentitycard, xxnr, user.getPolicemanid());
//对接移动警务app 分派后给联络员警务终端发送消息
RestTemplate restTemplate = new RestTemplate();
String join = String.join(",", usersPolicemanId);
......@@ -2542,6 +2549,7 @@ public class ZczlController {
usersIdentitycard.add(fpxx.getQsrgmsfhm());
messageService.sendMessage(usersIdentitycard,user.getIdentitycard(),xxnr,zczlxx.getZczlbh(),"020500");
zczlService.sendSms(usersIdentitycard, xxnr, xxnr);
}else{
flag = "0";
}
......
......@@ -145,6 +145,10 @@ public interface ZczlDao {
User getUserByUser(User u);
String getUserById(String id);
String getUserByJh(String id);
void updateQsxxByMapForYj(Map map);
void updateFpxxByMapForYj(Map map);
......
......@@ -151,4 +151,6 @@ public interface IZczlService {
String getJfGzByType();
void insertUserGrade(TbYwJfls tbYwJfls);
void sendSms(List<String> lxdhs, String content, String senderId);
}
package com.founder.zczl.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.founder.model.*;
import com.founder.redis.dao.IDictitemDao;
import com.founder.seq.dao.AutoSeqDao;
......@@ -11,10 +12,15 @@ import com.founder.zczl.dao.ZczlDao;
import com.founder.zczl.service.IZczlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.util.concurrent.FailureCallback;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureCallback;
import org.springframework.util.concurrent.SuccessCallback;
import org.springframework.web.client.AsyncRestOperations;
import org.springframework.web.client.AsyncRestTemplate;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
......@@ -46,6 +52,14 @@ public class ZczlService implements IZczlService {
IDictitemDao dictitemDao;
@Autowired
AsyncRestTemplate template;
@Value("${xzeqUrl}")
private String xzeqUrl;
/**
......@@ -873,6 +887,12 @@ public class ZczlService implements IZczlService {
}
}
bool = true;
if (tbYwZczl.getZdsprjh() != null && !"".equals(tbYwZczl.getZdsprjh())){
ArrayList<String> usersId = new ArrayList<>();
String id = zczlDao.getUserByJh(tbYwZczl.getZdsprjh());
usersId.add(id);
sendSms(usersId, "您有一条侦查指令需要审批, 请尽快审批", user.getPolicemanid());
}
} catch (Exception e) {
throw new BaseException("新增侦查指令信息出错!",e);
}
......@@ -1941,4 +1961,48 @@ public class ZczlService implements IZczlService {
}
//审批权限查询与设置--end
//发短信
@Override
public void sendSms(List<String> ids, String content, String senderId){
for (String id : ids ){
String lxdh = zczlDao.getUserById(id);
Map<String, Object> params = new HashMap<>();
List<Map> list = new ArrayList<>();
Map<String, String> item = new HashMap<>();
item.put("to", lxdh);
list.add(item);
params.put("items", list);
//消息内容
params.put("content", content);
//消息类型
params.put("msgType", "sms");
//功能名称
params.put("functionName", "侦查指令");
//发送人警号
params.put("senderPoliceId", senderId);
params.put("systemName", "刑侦综合应用系统");
String body = JSONObject.toJSONString(params);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
ListenableFuture<ResponseEntity<String>> exchange = template.exchange(xzeqUrl + "/seedMessage/mass", HttpMethod.POST, entity, String.class);
exchange.addCallback(new ListenableFutureCallback<ResponseEntity<String>>() {
@Override
public void onFailure(Throwable throwable) {
System.out.println("接口调用失败: "+ throwable.getMessage());
}
@Override
public void onSuccess(ResponseEntity<String> stringResponseEntity) {
System.out.println("接口调用成功: " + stringResponseEntity.getBody());
}
});
}
}
}
......@@ -8,27 +8,28 @@ logging.level.com.founder = debug
logging.level.org.springframework=info
logging.level.org.spring.springboot.dao=debug
#redis config
# REDIS (RedisProperties)
# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
spring.redis.database=0
# Redis\u670D\u52A1\u5668\u5730\u5740
spring.redis.host=47.92.225.109
spring.redis.host=47.92.223.200
# Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3
spring.redis.port=3001
spring.redis.port=7779
# Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09
spring.redis.password=123
spring.redis.password=p!ssw0rd1
# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
spring.redis.pool.max-active=8
spring.redis.jedis.pool.max-active=8
# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
spring.redis.pool.max-wait=-1
spring.redis.jedis.pool.max-wait=-1
# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5
spring.redis.pool.max-idle=8
spring.redis.jedis.pool.max-idle=8
# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5
spring.redis.pool.min-idle=5
spring.redis.jedis.pool.min-idle=5
# \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09
ssdw=
ssdw=150000000000
zhyyPath=http://zhyy.xzxt.nm:7001
spring.jmx.enabled= false
......
spring.datasource.url=jdbc:oracle:thin:@47.92.129.99:1600:ORCL
spring.datasource.url=jdbc:oracle:thin:@10.100.17.120:1521:XZXT
spring.datasource.username=XZXT
spring.datasource.password=XZXT
spring.datasource.password=XzxtPwd#15
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
logging.level.com.founder = debug
logging.level.org.springframework=info
logging.level.org.spring.springboot.dao=debug
#redis config
#\u65B0\u7586
#spring.redis.host=192.168.0.109
#\u5185\u8499
redis.host=10.100.17.124
spring.redis.host=10.100.17.124
spring.redis.port=9379
spring.redis.password=bjhlxt@2020
......@@ -19,15 +16,15 @@ spring.jmx.enabled= false
#Ȩ����Ŀ��¼��ַ
qxUrl=http://qx.xzxt.nm:9044
domain=.xzxt.nm
zhyyPath=http://zhyy.xzxt.nm:7001
ssdw=430000000000
zhyyPath=http://zhyy.xzxt.nm
ssdw=150000000000
#���ָ���Լ���ַ
zczlUrl=http://localhost:9046
zczlUrl=http://10.100.17.125:9046
#���������������ް汾
hddrUrl=http://65.65.100.192:8004
#��������ַ
asjxxzbUrl=http://192.168.0.105:9100
xzeqUrl=http://192.168.0.105:9100
xzeqUrl=http://26.3.13.120:8501
#--------------对接蓝信移动警务app------#
#appid
......
......@@ -1708,6 +1708,15 @@
</select>
<select id="getUserById" resultType="java.lang.String">
select TELEPHONE from sys_user where SCBZ='0' and OPEN_FLAG='1' and IDENTITYCARD = #{id, jdbcType=VARCHAR}
</select>
<select id="getUserByJh" resultType="java.lang.String">
select IDENTITYCARD from sys_user where SCBZ='0' and OPEN_FLAG='1' and POLICEMANID = #{id, jdbcType=VARCHAR}
</select>
<!-- 更新我签收的指令-用于移交 -->
<update id="updateQsxxByMapForYj" parameterType="java.util.Map" >
update TB_YW_ZCZL_FP
......
package com.founder;
import com.alibaba.fastjson.JSONObject;
import com.founder.model.TbYwZczlLly;
import com.founder.zczl.dao.ZczlDao;
import org.junit.Test;
......@@ -13,7 +14,9 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RunWith(SpringRunner.class)
@SpringBootTest
......
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