Commit 7670d9c9 by dengshichuan

Merge branch 'dsc' into 'develop'

Dsc

See merge request 8timerv2/8timerapiv200!52
parents 5ddb80b6 77d390ba
......@@ -26,6 +26,7 @@ import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.bean.qyzx.businessService.QyzxBuyRecord;
import cn.timer.api.bean.qyzx.businessService.QyzxOrderRecord;
import cn.timer.api.bean.qyzx.businessService.QyzxRemainingQuantity;
......@@ -81,10 +82,10 @@ public class WxCallBackController {
if (!env.equals("dev") && !env.equals("test")) {
return ResultUtil.error("请切换到开发/测试环境");
}
// TODO 加套餐 如果已经存在可用的套餐 ,怎么搞
// TODO 加套餐 如果已经存在可用的套餐 ,怎么搞
// TODO 如果是系统续费 update企业信息表
updateAndInsert(orderNo);
return ResultUtil.data(orderNo, "购买成功");
}
......@@ -102,7 +103,7 @@ public class WxCallBackController {
Integer expiration = jsonObject.getInt("expiration"); // 商品有效期(天)
Date expireDate = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, expiration); // 时间偏移
String content = jsonObject.getStr("content"); // 商品名称
Integer specification = jsonObject.getInt("specification"); // 商品规格
Integer specification = jsonObject.getInt("specification"); // 商品规格-用于系统续费表示为系统版本0-试用 1-普通 2-专业
String unit = jsonObject.getStr("unit");
// Double originalPrice = jsonObject.getDouble("originalPrice"); // 商品原价
Double nowPrice = jsonObject.getDouble("nowPrice"); // 购买价
......@@ -111,23 +112,32 @@ public class WxCallBackController {
Integer pcid = qyzxOrderRecord.getPcid(); // 付费内容id
Integer createdUser = qyzxOrderRecord.getCreateUser(); // 订单创建人
Integer orgCode = qyzxOrderRecord.getOrgCode(); // 公司
QyzxRemainingQuantity quantity = new QyzxRemainingQuantity();
quantity.setOrderNo(orderNo); // 订单号
quantity.setContent(content); // 商品名称
quantity.setExpireDate(expireDate); // 到期时间
quantity.setSpecification(specification); // 套餐规格
Integer totalNum = specification * count; // 套餐总量
quantity.setTotalNum(totalNum);
quantity.setRemainder(totalNum); // 套餐剩余数(同上)
quantity.setCount(count); // 购买数量
quantity.setPmid(pmid); // 付费模块id
quantity.setPcid(pcid); // 付费内容id
quantity.setUnit(unit);
quantity.setCreateUser(createdUser);
quantity.setOrgCode(orgCode);
quantity.insert();
if (pmid == 3) {
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(orgCode).build().selectById(); // 企业信息
Date endTime = qyzxEntInfoM.getEndTime(); // 当前到期时间
// Integer level = qyzxEntInfoM.getLevel(); // 原系统版本
// Integer specification = jsonObject.getInt("specification"); // 新系统版本
Date newEndTime = DateUtil.offsetDay(endTime, expiration*count); // 到期时间+商品有效期x购买数量=系统续费后的时间
qyzxEntInfoM.update(new LambdaUpdateWrapper<QyzxEntInfoM>().eq(QyzxEntInfoM::getId, orgCode)
.set(QyzxEntInfoM::getEndTime, newEndTime).set(QyzxEntInfoM::getLevel, specification));
} else {
QyzxRemainingQuantity quantity = new QyzxRemainingQuantity();
quantity.setOrderNo(orderNo); // 订单号
quantity.setContent(content); // 商品名称
quantity.setExpireDate(expireDate); // 到期时间
quantity.setSpecification(specification); // 套餐规格
quantity.setTotalNum(totalNum); // 套餐总量
quantity.setRemainder(totalNum); // 套餐剩余数(同上)
quantity.setCount(count); // 购买数量
quantity.setPmid(pmid); // 付费模块id
quantity.setPcid(pcid); // 付费内容id
quantity.setUnit(unit);
quantity.setCreateUser(createdUser);
quantity.setOrgCode(orgCode);
quantity.insert();
}
// 插入购买记录表
QyzxBuyRecord qyzxBuyRecord = new QyzxBuyRecord();
qyzxBuyRecord.setSpecification(specification);
......
......@@ -3,9 +3,12 @@ package cn.timer.api.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
......@@ -24,7 +27,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
......@@ -57,8 +59,85 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping(value = "/login", produces = { "application/json" })
public class LoginController {
@Value("${configtest.patht}")
public String port;
@Value("${config-8timer.register-free-time}")
public Integer offset; // 系统赠送时间
@Value("${config-8timer.Aliyun.PROJECT_NAME}")
private String PROJECT_NAME;
@Value("${config-8timer.Aliyun.REGION_ID}")
private String REGION_ID;
@Value("${config-8timer.Aliyun.ACCESSKEY_ID}")
private String ACCESSKEY_ID;
@Value("${config-8timer.Aliyun.SECRET}")
private String SECRET;
public static String host;
public static String PROJECT_ID;
public static String PROJECT_SECRET;
@Value("${config-8timer.esign.host}")
private String host_s;
@Value("${config-8timer.esign.PROJECT_ID}")
private String PROJECT_ID_s;
@Value("${config-8timer.esign.PROJECT_SECRET}")
private String PROJECT_SECRET_s;
@PostConstruct
public void init() {
host = host_s;
PROJECT_ID = PROJECT_ID_s;
PROJECT_SECRET = PROJECT_SECRET_s;
}
@Value("${config-8timer.Aliyun.PROJECT_NAME}")
private String endpoint;
@Value("${config-8timer.Aliyun.ACCESSKEY_ID}")
private String accessKeyId;
@Value("${config-8timer.Aliyun.SECRET}")
private String accessKeySecret;
@Value("${config-8timer.Aliyun.bucketName}")
private String bucketName;
@Value("${config-8timer.Aliyun.bucketName_pri}")
private String bucketName_pri;
@Value("${config-8timer.Aliyun.project_package}")
private String project_package;
@Value("${config-8timer.Aliyun.expirationTime}")
private String expirationTime;
@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
private HttpSession session;
......@@ -72,12 +151,6 @@ public class LoginController {
// @Autowired
// private DataSourceTransactionManager transactionManager;
@GetMapping(value = "/testPro")
public Result<String> testPro() {
System.out.print(port);
return ResultUtil.success("configtest:" + port);
}
/**
* 发送验证码
*
......@@ -381,7 +454,9 @@ public class LoginController {
}
// 企业信息
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().name(name).registerTime(DateUtil.date()).endTime(DateUtil.nextMonth()).level(CommonEnum.LEVEL_PROBATION.getType()).build();
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().name(name).registerTime(DateUtil.date())
.endTime(DateUtil.offsetDay(new Date(), offset)).level(CommonEnum.LEVEL_PROBATION.getType())
.build();
boolean b1 = qyzxEntInfoM.insert();
if (!b1) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
......@@ -397,7 +472,8 @@ public class LoginController {
* DateUtil.date()) .endTime(DateUtil.nextMonth()).build();
*/
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pw))
.sts(CommonEnum.U_STS_ON.getType()).orgId(qyzxEntInfoM.getId()).regTime(DateUtil.date()).build();
.sts(CommonEnum.U_STS_ON.getType()).orgId(qyzxEntInfoM.getId()).regTime(DateUtil.date())
.build();
boolean b2 = qyzxEmpLogin.insert();
if (!b2) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
......
package cn.timer.api.controller.dzht.cn.tign.hz.constant;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
/**
* @version 2.0
......@@ -8,15 +11,22 @@ import org.apache.commons.lang3.StringUtils;
*/
public class ConfigConstant {
// 模拟环境域名
public static final String host = "https://smlopenapi.esign.cn";
// 生产环境域名
// public static final String host = "https://openapi.esign.cn";
// 项目Id(应用Id)
public static final String PROJECT_ID = "4438775940";
// 项目密钥(应用密钥)
public static final String PROJECT_SECRET = "7b100813cca2746081c57837855ac5af";
public static String host;
public static String PROJECT_ID;
public static String PROJECT_SECRET;
@Value("${config-8timer.esign.host}")
private String host_s;
@Value("${config-8timer.esign.PROJECT_ID}")
private String PROJECT_ID_s;
@Value("${config-8timer.esign.PROJECT_SECRET}")
private String PROJECT_SECRET_s;
@PostConstruct
public void init() {
host = host_s;
PROJECT_ID = PROJECT_ID_s;
PROJECT_SECRET = PROJECT_SECRET_s;
}
// 机构认证地址
public static final String getJgrz_URL(String accountId) {
......
......@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -25,6 +26,8 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping(value = "/oss", produces = { "application/json" })
@RestController
public class OSSController {
@Autowired
private OSSUtil oss;
/**
* 上传普通文件
......@@ -44,7 +47,7 @@ public class OSSController {
return ResultUtil.error("上传的文件为空,请重新选择!");
} else {
try {
url = OSSUtil.uploadFile(path, file.getInputStream());
url = oss.uploadFile(path, file.getInputStream());
} catch (IOException e) {
e.printStackTrace();
}
......@@ -70,7 +73,7 @@ public class OSSController {
return ResultUtil.error("上传的文件为空,请重新选择!");
} else {
try {
url = OSSUtil.uploadFile(path, file.getInputStream());
url = oss.uploadFile(path, file.getInputStream());
list.add(url);
} catch (IOException e) {
e.printStackTrace();
......@@ -92,7 +95,7 @@ public class OSSController {
return ResultUtil.error("上传的文件为空,请重新选择!");
} else {
try {
OSSUtil.uploadPrivateFile(path, file.getInputStream());
oss.uploadPrivateFile(path, file.getInputStream());
} catch (IOException e) {
e.printStackTrace();
}
......@@ -108,7 +111,7 @@ public class OSSController {
public Result<String> getUrlPrivate(@CurrentUser UserBean userBean, @RequestParam String moudle,
@RequestParam String fileName) {
String path = "8timer2.0/" + userBean.getOrgCode() + "/" + moudle + "/" + fileName;
String url = OSSUtil.getUrlP(path);
String url = oss.getUrlP(path);
return ResultUtil.data(url, "获取成功");
}
......
......@@ -2,6 +2,7 @@ package cn.timer.api.utils.aliyun;
import java.util.Date;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -32,12 +33,20 @@ import cn.timer.api.dto.qyzx.EntRegisterDto;
*/
@Transactional
public class AliyunSMS {
@Value("${config-8timer.Aliyun.PROJECT_NAME}")
private String PROJECT_NAME;
@Value("${config-8timer.Aliyun.REGION_ID}")
private String REGION_ID;
@Value("${config-8timer.Aliyun.ACCESSKEY_ID}")
private String ACCESSKEY_ID;
@Value("${config-8timer.Aliyun.SECRET}")
private String SECRET;
final static String CODE_NAME = "TemplateCode";// 短信模板代码参数名
final static String REGION_ID = "cn-shenzhen";// 地区参数
final static String PROJECT_NAME = "8小时人事管家";// 项目名
final static String ACCESSKEY_ID = "LTAI4FuaShJWQ1dggsFWG5CC";
final static String SECRET = "EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR";
final static String TEMPLATE_PARAM = "TemplateParam";// 自定义参数
final static String DOMAIN = "dysmsapi.aliyuncs.com";
final static String VERSION = "2017-05-25";
......@@ -199,7 +208,7 @@ public class AliyunSMS {
* @return
*/
@SuppressWarnings("deprecation")
public static String remind(String name, String htname, String time, String phone) {
public String remind(String name, String htname, String time, String phone) {
Integer orgCode = QyzxEmpLogin.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone)).getOrgId();
......
......@@ -58,6 +58,8 @@ public class RemindUtil implements SchedulingConfigurer {
*/
// @Scheduled(cron = "0 0 8 * * ?") // 每天8点扫一下看有没要提醒的,有就发一个
public static String reportCurrentTime() {
AliyunSMS sms = new AliyunSMS();
List<HtzzAssoHtgx> htgxs = HtzzAssoHtgx.builder().build().selectAll();
for (HtzzAssoHtgx htgx : htgxs) {
QueryWrapper<HtzzAdminZzda> q = new QueryWrapper<HtzzAdminZzda>();
......@@ -75,13 +77,13 @@ public class RemindUtil implements SchedulingConfigurer {
System.err.println(name + " 的 " + htname + "还有: " + betweenDay + " 天到期");
if (sjc > 0) {
if (betweenDay <= 1) {
AliyunSMS.remind(name, htname, time, phone); // 少于1天短信提醒
sms.remind(name, htname, time, phone); // 少于1天短信提醒
} else if (betweenDay == 3) {
AliyunSMS.remind(name, htname, time, phone); // 少于3天短信提醒
sms.remind(name, htname, time, phone); // 少于3天短信提醒
} else if (betweenDay == 7) {
AliyunSMS.remind(name, htname, time, phone); // 少于7天短信提醒
sms.remind(name, htname, time, phone); // 少于7天短信提醒
} else if (betweenDay == 30) {
AliyunSMS.remind(name, htname, time, phone); // 少于30天短信提醒
sms.remind(name, htname, time, phone); // 少于30天短信提醒
}
} else {
zzda.setTxkgType(1); // 关闭提醒
......
......@@ -149,5 +149,29 @@ logging:
# ui-config:
# operations-sorter: method # 它提供了两个配置项:alpha和method,分别代表了按字母表排序以及按方法定义顺序排序
configtest:
patht: 'devPath-dev'
\ No newline at end of file
config-8timer:
register-free-time: 90 #系统赠送时间
Aliyun: # 阿里云
PROJECT_NAME: 8小时人事管家
REGION_ID: cn-shenzhen
ACCESSKEY_ID: LTAI4FuaShJWQ1dggsFWG5CC
SECRET: EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR
endpoint: http://oss-cn-shenzhen.aliyuncs.com
# accessKeyId: LTAI4FuaShJWQ1dggsFWG5CC
# accessKeySecret: EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR
bucketName: 8time-v2
bucketName_pri: 8time-v2-private
project_package: 8timer2.0/
expirationTime: 3153600000000L
expirationTime_pri: 600000L
esign: # e签宝
host: https://smlopenapi.esign.cn
# test: https://smlopenapi.esign.cn
# pro: https://openapi.esign.cn
PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
\ No newline at end of file
......@@ -125,5 +125,20 @@ logging:
# ui-config:
# operations-sorter: method # 它提供了两个配置项:alpha和method,分别代表了按字母表排序以及按方法定义顺序排序
configtest:
patht: 'devPath-pro'
\ No newline at end of file
config-8timer:
register-free-time: 90 #系统赠送时间
Aliyun: # 阿里云
PROJECT_NAME: 8小时人事管家
REGION_ID: cn-shenzhen
ACCESSKEY_ID: LTAI4FuaShJWQ1dggsFWG5CC
SECRET: EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR
endpoint: http://oss-cn-shenzhen.aliyuncs.com
bucketName: 8time-v2
bucketName_pri: 8time-v2-private
project_package: 8timer2.0/
expirationTime: 3153600000000L
expirationTime_pri: 600000L
esign: # e签宝
host: https://openapi.esign.cn
PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
\ No newline at end of file
......@@ -125,5 +125,20 @@ logging:
# ui-config:
# operations-sorter: method # 它提供了两个配置项:alpha和method,分别代表了按字母表排序以及按方法定义顺序排序
configtest:
patht: 'devPath-test'
\ No newline at end of file
config-8timer:
register-free-time: 90 #系统赠送时间
Aliyun: # 阿里云
PROJECT_NAME: 8小时人事管家
REGION_ID: cn-shenzhen
ACCESSKEY_ID: LTAI4FuaShJWQ1dggsFWG5CC
SECRET: EJ6qToT4T4u0B5Rb6qrta9WkyGHvGR
endpoint: http://oss-cn-shenzhen.aliyuncs.com
bucketName: 8time-v2
bucketName_pri: 8time-v2-private
project_package: 8timer2.0/
expirationTime: 3153600000000L
expirationTime_pri: 600000L
esign: # e签宝
host: https://smlopenapi.esign.cn
PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
\ 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