Commit 31c86a90 by 不悦

ycf0717

parent 44b25337
...@@ -2,16 +2,16 @@ server: ...@@ -2,16 +2,16 @@ server:
port: 8085 port: 8085
spring: spring:
datasource: datasource:
url: jdbc:mysql://rm-m5ee12omj4y0g741d0o.mysql.rds.aliyuncs.com:3306/retail_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true # url: jdbc:mysql://rm-m5ee12omj4y0g741d0o.mysql.rds.aliyuncs.com:3306/retail_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: kszzshop # username: kszzshop
password: eE12omj4y0g7# # password: eE12omj4y0g7#
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:mysql://localhost:3306/yami_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
# username: root
# password: root
# driver-class-name: com.mysql.cj.jdbc.Driver # driver-class-name: com.mysql.cj.jdbc.Driver
# type: com.zaxxer.hikari.HikariDataSource # type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/yami_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
hikari: hikari:
minimum-idle: 0 minimum-idle: 0
maximum-pool-size: 20 maximum-pool-size: 20
......
...@@ -57,7 +57,12 @@ public class BargainController { ...@@ -57,7 +57,12 @@ public class BargainController {
if(bargainSendList.size()>0){ if(bargainSendList.size()>0){
bargain.setBargainSendList(bargainSendList); bargain.setBargainSendList(bargainSendList);
} }
int count = bargainSendService.selectFinishOrderTask(bargain.getId(),1);
bargain.setSendCount(count);
Product product = productService.getProductByProdId(bargain.getProdId());
bargain.setProduct(product);
} }
return ResponseEntity.ok(bargains); return ResponseEntity.ok(bargains);
} }
...@@ -69,7 +74,7 @@ public class BargainController { ...@@ -69,7 +74,7 @@ public class BargainController {
public ResponseEntity<Bargain> info (@PathVariable("id") Long id) { public ResponseEntity<Bargain> info (@PathVariable("id") Long id) {
Bargain bargain = bargainService.getBargainById(id); Bargain bargain = bargainService.getBargainById(id);
Product product = productService.getProductByProdId(bargain.getProdId()); Product product = productService.getProductByProdId(bargain.getProdId());
int count = bargainSendService.selectFinishOrderTask(bargain.getId()); int count = bargainSendService.selectFinishOrderTask(bargain.getId(),1);
bargain.setCount(count); bargain.setCount(count);
bargain.setProduct(product); bargain.setProduct(product);
return ResponseEntity.ok(bargain); return ResponseEntity.ok(bargain);
...@@ -94,7 +99,14 @@ public class BargainController { ...@@ -94,7 +99,14 @@ public class BargainController {
Bargain bargain = bargainService.getBargainById(bargainSend.getActivityId()); Bargain bargain = bargainService.getBargainById(bargainSend.getActivityId());
BS.setBargain(bargain); BS.setBargain(bargain);
List<BargainHelp> bargainHelpList = bargainHelpService.selectListByBargainOrderId(bargainSend.getId()); List<BargainHelp> bargainHelpList = bargainHelpService.selectListByBargainOrderId(bargainSend.getId());
BS.setBargainHelpList(bargainHelpList); double cutMoney = 0;
if(ObjectUtil.isNotNull(bargainHelpList)){
BS.setBargainHelpList(bargainHelpList);
for(BargainHelp bargainHelp:bargainHelpList){
cutMoney += bargainHelp.getBargainMoney();
}
}
BS.setCutMoney(cutMoney);
return ResponseEntity.ok(BS); return ResponseEntity.ok(BS);
} }
......
...@@ -40,7 +40,7 @@ public class SmsController { ...@@ -40,7 +40,7 @@ public class SmsController {
@ApiOperation(value="发送验证码", notes="用户的发送验证码") @ApiOperation(value="发送验证码", notes="用户的发送验证码")
public ResponseEntity<Void> audit(@RequestBody SendSmsParam sendSmsParam) { public ResponseEntity<Void> audit(@RequestBody SendSmsParam sendSmsParam) {
String userId = SecurityUtils.getUser().getUserId(); String userId = SecurityUtils.getUser().getUserId();
this.smsLogService.sendSms(SmsType.VALID, userId, sendSmsParam.getMobile(), Maps.newHashMap());
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
} }
} }
package com.yami.shop.api.controller;
import com.chuanglan.demo.SmsSendDemo;
import com.google.common.collect.Maps;
import com.yami.shop.bean.app.param.SendSmsParam;
import com.yami.shop.bean.enums.SmsType;
import com.yami.shop.security.util.SecurityUtils;
import com.yami.shop.service.SmsLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/sms")
@Api(tags="发送验证码接口未授权")
public class SmsNoSecurityController {
@Autowired
private SmsLogService smsLogService;
/**
* 发送验证码接口
*/
@PostMapping("/send")
@ApiOperation(value="发送验证码未授权", notes="用户的发送验证码未授权")
@Transactional
public ResponseEntity<Void> audit(@RequestBody SendSmsParam sendSmsParam) {
int code= (int)((Math.random()*9+1)*100000);
String mobile = sendSmsParam.getMobile();
String msg = "【旷世之作】您的验证码为:"+code+",请勿将验证码告知他人";
SmsSendDemo.sendMsg(mobile, msg);
smsLogService.sendSmsNoSecurity(mobile,code,msg);
return ResponseEntity.ok().build();
}
}
...@@ -2,16 +2,16 @@ server: ...@@ -2,16 +2,16 @@ server:
port: 8086 port: 8086
spring: spring:
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/retail_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true # url: jdbc:mysql://127.0.0.1:3306/retail_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root
password: 123
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:mysql://127.0.0.1:3306/yami_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
# username: root # username: root
# password: root # password: 123
# driver-class-name: com.mysql.cj.jdbc.Driver # driver-class-name: com.mysql.cj.jdbc.Driver
# type: com.zaxxer.hikari.HikariDataSource # type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://127.0.0.1:3306/yami_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
hikari: hikari:
minimum-idle: 0 minimum-idle: 0
maximum-pool-size: 20 maximum-pool-size: 20
......
...@@ -17,7 +17,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -17,7 +17,7 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel(value= "发送验证码参数") @ApiModel(value= "发送验证码参数")
public class SendSmsParam { public class SendSmsParam {
@ApiModelProperty(value = "手机号") @ApiModelProperty(value = "手机号")
@Pattern(regexp="1[0-9]{10}",message = "请输入正确的手机号") @Pattern(regexp="1[0-9]{10}",message = "请输入正确的手机号")
private String mobile; private String mobile;
...@@ -30,5 +30,5 @@ public class SendSmsParam { ...@@ -30,5 +30,5 @@ public class SendSmsParam {
this.mobile = mobile; this.mobile = mobile;
} }
} }
...@@ -134,4 +134,8 @@ public class Bargain implements Serializable { ...@@ -134,4 +134,8 @@ public class Bargain implements Serializable {
@ApiModelProperty(value = "砍价完成人数", required = false) @ApiModelProperty(value = "砍价完成人数", required = false)
@TableField(exist = false) @TableField(exist = false)
private Integer count; private Integer count;
@ApiModelProperty(value = "正在砍价人数", required = false)
@TableField(exist = false)
private Integer SendCount;
} }
...@@ -82,7 +82,9 @@ public class BargainSend { ...@@ -82,7 +82,9 @@ public class BargainSend {
/** /**
* 帮砍好友信息 * 帮砍好友信息
*/ */
@TableField(exist = false)
@ApiModelProperty(value = "帮砍好友信息", required = false) @ApiModelProperty(value = "帮砍好友信息", required = false)
private List<BargainHelp> bargainHelpList; private List<BargainHelp> bargainHelpList;
@ApiModelProperty(value = "砍掉的金额", required = false)
private double cutMoney;
} }
...@@ -81,6 +81,7 @@ public class Product implements Serializable { ...@@ -81,6 +81,7 @@ public class Product implements Serializable {
*/ */
private Integer soldNum; private Integer soldNum;
/** /**
* 库存量 * 库存量
*/ */
...@@ -138,7 +139,14 @@ public class Product implements Serializable { ...@@ -138,7 +139,14 @@ public class Product implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private List<Long> tagList; private List<Long> tagList;
/**
* 下单通知电话
*/
private String noticePhone;
@TableField(exist = false)
private Integer isLimitPrice;
@TableField(exist = false)
private Integer isCrazyBuy;
@Data @Data
public static class DeliveryModeVO { public static class DeliveryModeVO {
......
...@@ -22,5 +22,10 @@ ...@@ -22,5 +22,10 @@
<artifactId>yami-shop-common</artifactId> <artifactId>yami-shop-common</artifactId>
<version>${yami.shop.version}</version> <version>${yami.shop.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.demo;
import com.alibaba.fastjson.JSON;
import com.chuanglan.model.request.SmsBalanceRequest;
import com.chuanglan.model.response.SmsBalanceResponse;
import com.chuanglan.util.ChuangLanSmsUtil;
import java.io.UnsupportedEncodingException;
public class SmsBalanceDemo {
public static final String charset = "utf-8";
public static String account = "";
public static String pswd = "";
public SmsBalanceDemo() {
}
public static void main(String[] args) throws UnsupportedEncodingException {
String smsBalanceRequestUrl = "http://xxx/msg/balance/json";
SmsBalanceRequest smsBalanceRequest = new SmsBalanceRequest(account, pswd);
String requestJson = JSON.toJSONString(smsBalanceRequest);
System.out.println("before request string is: " + requestJson);
String response = ChuangLanSmsUtil.sendSmsByPost(smsBalanceRequestUrl, requestJson);
System.out.println("response after request result is : " + response);
SmsBalanceResponse smsVarableResponse = (SmsBalanceResponse)JSON.parseObject(response, SmsBalanceResponse.class);
System.out.println("response toString is : " + smsVarableResponse);
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.demo;
import com.alibaba.fastjson.JSON;
import com.chuanglan.model.request.SmsPullRequest;
import com.chuanglan.model.response.SmsPullResponse;
import com.chuanglan.util.ChuangLanSmsUtil;
import java.io.UnsupportedEncodingException;
public class SmsPullDemo {
public static final String charset = "utf-8";
public static String account = "";
public static String pswd = "";
public SmsPullDemo() {
}
public static void main(String[] args) throws UnsupportedEncodingException {
String smsPullRequestUrl = "http://xxx/msg/pull/mo";
String count = "1";
SmsPullRequest smsPullRequest = new SmsPullRequest(account, pswd, count);
String requestJson = JSON.toJSONString(smsPullRequest);
System.out.println("before request string is: " + requestJson);
String response = ChuangLanSmsUtil.sendSmsByPost(smsPullRequestUrl, requestJson);
System.out.println("response after request result is : " + response);
SmsPullResponse smsPullResponse = (SmsPullResponse)JSON.parseObject(response, SmsPullResponse.class);
System.out.println("response toString is : " + smsPullResponse);
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.demo;
import com.alibaba.fastjson.JSON;
import com.chuanglan.model.request.SmsReportRequest;
import com.chuanglan.model.response.SmsReportResponse;
import com.chuanglan.util.ChuangLanSmsUtil;
import java.io.UnsupportedEncodingException;
public class SmsReportDemo {
public static final String charset = "utf-8";
public static String account = "";
public static String pswd = "";
public SmsReportDemo() {
}
public static void main(String[] args) throws UnsupportedEncodingException {
String smsReportRequestUrl = "http://xxx/msg/pull/report";
String count = "20";
SmsReportRequest smsReportRequest = new SmsReportRequest(account, pswd, count);
String requestJson = JSON.toJSONString(smsReportRequest);
System.out.println("before request string is: " + requestJson);
String response = ChuangLanSmsUtil.sendSmsByPost(smsReportRequestUrl, requestJson);
System.out.println("response after request result is : " + response);
SmsReportResponse smsReportRespnse = (SmsReportResponse)JSON.parseObject(response, SmsReportResponse.class);
System.out.println("response toString is : " + smsReportRespnse.getResult());
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.demo;
import com.alibaba.fastjson.JSON;
import com.chuanglan.model.request.SmsSendRequest;
import com.chuanglan.model.response.SmsSendResponse;
import com.chuanglan.util.ChuangLanSmsUtil;
public class SmsSendDemo {
public static final String charset = "utf-8";
public static String account = "N2723969";
public static String password = "1zxanNLbc";
public static String smsSingleRequestServerUrl = "http://smssh1.253.com/msg/send/json";
public SmsSendDemo() {
}
public static void sendMsg(String phone, String msg) {
String report = "true";
SmsSendRequest smsSingleRequest = new SmsSendRequest(account, password, msg, phone, report);
String requestJson = JSON.toJSONString(smsSingleRequest);
System.out.println("before request string is: " + requestJson);
String response = ChuangLanSmsUtil.sendSmsByPost(smsSingleRequestServerUrl, requestJson);
System.out.println("response after request result is :" + response);
SmsSendResponse smsSingleResponse = (SmsSendResponse)JSON.parseObject(response, SmsSendResponse.class);
System.out.println("response toString is :" + smsSingleResponse);
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.demo;
import com.alibaba.fastjson.JSON;
import com.chuanglan.model.request.SmsVariableRequest;
import com.chuanglan.model.response.SmsVariableResponse;
import com.chuanglan.util.ChuangLanSmsUtil;
import java.io.UnsupportedEncodingException;
public class SmsVariableDemo {
public static final String charset = "utf-8";
public static String account = "";
public static String pswd = "";
public SmsVariableDemo() {
}
public static void main(String[] args) throws UnsupportedEncodingException {
String smsVariableRequestUrl = "http://xxx/msg/variable/json";
String msg = "【253云通讯】尊敬的{$var},您好,您的验证码是{$var},{$var}分钟内有效";
String params = "159*******,先生,123456,3;130********,先生,123456,3;";
String report = "true";
SmsVariableRequest smsVariableRequest = new SmsVariableRequest(account, pswd, msg, params, report);
String requestJson = JSON.toJSONString(smsVariableRequest);
System.out.println("before request string is: " + requestJson);
String response = ChuangLanSmsUtil.sendSmsByPost(smsVariableRequestUrl, requestJson);
System.out.println("response after request result is : " + response);
SmsVariableResponse smsVariableResponse = (SmsVariableResponse)JSON.parseObject(response, SmsVariableResponse.class);
System.out.println("response toString is : " + smsVariableResponse);
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.request;
public class SmsBalanceRequest {
private String account;
private String password;
public SmsBalanceRequest() {
}
public SmsBalanceRequest(String account, String password) {
this.account = account;
this.password = password;
}
public String getAccount() {
return this.account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.request;
public class SmsPullRequest {
private String account;
private String password;
private String count;
public SmsPullRequest() {
}
public SmsPullRequest(String account, String password, String count) {
this.account = account;
this.password = password;
this.count = count;
}
public String getAccount() {
return this.account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCount() {
return this.count;
}
public void setCount(String count) {
this.count = count;
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.request;
public class SmsReportRequest {
private String account;
private String password;
private String count;
public SmsReportRequest() {
}
public SmsReportRequest(String account, String password, String count) {
this.account = account;
this.password = password;
this.count = count;
}
public String getAccount() {
return this.account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCount() {
return this.count;
}
public void setCount(String count) {
this.count = count;
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.request;
public class SmsSendRequest {
private String account;
private String password;
private String msg;
private String phone;
private String sendtime;
private String report;
private String extend;
private String uid;
public SmsSendRequest() {
}
public SmsSendRequest(String account, String password, String msg, String phone) {
this.account = account;
this.password = password;
this.msg = msg;
this.phone = phone;
}
public SmsSendRequest(String account, String password, String msg, String phone, String report) {
this.account = account;
this.password = password;
this.msg = msg;
this.phone = phone;
this.report = report;
}
public SmsSendRequest(String account, String password, String msg, String phone, String report, String sendtime) {
this.account = account;
this.password = password;
this.msg = msg;
this.phone = phone;
this.sendtime = sendtime;
this.report = report;
}
public SmsSendRequest(String account, String password, String msg, String phone, String sendtime, String report, String uid) {
this.account = account;
this.password = password;
this.msg = msg;
this.phone = phone;
this.sendtime = sendtime;
this.report = report;
this.uid = uid;
}
public String getAccount() {
return this.account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMsg() {
return this.msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getSendtime() {
return this.sendtime;
}
public void setSendtime(String sendtime) {
this.sendtime = sendtime;
}
public String getReport() {
return this.report;
}
public void setReport(String report) {
this.report = report;
}
public String getExtend() {
return this.extend;
}
public void setExtend(String extend) {
this.extend = extend;
}
public String getUid() {
return this.uid;
}
public void setUid(String uid) {
this.uid = uid;
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.request;
public class SmsVariableRequest {
private String account;
private String password;
private String msg;
private String params;
private String sendtime;
private String report;
private String extend;
private String uid;
public SmsVariableRequest() {
}
public SmsVariableRequest(String account, String password, String msg, String params) {
this.account = account;
this.password = password;
this.msg = msg;
this.params = params;
}
public SmsVariableRequest(String account, String password, String msg, String params, String report) {
this.account = account;
this.password = password;
this.msg = msg;
this.params = params;
this.report = report;
}
public String getAccount() {
return this.account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMsg() {
return this.msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getSendtime() {
return this.sendtime;
}
public void setSendtime(String sendtime) {
this.sendtime = sendtime;
}
public String getReport() {
return this.report;
}
public void setReport(String report) {
this.report = report;
}
public String getExtend() {
return this.extend;
}
public void setExtend(String extend) {
this.extend = extend;
}
public String getUid() {
return this.uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getParams() {
return this.params;
}
public void setParams(String params) {
this.params = params;
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.response;
public class SmsBalanceResponse {
private String time;
private String balance;
private String errorMsg;
private String code;
public SmsBalanceResponse() {
}
public String getTime() {
return this.time;
}
public void setTime(String time) {
this.time = time;
}
public String getBalance() {
return this.balance;
}
public void setBalance(String balance) {
this.balance = balance;
}
public String getErrorMsg() {
return this.errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String toString() {
return "SmsBalanceResponse [time=" + this.time + ", balance=" + this.balance + ", errorMsg=" + this.errorMsg + ", code=" + this.code + "]";
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.response;
import java.util.List;
public class SmsPullResponse {
private String ret;
private String error;
private List<SmsPullResponse.Result> result;
public SmsPullResponse() {
}
public String getRet() {
return this.ret;
}
public void setRet(String ret) {
this.ret = ret;
}
public String getError() {
return this.error;
}
public void setError(String error) {
this.error = error;
}
public List<SmsPullResponse.Result> getResult() {
return this.result;
}
public void setResult(List<SmsPullResponse.Result> result) {
this.result = result;
}
static class Result {
private String moTime;
private String spCode;
private String mobile;
private String destCode;
private String messageContent;
Result() {
}
public String getMoTime() {
return this.moTime;
}
public void setMoTime(String moTime) {
this.moTime = moTime;
}
public String getSpCode() {
return this.spCode;
}
public void setSpCode(String spCode) {
this.spCode = spCode;
}
public String getMobile() {
return this.mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getDestCode() {
return this.destCode;
}
public void setDestCode(String destCode) {
this.destCode = destCode;
}
public String getMessageContent() {
return this.messageContent;
}
public void setMessageContent(String messageContent) {
this.messageContent = messageContent;
}
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.response;
import java.util.List;
public class SmsReportResponse {
private String ret;
private String error;
private List<SmsReportResponse.Result> result;
public SmsReportResponse() {
}
public String getRet() {
return this.ret;
}
public void setRet(String ret) {
this.ret = ret;
}
public String getError() {
return this.error;
}
public void setError(String error) {
this.error = error;
}
public List<SmsReportResponse.Result> getResult() {
return this.result;
}
public void setResult(List<SmsReportResponse.Result> result) {
this.result = result;
}
static class Result {
private String msgId;
private String reportTime;
private String mobile;
private String status;
private String statusDesc;
private String count;
Result() {
}
public String getMsgId() {
return this.msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getReportTime() {
return this.reportTime;
}
public void setReportTime(String reportTime) {
this.reportTime = reportTime;
}
public String getMobile() {
return this.mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatusDesc() {
return this.statusDesc;
}
public void setStatusDesc(String statusDesc) {
this.statusDesc = statusDesc;
}
public String getCount() {
return this.count;
}
public void setCount(String count) {
this.count = count;
}
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.response;
public class SmsSendResponse {
private String time;
private String msgId;
private String errorMsg;
private String code;
public SmsSendResponse() {
}
public String getTime() {
return this.time;
}
public void setTime(String time) {
this.time = time;
}
public String getMsgId() {
return this.msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getErrorMsg() {
return this.errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String toString() {
return "SmsSingleResponse [time=" + this.time + ", msgId=" + this.msgId + ", errorMsg=" + this.errorMsg + ", code=" + this.code + "]";
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.model.response;
public class SmsVariableResponse {
private String time;
private String msgId;
private String errorMsg;
private String failNum;
private String successNum;
private String code;
public SmsVariableResponse() {
}
public String getTime() {
return this.time;
}
public void setTime(String time) {
this.time = time;
}
public String getMsgId() {
return this.msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getErrorMsg() {
return this.errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getFailNum() {
return this.failNum;
}
public void setFailNum(String failNum) {
this.failNum = failNum;
}
public String getSuccessNum() {
return this.successNum;
}
public void setSuccessNum(String successNum) {
this.successNum = successNum;
}
public String toString() {
return "SmsVarableResponse [time=" + this.time + ", msgId=" + this.msgId + ", errorMsg=" + this.errorMsg + ", failNum=" + this.failNum + ", successNum=" + this.successNum + ", code=" + this.code + "]";
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.chuanglan.util;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class ChuangLanSmsUtil {
public ChuangLanSmsUtil() {
}
public static String sendSmsByPost(String path, String postContent) {
URL url = null;
try {
url = new URL(path);
HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setReadTimeout(10000);
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
httpURLConnection.setRequestProperty("Charset", "UTF-8");
httpURLConnection.setRequestProperty("Content-Type", "application/json");
httpURLConnection.connect();
OutputStream os = httpURLConnection.getOutputStream();
os.write(postContent.getBytes("UTF-8"));
os.flush();
StringBuilder sb = new StringBuilder();
int httpRspCode = httpURLConnection.getResponseCode();
if (httpRspCode == 200) {
BufferedReader br = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream(), "utf-8"));
String line = null;
while((line = br.readLine()) != null) {
sb.append(line);
}
br.close();
return sb.toString();
}
} catch (Exception var9) {
var9.printStackTrace();
}
return null;
}
}
...@@ -10,7 +10,7 @@ public interface BargainSendMapper extends BaseMapper<BargainSend> { ...@@ -10,7 +10,7 @@ public interface BargainSendMapper extends BaseMapper<BargainSend> {
List<BargainSend> selectBargainSendList(@Param("activityId") Long activityId); List<BargainSend> selectBargainSendList(@Param("activityId") Long activityId);
Integer selectFinishOrderTask(@Param("activityId") Long activityId); Integer selectFinishOrderTask(@Param("activityId") Long activityId,@Param("isAddorder")Integer isAddorder);
BargainSend selectBargainTask(@Param("userId") String userId,@Param("activityId") Long activityId); BargainSend selectBargainTask(@Param("userId") String userId,@Param("activityId") Long activityId);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
package com.yami.shop.dao; package com.yami.shop.dao;
import com.yami.shop.bean.model.UserAddrOrder;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.yami.shop.bean.model.UserAddr; import com.yami.shop.bean.model.UserAddr;
...@@ -34,4 +35,5 @@ public interface UserAddrMapper extends BaseMapper<UserAddr> { ...@@ -34,4 +35,5 @@ public interface UserAddrMapper extends BaseMapper<UserAddr> {
int setDefaultUserAddr(@Param("addrId") Long addrId, @Param("userId") String userId); int setDefaultUserAddr(@Param("addrId") Long addrId, @Param("userId") String userId);
UserAddr getUserAddrByUserIdAndAddrId(@Param("userId") String userId, @Param("addrId") Long addrId); UserAddr getUserAddrByUserIdAndAddrId(@Param("userId") String userId, @Param("addrId") Long addrId);
UserAddrOrder getUserAddrByAddrId(@Param("addrOrderId") Long var1);
} }
\ No newline at end of file
...@@ -17,10 +17,10 @@ public interface BargainSendService extends IService<BargainSend> { ...@@ -17,10 +17,10 @@ public interface BargainSendService extends IService<BargainSend> {
List<BargainSend> selectBargainSendList(long activityId); List<BargainSend> selectBargainSendList(long activityId);
/** /**
* 完成该砍价任务的人数 * 砍价任务的人数
* @return * @return
*/ */
int selectFinishOrderTask(long activityId); int selectFinishOrderTask(long activityId,int isAddorder);
/** /**
* 发布砍价任务 * 发布砍价任务
......
...@@ -23,7 +23,9 @@ import com.yami.shop.bean.model.SmsLog; ...@@ -23,7 +23,9 @@ import com.yami.shop.bean.model.SmsLog;
public interface SmsLogService extends IService<SmsLog> { public interface SmsLogService extends IService<SmsLog> {
public void sendSms(SmsType smsType,String userId,String mobile,Map<String,String> params); public void sendSms(SmsType smsType,String userId,String mobile,Map<String,String> params);
public void sendSmsNoSecurity(String mobile, int code,String msg);
public boolean checkValidCode(String mobile, String code,SmsType smsType); public boolean checkValidCode(String mobile, String code,SmsType smsType);
SmsLog selectSmsByMobileAndType(String mobile,Integer status); SmsLog selectSmsByMobileAndType(String mobile,Integer status);
......
...@@ -24,8 +24,8 @@ public class BargainSendServiceImpl extends ServiceImpl<BargainSendMapper, Barga ...@@ -24,8 +24,8 @@ public class BargainSendServiceImpl extends ServiceImpl<BargainSendMapper, Barga
} }
@Override @Override
public int selectFinishOrderTask(long activityId) { public int selectFinishOrderTask(long activityId,int isAddorder) {
return bargainSendMapper.selectFinishOrderTask(activityId); return bargainSendMapper.selectFinishOrderTask(activityId,isAddorder);
} }
@Override @Override
......
/* //
* Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved. // Source code recreated from a .class file by IntelliJ IDEA
* // (powered by Fernflower decompiler)
* https://www.gz-yami.com/ //
*
* 未经允许,不可做商业用途!
*
* 版权所有,侵权必究!
*/
package com.yami.shop.service.impl; package com.yami.shop.service.impl;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chuanglan.demo.SmsSendDemo;
import com.yami.shop.bean.app.param.PayParam;
import com.yami.shop.bean.enums.PayType; import com.yami.shop.bean.enums.PayType;
import com.yami.shop.bean.event.PaySuccessOrderEvent; import com.yami.shop.bean.event.PaySuccessOrderEvent;
import com.yami.shop.bean.model.Order; import com.yami.shop.bean.model.Order;
import com.yami.shop.bean.model.OrderItem;
import com.yami.shop.bean.model.OrderSettlement; import com.yami.shop.bean.model.OrderSettlement;
import com.yami.shop.bean.app.param.PayParam; import com.yami.shop.bean.model.Product;
import com.yami.shop.bean.model.UserAddrOrder;
import com.yami.shop.bean.pay.PayInfoDto; import com.yami.shop.bean.pay.PayInfoDto;
import com.yami.shop.common.exception.YamiShopBindException; import com.yami.shop.common.exception.YamiShopBindException;
import com.yami.shop.common.util.Arith; import com.yami.shop.common.util.Arith;
import com.yami.shop.dao.OrderMapper; import com.yami.shop.dao.OrderMapper;
import com.yami.shop.dao.OrderSettlementMapper; import com.yami.shop.dao.OrderSettlementMapper;
import com.yami.shop.dao.UserAddrMapper;
import com.yami.shop.service.OrderItemService;
import com.yami.shop.service.PayService; import com.yami.shop.service.PayService;
import com.yami.shop.service.ProductService;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author lgh on 2018/09/15.
*/
@Service @Service
public class PayServiceImpl implements PayService { public class PayServiceImpl implements PayService {
@Autowired @Autowired
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Autowired @Autowired
private OrderSettlementMapper orderSettlementMapper; private OrderSettlementMapper orderSettlementMapper;
@Autowired
private UserAddrMapper userAddrMapper;
@Autowired @Autowired
private ApplicationEventPublisher eventPublisher; private ApplicationEventPublisher eventPublisher;
@Autowired
private ProductService productService;
@Autowired
private OrderItemService orderItemService;
@Autowired @Autowired
private Snowflake snowflake; private Snowflake snowflake;
/** public PayServiceImpl() {
* 不同的订单号,同一个支付流水号 }
*/
@Override
@Transactional(rollbackFor = Exception.class)
public PayInfoDto pay(String userId, PayParam payParam) {
// 不同的订单号的产品名称 @Transactional(
rollbackFor = {Exception.class}
)
public PayInfoDto pay(String userId, PayParam payParam) {
StringBuilder prodName = new StringBuilder(); StringBuilder prodName = new StringBuilder();
// 支付单号 String payNo = String.valueOf(this.snowflake.nextId());
String payNo = String.valueOf(snowflake.nextId()); String[] orderNumbers = payParam.getOrderNumbers().split(",");
String[] orderNumbers = payParam.getOrderNumbers().split(StrUtil.COMMA); String[] var6 = orderNumbers;
// 修改订单信息 int var7 = orderNumbers.length;
for (String orderNumber : orderNumbers) {
OrderSettlement orderSettlement = new OrderSettlement(); OrderSettlement orderSettlement;
for(int var8 = 0; var8 < var7; ++var8) {
String orderNumber = var6[var8];
orderSettlement = new OrderSettlement();
orderSettlement.setPayNo(payNo); orderSettlement.setPayNo(payNo);
orderSettlement.setPayType(payParam.getPayType()); orderSettlement.setPayType(payParam.getPayType());
orderSettlement.setUserId(userId); orderSettlement.setUserId(userId);
orderSettlement.setOrderNumber(orderNumber); orderSettlement.setOrderNumber(orderNumber);
orderSettlementMapper.updateByOrderNumberAndUserId(orderSettlement); this.orderSettlementMapper.updateByOrderNumberAndUserId(orderSettlement);
Order order = this.orderMapper.getOrderByOrderNumber(orderNumber);
Order order = orderMapper.getOrderByOrderNumber(orderNumber); prodName.append(order.getProdName()).append(",");
prodName.append(order.getProdName()).append(StrUtil.COMMA);
} }
// 除了ordernumber不一样,其他都一样
List<OrderSettlement> settlements = orderSettlementMapper.getSettlementsByPayNo(payNo); List<OrderSettlement> settlements = this.orderSettlementMapper.getSettlementsByPayNo(payNo);
// 应支付的总金额 double payAmount = 0.0D;
double payAmount = 0.0;
for (OrderSettlement orderSettlement : settlements) { for(Iterator var14 = settlements.iterator(); var14.hasNext(); payAmount = Arith.add(payAmount, orderSettlement.getPayAmount())) {
payAmount = Arith.add(payAmount, orderSettlement.getPayAmount()); orderSettlement = (OrderSettlement)var14.next();
} }
prodName.substring(0, Math.min(100, prodName.length() - 1)); prodName.substring(0, Math.min(100, prodName.length() - 1));
PayInfoDto payInfoDto = new PayInfoDto(); PayInfoDto payInfoDto = new PayInfoDto();
payInfoDto.setBody(prodName.toString()); payInfoDto.setBody(prodName.toString());
payInfoDto.setPayAmount(payAmount); payInfoDto.setPayAmount(payAmount);
...@@ -95,32 +92,41 @@ public class PayServiceImpl implements PayService { ...@@ -95,32 +92,41 @@ public class PayServiceImpl implements PayService {
return payInfoDto; return payInfoDto;
} }
@Transactional(
@Override rollbackFor = {Exception.class}
@Transactional(rollbackFor = Exception.class) )
public List<String> paySuccess(String payNo, String bizPayNo) { public List<String> paySuccess(String payNo, String bizPayNo) {//new LambdaQueryWrapper<SmsLog>
List<OrderSettlement> orderSettlements = orderSettlementMapper.selectList(new LambdaQueryWrapper<OrderSettlement>().eq(OrderSettlement::getPayNo, payNo)); List<OrderSettlement> orderSettlements = this.orderSettlementMapper.selectList(new LambdaQueryWrapper<OrderSettlement>().eq(OrderSettlement::getPayNo, payNo));
OrderSettlement settlement = (OrderSettlement)orderSettlements.get(0);
OrderSettlement settlement = orderSettlements.get(0);
// 订单已支付
if (settlement.getPayStatus() == 1) { if (settlement.getPayStatus() == 1) {
throw new YamiShopBindException("订单已支付"); throw new YamiShopBindException("订单已支付");
} } else if (this.orderSettlementMapper.updateToPay(payNo, settlement.getVersion()) < 1) {
// 修改订单结算信息
if (orderSettlementMapper.updateToPay(payNo, settlement.getVersion()) < 1) {
throw new YamiShopBindException("结算信息已更改"); throw new YamiShopBindException("结算信息已更改");
} else {
List<String> orderNumbers = (List)orderSettlements.stream().map(OrderSettlement::getOrderNumber).collect(Collectors.toList());
this.orderMapper.updateByToPaySuccess(orderNumbers, PayType.WECHATPAY.value());
List<Order> orders = (List)orderNumbers.stream().map((orderNumber) -> {
return this.orderMapper.getOrderByOrderNumber(orderNumber);
}).collect(Collectors.toList());
orders.forEach((order) -> {
UserAddrOrder userAddrOrder = this.userAddrMapper.getUserAddrByAddrId(order.getAddrOrderId());
if (userAddrOrder != null) {
String msg = "【旷世之作】尊敬的" + userAddrOrder.getReceiver() + "您好,您购买的" + order.getProdName() + " 已下单成功。" + "小二正在快马加鞭的处理您的订单,祝您购物愉快~~";
SmsSendDemo.sendMsg(userAddrOrder.getMobile(), msg);
List<OrderItem> orderItems = this.orderItemService.getOrderItemsByOrderNumber(order.getOrderNumber());
orderItems.forEach((orderItem) -> {
Product dbProduct = this.productService.getProductByProdId(orderItem.getProdId());
if (dbProduct != null && dbProduct.getNoticePhone() != null && !"".equals(dbProduct.getNoticePhone())) {
String msg2 = "【旷世之作】您好,客户购买的产品订单号为" + order.getOrderNumber() + ",购买产品为:" + dbProduct.getProdName() + ",配送地址:" + userAddrOrder.getProvince() + " " + userAddrOrder.getArea() + " " + userAddrOrder.getCity() + " " + userAddrOrder.getAddr() + " 联系人为:" + userAddrOrder.getReceiver() + " 联系电话为:" + userAddrOrder.getMobile();
SmsSendDemo.sendMsg(dbProduct.getNoticePhone(), msg2);
}
});
}
});
this.eventPublisher.publishEvent(new PaySuccessOrderEvent(orders));
return orderNumbers;
} }
List<String> orderNumbers = orderSettlements.stream().map(OrderSettlement::getOrderNumber).collect(Collectors.toList());
// 将订单改为已支付状态
orderMapper.updateByToPaySuccess(orderNumbers, PayType.WECHATPAY.value());
List<Order> orders = orderNumbers.stream().map(orderNumber -> orderMapper.getOrderByOrderNumber(orderNumber)).collect(Collectors.toList());
eventPublisher.publishEvent(new PaySuccessOrderEvent(orders));
return orderNumbers;
} }
} }
...@@ -126,6 +126,20 @@ public class SmsLogServiceImpl extends ServiceImpl<SmsLogMapper, SmsLog> impleme ...@@ -126,6 +126,20 @@ public class SmsLogServiceImpl extends ServiceImpl<SmsLogMapper, SmsLog> impleme
} }
@Override @Override
public void sendSmsNoSecurity(String mobile, int code,String msg) {
SmsLog smsLog = new SmsLog();
// 将上一条验证码失效
smsLogMapper.invalidSmsByMobileAndType(mobile, SmsType.VALID.value());
smsLog.setType(SmsType.VALID.value());
smsLog.setMobileCode(code+"");
smsLog.setRecDate(new Date());
smsLog.setStatus(1);
smsLog.setUserPhone(mobile);
smsLog.setContent(msg);
smsLogMapper.insert(smsLog);
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public boolean checkValidCode(String mobile, String code, SmsType smsType) { public boolean checkValidCode(String mobile, String code, SmsType smsType) {
long checkValidCodeNum = RedisUtil.incr(CHECK_VALID_CODE_NUM_PREFIX + mobile, 1); long checkValidCodeNum = RedisUtil.incr(CHECK_VALID_CODE_NUM_PREFIX + mobile, 1);
......
...@@ -21,7 +21,10 @@ ...@@ -21,7 +21,10 @@
</select> </select>
<select id="selectFinishOrderTask" resultType="java.lang.Integer"> <select id="selectFinishOrderTask" resultType="java.lang.Integer">
select count(*) from tz_bargain_send WHERE is_addorder = 1 and activity_id=#{activityId} select count(*) from tz_bargain_send WHERE activity_id=#{activityId}
<if test="isAddorder=1">
and is_addorder = 1
</if>
</select> </select>
<select id="selectBargainTask" resultType="com.yami.shop.bean.model.BargainSend"> <select id="selectBargainTask" resultType="com.yami.shop.bean.model.BargainSend">
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="version" column="version"/> <result property="version" column="version"/>
<result property="noticePhone" column="notice_phone" />
<result property="isLimitPrice" column="is_limit_price" />
<result property="isCrazyBuy" column="is_crazy_buy" />
</resultMap> </resultMap>
<resultMap id="tagProductMap" type="com.yami.shop.bean.app.dto.TagProductDto"> <resultMap id="tagProductMap" type="com.yami.shop.bean.app.dto.TagProductDto">
......
...@@ -36,4 +36,8 @@ ...@@ -36,4 +36,8 @@
select addr_id,user_id,receiver,province,city,area,province_id,city_id,area_id,addr,mobile,common_addr select addr_id,user_id,receiver,province,city,area,province_id,city_id,area_id,addr,mobile,common_addr
from tz_user_addr where user_id = #{userId} and addr_id = #{addrId} from tz_user_addr where user_id = #{userId} and addr_id = #{addrId}
</select> </select>
<select id="getUserAddrByAddrId" resultType="com.yami.shop.bean.model.UserAddrOrder">
select addr_order_id addrOrderId,addr_id addrId,user_id userId,receiver,province,city,area,addr,mobile
from tz_user_addr_order where addr_order_id = #{addrOrderId}
</select>
</mapper> </mapper>
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