Commit 72b41163 by 东州 翁

Merge branch 'develop' of 120.24.24.239:8timerv2/8timerapiv200 into wdz

parents 82e2df48 e22b2a90
...@@ -3,12 +3,9 @@ package cn.timer.api.controller; ...@@ -3,12 +3,9 @@ package cn.timer.api.controller;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
...@@ -16,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -16,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.GetMapping;
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;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -62,82 +58,58 @@ public class LoginController { ...@@ -62,82 +58,58 @@ public class LoginController {
@Value("${config-8timer.register-free-time}") @Value("${config-8timer.register-free-time}")
public Integer offset; // 系统赠送时间 public Integer offset; // 系统赠送时间
@Value("${config-8timer.Aliyun.PROJECT_NAME}") /*
private String PROJECT_NAME; * @Value("${config-8timer.Aliyun.PROJECT_NAME}") private String PROJECT_NAME;
*
@Value("${config-8timer.Aliyun.REGION_ID}") * @Value("${config-8timer.Aliyun.REGION_ID}") private String REGION_ID;
private String REGION_ID; *
* @Value("${config-8timer.Aliyun.ACCESSKEY_ID}") private String ACCESSKEY_ID;
@Value("${config-8timer.Aliyun.ACCESSKEY_ID}") *
private String ACCESSKEY_ID; * @Value("${config-8timer.Aliyun.SECRET}") private String SECRET;
*
@Value("${config-8timer.Aliyun.SECRET}") * public static String host; public static String PROJECT_ID; public static
private String SECRET; * String PROJECT_SECRET;
*
public static String host; * @Value("${config-8timer.esign.host}") private String host_s;
public static String PROJECT_ID; *
public static String PROJECT_SECRET; * @Value("${config-8timer.esign.PROJECT_ID}") private String PROJECT_ID_s;
@Value("${config-8timer.esign.host}") *
private String host_s; * @Value("${config-8timer.esign.PROJECT_SECRET}") private String
@Value("${config-8timer.esign.PROJECT_ID}") * PROJECT_SECRET_s;
private String PROJECT_ID_s; *
@Value("${config-8timer.esign.PROJECT_SECRET}") * @PostConstruct public void init() { host = host_s; PROJECT_ID = PROJECT_ID_s;
private String PROJECT_SECRET_s; * PROJECT_SECRET = PROJECT_SECRET_s; }
*
@PostConstruct * @Value("${config-8timer.Aliyun.PROJECT_NAME}") private String endpoint;
public void init() { *
host = host_s; * @Value("${config-8timer.Aliyun.ACCESSKEY_ID}") private String accessKeyId;
PROJECT_ID = PROJECT_ID_s; *
PROJECT_SECRET = PROJECT_SECRET_s; * @Value("${config-8timer.Aliyun.SECRET}") private String accessKeySecret;
} *
* @Value("${config-8timer.Aliyun.bucketName}") private String bucketName;
@Value("${config-8timer.Aliyun.PROJECT_NAME}") *
private String endpoint; * @Value("${config-8timer.Aliyun.bucketName_pri}") private String
* bucketName_pri;
@Value("${config-8timer.Aliyun.ACCESSKEY_ID}") *
private String accessKeyId; * @Value("${config-8timer.Aliyun.project_package}") private String
* project_package;
@Value("${config-8timer.Aliyun.SECRET}") *
private String accessKeySecret; * @Value("${config-8timer.Aliyun.expirationTime}") private String
* expirationTime;
@Value("${config-8timer.Aliyun.bucketName}") *
private String bucketName; * @Value("${config-8timer.Aliyun.expirationTime_pri}") private String
* expirationTime_pri;
@Value("${config-8timer.Aliyun.bucketName_pri}") *
private String bucketName_pri; * @GetMapping(value = "/test") public Map<String, Object> test() { Map<String,
* Object> map = new HashMap<String, Object>(); map.put("1", offset);
@Value("${config-8timer.Aliyun.project_package}") * map.put("2", PROJECT_NAME); map.put("3", REGION_ID); map.put("4",
private String project_package; * ACCESSKEY_ID); map.put("5", SECRET); map.put("6", host); map.put("7",
* PROJECT_ID); map.put("8", PROJECT_SECRET); map.put("9", endpoint);
@Value("${config-8timer.Aliyun.expirationTime}") * map.put("10", accessKeyId); map.put("11", accessKeySecret); map.put("12",
private String expirationTime; * bucketName); map.put("13", bucketName_pri); map.put("14", project_package);
* map.put("15", expirationTime); map.put("16", expirationTime_pri); return map;
@Value("${config-8timer.Aliyun.expirationTime_pri}") * }
private String expirationTime_pri; */
@GetMapping(value = "/test")
public Map<String, Object> test() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("1", offset);
map.put("2", PROJECT_NAME);
map.put("3", REGION_ID);
map.put("4", ACCESSKEY_ID);
map.put("5", SECRET);
map.put("6", host);
map.put("7", PROJECT_ID);
map.put("8", PROJECT_SECRET);
map.put("9", endpoint);
map.put("10", accessKeyId);
map.put("11", accessKeySecret);
map.put("12", bucketName);
map.put("13", bucketName_pri);
map.put("14", project_package);
map.put("15", expirationTime);
map.put("16", expirationTime_pri);
return map;
}
@Autowired @Autowired
private HttpSession session; private HttpSession session;
...@@ -148,6 +120,9 @@ public class LoginController { ...@@ -148,6 +120,9 @@ public class LoginController {
@Autowired @Autowired
private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper; private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper;
@Autowired
private AliyunSMS aliyunSMS;
// @Autowired // @Autowired
// private DataSourceTransactionManager transactionManager; // private DataSourceTransactionManager transactionManager;
...@@ -175,20 +150,20 @@ public class LoginController { ...@@ -175,20 +150,20 @@ public class LoginController {
remainder = quantity.getRemainder(); remainder = quantity.getRemainder();
date = quantity.getExpireDate(); date = quantity.getExpireDate();
} }
if (quantity == null || remainder == null || remainder <= 0) { // 判断充了钱没 if (entRegisterDto.getTc() != 4) { //如果不是注册,则判断套餐余额
return ResultUtil.error("请充值后使用短信功能!"); if (quantity == null || remainder == null || remainder <= 0) { // 判断充了钱没
} return ResultUtil.error("请充值后使用短信功能!");
if (date != null && date.getTime() <= new Date().getTime()) { }
System.err.println("企业 " + orgCode + " :短信套餐已过期"); if (date != null && date.getTime() <= new Date().getTime()) {
return ResultUtil.error("短信套餐已到期!"); System.err.println("企业 " + orgCode + " :短信套餐已过期");
return ResultUtil.error("短信套餐已到期!");
}
} }
// 6位随机数验证码 // 6位随机数验证码
try { try {
Integer code = (int) ((Math.random() * 9 + 1) * 100000); Integer code = (int) ((Math.random() * 9 + 1) * 100000);
AliyunSMS aliyunSMS = new AliyunSMS();
if (phone == null || "".equals(phone)) { if (phone == null || "".equals(phone)) {
phone = entRegisterDto.getUsername(); phone = entRegisterDto.getUsername();
entRegisterDto.setPhone(phone); entRegisterDto.setPhone(phone);
...@@ -202,13 +177,13 @@ public class LoginController { ...@@ -202,13 +177,13 @@ public class LoginController {
Thread.sleep(1000); Thread.sleep(1000);
JSONObject jsonObject = (JSONObject) JSONObject JSONObject jsonObject = (JSONObject) JSONObject
.parseObject(new AliyunSMS().QuerySendDetails(phone, today, j.getString("BizId"))) .parseObject(aliyunSMS.QuerySendDetails(phone, today, j.getString("BizId")))
.getJSONObject("SmsSendDetailDTOs").getJSONArray("SmsSendDetailDTO").get(0); .getJSONObject("SmsSendDetailDTOs").getJSONArray("SmsSendDetailDTO").get(0);
String templateCode = jsonObject.getString("TemplateCode");
String phoneNum = jsonObject.getString("PhoneNum"); String phoneNum = jsonObject.getString("PhoneNum");
String content = jsonObject.getString("Content"); String content = jsonObject.getString("Content");
String sendStatus = jsonObject.getString("SendStatus"); // String templateCode = jsonObject.getString("TemplateCode");
String sendDate = jsonObject.getString("SendDate"); // String sendStatus = jsonObject.getString("SendStatus");
// String sendDate = jsonObject.getString("SendDate");
QyzxSms qyzxSms = new QyzxSms(); QyzxSms qyzxSms = new QyzxSms();
qyzxSms.setContent(content); qyzxSms.setContent(content);
......
package cn.timer.api.controller.dzht; package cn.timer.api.controller.dzht;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -234,21 +235,20 @@ public class DzhtController { ...@@ -234,21 +235,20 @@ public class DzhtController {
list.add(map13); list.add(map13);
return ResultUtil.data(list); return ResultUtil.data(list);
} }
public static String savePath() { public static String savePath() {
String savePath = null; String savePath = null;
String name = System.getProperty("os.name"); String name = System.getProperty("os.name");
if (name.startsWith("Windows")) { if (name.startsWith("Windows")) {
savePath = "E:\\esignTemplate"; // Windows本地服务器文件保存路径包 savePath = "E:\\esignTemplate"; // Windows本地服务器文件保存路径包
}else if(name.startsWith("Linux")){ } else if (name.startsWith("Linux")) {
savePath = "esignTemplate"; // Linux远程服务器文件保存路径包 savePath = "esignTemplate"; // Linux远程服务器文件保存路径包
}else { } else {
savePath = "esignTemplate"; // 其他服务器文件保存路径包 savePath = "esignTemplate"; // 其他服务器文件保存路径包
} }
return savePath; return savePath;
} }
final static String APP_ID = ConfigConstant.PROJECT_ID;// 项目id final static String APP_ID = ConfigConstant.PROJECT_ID;// 项目id
final static String APP_SECRET = ConfigConstant.PROJECT_SECRET;// 项目密码 final static String APP_SECRET = ConfigConstant.PROJECT_SECRET;// 项目密码
// final static String RE_TOKEN = "8b58973c290cc848b67ff0017cd424ff"; // final static String RE_TOKEN = "8b58973c290cc848b67ff0017cd424ff";
...@@ -335,8 +335,8 @@ public class DzhtController { ...@@ -335,8 +335,8 @@ public class DzhtController {
public Result<Object> rzUserNow(@CurrentUser UserBean userBean, Integer empNum) { public Result<Object> rzUserNow(@CurrentUser UserBean userBean, Integer empNum) {
DzhtAssoGrrz grrz = new DzhtAssoGrrz(); DzhtAssoGrrz grrz = new DzhtAssoGrrz();
grrz.setType(0); grrz.setType(0);
YgglMainEmp yg = YgglMainEmp.builder().build() YgglMainEmp yg = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().select("phone")
.selectOne(new QueryWrapper<YgglMainEmp>().select("phone").eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum)); .eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
grrz.setMobileNo(yg.getPhone()); grrz.setMobileNo(yg.getPhone());
DzhtAssoGrzc grzc = DzhtAssoGrzc.builder().build().selectOne(new QueryWrapper<DzhtAssoGrzc>() DzhtAssoGrzc grzc = DzhtAssoGrzc.builder().build().selectOne(new QueryWrapper<DzhtAssoGrzc>()
...@@ -661,12 +661,28 @@ public class DzhtController { ...@@ -661,12 +661,28 @@ public class DzhtController {
if (code.equals("0") && j.get("errCode").toString().equals("0")) { if (code.equals("0") && j.get("errCode").toString().equals("0")) {
htmb.insert(); htmb.insert();
File file = new File(filePath);
boolean delete = file.delete();
System.err.println(delete);
return ResultUtil.data(a); return ResultUtil.data(a);
} else { } else {
return ResultUtil.data(a, "创建失败"); return ResultUtil.data(a, "创建失败");
} }
} }
// public static void main(String[] args) throws Exception {
// String ossUrl = "https://8time-v2.oss-cn-shenzhen.aliyuncs.com/8timer2.0/117/test/7001.jpg";
// String fileName = System.currentTimeMillis() + UUID.randomUUID().toString()
// + ossUrl.substring(ossUrl.lastIndexOf("."));
// String filePath = FileHelper.downLoadFromUrl(ossUrl, fileName, savePath());
// System.err.println(filePath);
// File file = new File(filePath);
// Thread.sleep(2000);
// System.err.println(file.delete());
// }
// 通过模板创建文件 // 通过模板创建文件
@PostMapping("/createByTemplate") @PostMapping("/createByTemplate")
@ApiOperation(value = "创建文件", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "创建文件", httpMethod = "POST", notes = "接口发布说明")
...@@ -694,7 +710,7 @@ public class DzhtController { ...@@ -694,7 +710,7 @@ public class DzhtController {
@GetMapping("/queryName") @GetMapping("/queryName")
@ApiOperation(value = "查名字", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "查名字", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getName(@RequestParam(required = false)Integer empNum) { public Result<Object> getName(@RequestParam(required = false) Integer empNum) {
String name = QueryUtil.queryEmpName(empNum); String name = QueryUtil.queryEmpName(empNum);
Map<String, String> map = QueryUtil.queryVersionName(); Map<String, String> map = QueryUtil.queryVersionName();
return ResultUtil.datas(map, name, "查询成功"); return ResultUtil.datas(map, name, "查询成功");
......
...@@ -34,8 +34,6 @@ public class OSSController { ...@@ -34,8 +34,6 @@ public class OSSController {
* *
* @param userBean * @param userBean
* @param moudle * @param moudle
*
* @param moudle
*/ */
@PostMapping(value = "/upload") @PostMapping(value = "/upload")
@ApiOperation(value = "上传普通文件", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "上传普通文件", httpMethod = "POST", notes = "接口发布说明")
......
...@@ -11,6 +11,7 @@ import java.util.ArrayList; ...@@ -11,6 +11,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import javax.transaction.Transactional; import javax.transaction.Transactional;
...@@ -78,30 +79,21 @@ public class QyzxBusinessController { ...@@ -78,30 +79,21 @@ public class QyzxBusinessController {
.selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>().eq(QyzxRemainingQuantity::getIsDelete, 0) .selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>().eq(QyzxRemainingQuantity::getIsDelete, 0)
.eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode()) .eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode())
.eq(QyzxRemainingQuantity::getPmid, 1).select(QyzxRemainingQuantity::getRemainder)); .eq(QyzxRemainingQuantity::getPmid, 1).select(QyzxRemainingQuantity::getRemainder));
Integer remainder1 = null; Integer sum1 = qyzxRemainingQuantitys1.stream()
for (QyzxRemainingQuantity qyzxRemainingQuantity : qyzxRemainingQuantitys1) { .collect(Collectors.summingInt(QyzxRemainingQuantity::getRemainder));
remainder1 = qyzxRemainingQuantity.getRemainder();
if (qyzxRemainingQuantitys1.size() > 1) {
remainder1 += remainder1;
}
}
List<QyzxRemainingQuantity> qyzxRemainingQuantitys2 = QyzxRemainingQuantity.builder().build() List<QyzxRemainingQuantity> qyzxRemainingQuantitys2 = QyzxRemainingQuantity.builder().build()
.selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>().eq(QyzxRemainingQuantity::getIsDelete, 0) .selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>().eq(QyzxRemainingQuantity::getIsDelete, 0)
.eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode()) .eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode())
.eq(QyzxRemainingQuantity::getPmid, 2).select(QyzxRemainingQuantity::getRemainder)); .eq(QyzxRemainingQuantity::getPmid, 2).select(QyzxRemainingQuantity::getRemainder));
Integer remainder2 = null; Integer sum2 = qyzxRemainingQuantitys2.stream()
for (QyzxRemainingQuantity qyzxRemainingQuantity : qyzxRemainingQuantitys2) { .collect(Collectors.summingInt(QyzxRemainingQuantity::getRemainder));
remainder2 = qyzxRemainingQuantity.getRemainder();
if (qyzxRemainingQuantitys2.size() > 1) {
remainder2 += remainder2;
}
}
Map<String, Object> map1 = new HashMap<String, Object>(); Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("message", remainder1); map1.put("message", sum1);
Map<String, Object> map2 = new HashMap<String, Object>(); Map<String, Object> map2 = new HashMap<String, Object>();
map2.put("contract", remainder2); map2.put("contract", sum2);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
list.add(map1); list.add(map1);
...@@ -114,8 +106,9 @@ public class QyzxBusinessController { ...@@ -114,8 +106,9 @@ public class QyzxBusinessController {
public Result<List<QyzxPayContent>> getPayListwithContract(@CurrentUser UserBean userBean) { public Result<List<QyzxPayContent>> getPayListwithContract(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list = QyzxPayContent.builder().build() List<QyzxPayContent> list = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 1).select( .selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 1).select(
QyzxPayContent::getContent, QyzxPayContent::getNowPrice, QyzxPayContent::getOriginalPrice, QyzxPayContent::getId, QyzxPayContent::getContent, QyzxPayContent::getNowPrice,
QyzxPayContent::getSpecification, QyzxPayContent::getExpiration)); QyzxPayContent::getOriginalPrice, QyzxPayContent::getSpecification,
QyzxPayContent::getExpiration));
return ResultUtil.data(list, "获取成功"); return ResultUtil.data(list, "获取成功");
} }
...@@ -124,8 +117,9 @@ public class QyzxBusinessController { ...@@ -124,8 +117,9 @@ public class QyzxBusinessController {
public Result<List<QyzxPayContent>> getPayListWithMsg(@CurrentUser UserBean userBean) { public Result<List<QyzxPayContent>> getPayListWithMsg(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list = QyzxPayContent.builder().build() List<QyzxPayContent> list = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 2).select( .selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 2).select(
QyzxPayContent::getContent, QyzxPayContent::getNowPrice, QyzxPayContent::getOriginalPrice, QyzxPayContent::getId, QyzxPayContent::getContent, QyzxPayContent::getNowPrice,
QyzxPayContent::getSpecification, QyzxPayContent::getExpiration)); QyzxPayContent::getOriginalPrice, QyzxPayContent::getSpecification,
QyzxPayContent::getExpiration));
return ResultUtil.data(list, "获取成功"); return ResultUtil.data(list, "获取成功");
} }
...@@ -134,8 +128,9 @@ public class QyzxBusinessController { ...@@ -134,8 +128,9 @@ public class QyzxBusinessController {
public Result<List<QyzxPayContent>> getPayListWithSystem(@CurrentUser UserBean userBean) { public Result<List<QyzxPayContent>> getPayListWithSystem(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list = QyzxPayContent.builder().build() List<QyzxPayContent> list = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 3).select( .selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 3).select(
QyzxPayContent::getContent, QyzxPayContent::getNowPrice, QyzxPayContent::getOriginalPrice, QyzxPayContent::getId, QyzxPayContent::getContent, QyzxPayContent::getNowPrice,
QyzxPayContent::getSpecification, QyzxPayContent::getExpiration)); QyzxPayContent::getOriginalPrice, QyzxPayContent::getSpecification,
QyzxPayContent::getExpiration));
return ResultUtil.data(list, "获取成功"); return ResultUtil.data(list, "获取成功");
} }
......
...@@ -3,6 +3,7 @@ package cn.timer.api.utils.aliyun; ...@@ -3,6 +3,7 @@ package cn.timer.api.utils.aliyun;
import java.util.Date; import java.util.Date;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -32,20 +33,21 @@ import cn.timer.api.dto.qyzx.EntRegisterDto; ...@@ -32,20 +33,21 @@ import cn.timer.api.dto.qyzx.EntRegisterDto;
* *
*/ */
@Transactional @Transactional
@Component
public class AliyunSMS { public class AliyunSMS {
@Value("${config-8timer.Aliyun.PROJECT_NAME}") @Value("${config-8timer.Aliyun.PROJECT_NAME}")
private String PROJECT_NAME; public String PROJECT_NAME;
@Value("${config-8timer.Aliyun.REGION_ID}") @Value("${config-8timer.Aliyun.REGION_ID}")
private String REGION_ID; public String REGION_ID;
@Value("${config-8timer.Aliyun.ACCESSKEY_ID}") @Value("${config-8timer.Aliyun.ACCESSKEY_ID}")
private String ACCESSKEY_ID; public String ACCESSKEY_ID;
@Value("${config-8timer.Aliyun.SECRET}") @Value("${config-8timer.Aliyun.SECRET}")
private String SECRET; public String SECRET;
final static String CODE_NAME = "TemplateCode";// 短信模板代码参数名 final static String CODE_NAME = "TemplateCode";// 短信模板代码参数名
final static String TEMPLATE_PARAM = "TemplateParam";// 自定义参数 final static String TEMPLATE_PARAM = "TemplateParam";// 自定义参数
final static String DOMAIN = "dysmsapi.aliyuncs.com"; final static String DOMAIN = "dysmsapi.aliyuncs.com";
...@@ -76,13 +78,15 @@ public class AliyunSMS { ...@@ -76,13 +78,15 @@ public class AliyunSMS {
Date date = quantity.getExpireDate(); Date date = quantity.getExpireDate();
String orderNo = quantity.getOrderNo(); String orderNo = quantity.getOrderNo();
if (quantity == null || remainder == null || remainder <= 0) { if (templateCode != 4) {
System.err.println("企业 " + orgCode + " :套餐余额不足,请充钱"); if (quantity == null || remainder == null || remainder <= 0) {
return null; System.err.println("企业 " + orgCode + " :套餐余额不足,请充钱");
} return null;
if (date != null && date.getTime() <= new Date().getTime()) { }
System.err.println("企业 " + orgCode + " :短信套餐已过期"); if (date != null && date.getTime() <= new Date().getTime()) {
return null; System.err.println("企业 " + orgCode + " :短信套餐已过期");
return null;
}
} }
QyzxUseRecord qyzxUseRecord = new QyzxUseRecord(); QyzxUseRecord qyzxUseRecord = new QyzxUseRecord();
...@@ -143,7 +147,6 @@ public class AliyunSMS { ...@@ -143,7 +147,6 @@ public class AliyunSMS {
} }
if (a != null && a.contains("OK")) { if (a != null && a.contains("OK")) {
qyzxUseRecord.setOriginalTotalNum(remainder); // 原数量 qyzxUseRecord.setOriginalTotalNum(remainder); // 原数量
qyzxUseRecord.setNowTotalNum(--remainder); qyzxUseRecord.setNowTotalNum(--remainder);
qyzxUseRecord.setUserPhone(phone); qyzxUseRecord.setUserPhone(phone);
...@@ -156,7 +159,6 @@ public class AliyunSMS { ...@@ -156,7 +159,6 @@ public class AliyunSMS {
quantity.setRemainder(remainder); quantity.setRemainder(remainder);
quantity.update(new LambdaUpdateWrapper<QyzxRemainingQuantity>() quantity.update(new LambdaUpdateWrapper<QyzxRemainingQuantity>()
.eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getOrderNo, orderNo)); .eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getOrderNo, orderNo));
return JSONObject.parseObject(response.getData());// 代表请求成功 return JSONObject.parseObject(response.getData());// 代表请求成功
} }
...@@ -191,7 +193,6 @@ public class AliyunSMS { ...@@ -191,7 +193,6 @@ public class AliyunSMS {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
System.err.println(a);
if (a != null && a.contains("OK")) { if (a != null && a.contains("OK")) {
return a;// 代表请求成功 return a;// 代表请求成功
} }
...@@ -248,7 +249,6 @@ public class AliyunSMS { ...@@ -248,7 +249,6 @@ public class AliyunSMS {
String a = null; String a = null;
try { try {
CommonResponse response = client.getCommonResponse(request); CommonResponse response = client.getCommonResponse(request);
System.out.println(response.getData());
a = response.getData(); a = response.getData();
......
...@@ -4,6 +4,8 @@ import java.text.SimpleDateFormat; ...@@ -4,6 +4,8 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.annotation.SchedulingConfigurer;
...@@ -28,6 +30,18 @@ import cn.timer.api.utils.aliyun.AliyunSMS; ...@@ -28,6 +30,18 @@ import cn.timer.api.utils.aliyun.AliyunSMS;
@Component @Component
@Lazy(false) @Lazy(false)
public class RemindUtil implements SchedulingConfigurer { public class RemindUtil implements SchedulingConfigurer {
@Autowired
private AliyunSMS sms;
@Value("${config-8timer.remind.one}")
private int one;
@Value("${config-8timer.remind.two}")
private int two;
@Value("${config-8timer.remind.three}")
private int three;
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
static String className = new Exception().getStackTrace()[0].getClassName(); static String className = new Exception().getStackTrace()[0].getClassName();
...@@ -57,9 +71,8 @@ public class RemindUtil implements SchedulingConfigurer { ...@@ -57,9 +71,8 @@ public class RemindUtil implements SchedulingConfigurer {
* 每天固定时间提醒 * 每天固定时间提醒
*/ */
// @Scheduled(cron = "0 0 8 * * ?") // 每天8点扫一下看有没要提醒的,有就发一个 // @Scheduled(cron = "0 0 8 * * ?") // 每天8点扫一下看有没要提醒的,有就发一个
public static String reportCurrentTime() { public String reportCurrentTime() {
AliyunSMS sms = new AliyunSMS();
List<HtzzAssoHtgx> htgxs = HtzzAssoHtgx.builder().build().selectAll(); List<HtzzAssoHtgx> htgxs = HtzzAssoHtgx.builder().build().selectAll();
for (HtzzAssoHtgx htgx : htgxs) { for (HtzzAssoHtgx htgx : htgxs) {
QueryWrapper<HtzzAdminZzda> q = new QueryWrapper<HtzzAdminZzda>(); QueryWrapper<HtzzAdminZzda> q = new QueryWrapper<HtzzAdminZzda>();
...@@ -78,12 +91,12 @@ public class RemindUtil implements SchedulingConfigurer { ...@@ -78,12 +91,12 @@ public class RemindUtil implements SchedulingConfigurer {
if (sjc > 0) { if (sjc > 0) {
if (betweenDay <= 1) { if (betweenDay <= 1) {
sms.remind(name, htname, time, phone); // 少于1天短信提醒 sms.remind(name, htname, time, phone); // 少于1天短信提醒
} else if (betweenDay == 3) { } else if (betweenDay == one) {
sms.remind(name, htname, time, phone); // 少于3天短信提醒 sms.remind(name, htname, time, phone); // 短信提醒1
} else if (betweenDay == 7) { } else if (betweenDay == two) {
sms.remind(name, htname, time, phone); // 少于7天短信提醒 sms.remind(name, htname, time, phone); // 短信提醒2
} else if (betweenDay == 30) { } else if (betweenDay == three) {
sms.remind(name, htname, time, phone); // 少于30天短信提醒 sms.remind(name, htname, time, phone); // 短信提醒3
} }
} else { } else {
zzda.setTxkgType(1); // 关闭提醒 zzda.setTxkgType(1); // 关闭提醒
......
...@@ -152,24 +152,28 @@ logging: ...@@ -152,24 +152,28 @@ logging:
config-8timer: config-8timer:
register-free-time: 90 #系统赠送时间 register-free-time: 90 #系统赠送时间
Aliyun: # 阿里云 Aliyun: # 阿里云
PROJECT_NAME: 8小时人事管家 PROJECT_NAME: 8小时人事管家
REGION_ID: cn-shenzhen REGION_ID: cn-shenzhen
ACCESSKEY_ID: LTAI4FuaShJWQ1dggsFWG5CC ACCESSKEY_ID: LTAI4FuaShJWQ1dggsFWG5CC
SECRET: EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR SECRET: EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR
endpoint: http://oss-cn-shenzhen.aliyuncs.com endpoint: http://oss-cn-shenzhen.aliyuncs.com
# accessKeyId: LTAI4FuaShJWQ1dggsFWG5CC # accessKeyId: LTAI4FuaShJWQ1dggsFWG5CC
# accessKeySecret: EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR # accessKeySecret: EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR
bucketName: 8time-v2 bucketName: 8time-v2
bucketName_pri: 8time-v2-private bucketName_pri: 8time-v2-private
project_package: 8timer2.0/ project_package: 8timer2.0/
expirationTime: 3153600000000L expirationTime: 3153600000000L
expirationTime_pri: 600000L expirationTime_pri: 600000L
esign: # e签宝 esign: # e签宝
host: https://smlopenapi.esign.cn host: https://smlopenapi.esign.cn
# test: https://smlopenapi.esign.cn # test: https://smlopenapi.esign.cn
# pro: https://openapi.esign.cn # pro: https://openapi.esign.cn
PROJECT_ID: 4438775940 PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
remind: #合同提醒时间 默认小于等于1天会提醒+三个配置项
one: 3
two: 7
three: 30
......
...@@ -139,6 +139,10 @@ config-8timer: ...@@ -139,6 +139,10 @@ config-8timer:
expirationTime: 3153600000000L expirationTime: 3153600000000L
expirationTime_pri: 600000L expirationTime_pri: 600000L
esign: # e签宝 esign: # e签宝
host: https://openapi.esign.cn host: https://openapi.esign.cn
PROJECT_ID: 4438775940 PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
\ No newline at end of file remind: #合同提醒时间 默认小于等于1天会提醒+三个配置项
one: 3
two: 7
three: 30
\ No newline at end of file
...@@ -139,6 +139,10 @@ config-8timer: ...@@ -139,6 +139,10 @@ config-8timer:
expirationTime: 3153600000000L expirationTime: 3153600000000L
expirationTime_pri: 600000L expirationTime_pri: 600000L
esign: # e签宝 esign: # e签宝
host: https://smlopenapi.esign.cn host: https://smlopenapi.esign.cn
PROJECT_ID: 4438775940 PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
\ No newline at end of file remind: #合同提醒时间 默认小于等于1天会提醒+三个配置项
one: 3
two: 7
three: 30
\ No newline at end of file
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