Commit 6033b2e6 by 邓实川

企业中心购买服务Controller,第三方服务callbackController

parent 4d8412dd
......@@ -60,7 +60,10 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
@ApiModelProperty(value="购买单价",example="888")
private Double price;
@ApiModelProperty(value="数量",example="500")
@ApiModelProperty(value="规格",example="500")
private Integer specification;
@ApiModelProperty(value="购入份数",example="2")
private Integer count;
@ApiModelProperty(value="单位",example="条")
......
......@@ -29,7 +29,7 @@ import lombok.NoArgsConstructor;
/**
* <p>Title: QyzxInvoiceData.java</p>
* <p>Description: </p>
* <p>Description: 发票资料实体类</p>
* @author dsc
* @date 2020年4月21日
* @version 1.0
......
/**
* <p>Title: QyzxOrderRecord.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
package cn.timer.api.bean.qyzx.businessService;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>Title: QyzxOrderRecord.java</p>
* <p>Description: 订单记录表实体类</p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name="qyzx_order_record")
@ApiModel("订单记录表")
public class QyzxOrderRecord extends Model<QyzxOrderRecord>{
private static final long serialVersionUID = -7510680773649130425L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="主键",example="1")
private Integer id;
@ApiModelProperty(value="付费内容id",example="1")
private Integer pcid;
@ApiModelProperty(value="购买数量",example="1")
private Integer count;
@ApiModelProperty(value="订单号",example="123456")
private String orderNo;
@ApiModelProperty(value="订单状态",example="0-无 1-支付成功")
private Integer orderStatus;
@ApiModelProperty(value="商品详情",example="json对象")
private String orderDetail;
@ApiModelProperty(value="支付方式",example="0-无 1-微信 2-支付宝")
private String payment;
@ApiModelProperty(value="公司",example="117")
private Integer orgCode;
@ApiModelProperty(value="排序",example="")
private Integer sort;
@ApiModelProperty(value="模块状态",example="默认0-开启,1-关闭")
private Integer status;
@ApiModelProperty(value="是否删除",example="默认0-未删除,1-删除")
private Integer isDelete;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value="创建时间 ",example="")
private Date createTime;
@ApiModelProperty(value="创建人 ",example="")
private Integer createUser;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
@ApiModelProperty(value="修改人 ",example="")
private Integer modifyUser;
}
......@@ -58,8 +58,11 @@ public class QyzxPayContent extends Model<QyzxPayContent>{
@ApiModelProperty(value="付费内容描述",example="短信")
private String content;
@ApiModelProperty(value="数量",example="500")
private Integer count;
@ApiModelProperty(value="规格",example="500")
private Integer specification;
// @ApiModelProperty(value="数量",example="2")
// private Integer count;
@ApiModelProperty(value="单位",example="条")
private String unit;
......@@ -70,6 +73,9 @@ public class QyzxPayContent extends Model<QyzxPayContent>{
@ApiModelProperty(value="现在价格",example="888")
private Double nowPrice;
@ApiModelProperty(value="有效期",example="365")
private Long expiration;
@ApiModelProperty(value="排序",example="")
private Integer sort;
......
......@@ -55,6 +55,9 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{
@ApiModelProperty(value="付费内容id",example="1")
private Integer pcid;
@ApiModelProperty(value="付费内容",example="短信")
private String content;
@ApiModelProperty(value="到期时间",example="365天")
private Date expireDate;
......@@ -62,7 +65,10 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{
private Integer count;
@ApiModelProperty(value="单位",example="条")
private Integer unit;
private String unit;
@ApiModelProperty(value="企业",example="117")
private Integer orgCode;
@ApiModelProperty(value="排序",example="")
private String sort;
......
......@@ -29,7 +29,7 @@ import lombok.NoArgsConstructor;
/**
* <p>Title: QyzxUseRecord.java</p>
* <p>Description: 使用记录表</p>
* <p>Description: 使用记录表实体类</p>
* @author dsc
* @date 2020年4月21日
* @version 1.0
......
/**
* <p>Title: AlipayCallbackController.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
package cn.timer.api.callback.alipay;
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;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <p>Title: AlipayCallbackController.java</p>
* <p>Description: 支付宝回调接口</p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
@RestController
@Api(tags = "99.99 支付宝回调接口")
@RequestMapping(value = "/callback/alipay", produces = { "application/json" })
public class AlipayCallBackController {
@PostMapping(value = "/pro")
@ApiOperation(value = "购买服务", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> alipaycallback_pro(@RequestBody String orderId) { // 入参修改 TODO
// 验证微信回调信息 TODO
// 交易成功
// 修改订单表
// 修改套餐余量表
// 修改购买记录表
return ResultUtil.data(orderId, "购买成功");
}
@PostMapping(value = "/test")
@ApiOperation(value = "购买服务(test)", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> alipaycallback_test(@RequestBody String orderId) { // 入参修改 TODO
// 验证微信回调信息 TODO
// 交易成功
// 修改订单表
// 修改套餐余量表
// 修改购买记录表
return ResultUtil.data(orderId, "购买成功");
}
}
/**
* <p>Title: WxCallBackController.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
package cn.timer.api.callback.wx;
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;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <p>Title: WxCallBackController.java</p>
* <p>Description: 微信回调接口类</p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
@RestController
@Api(tags = "99.98 微信回调接口")
@RequestMapping(value = "/callback/wx", produces = { "application/json" })
public class WxCallBackController {
@PostMapping(value = "/pro")
@ApiOperation(value = "购买服务", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> wxcallback_pro(@RequestBody String orderId) { // 入参修改 TODO
// 验证微信回调信息 TODO
// 交易成功
// 修改订单表
// 修改套餐余量表
// 修改购买记录表
return ResultUtil.data(orderId, "购买成功");
}
@PostMapping(value = "/test")
@ApiOperation(value = "购买服务", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> wxcallback_test(@RequestBody String orderId) { // 入参修改 TODO
// 验证微信回调信息 TODO
// 交易成功
// 修改订单表
// 修改套餐余量表
// 修改购买记录表
return ResultUtil.data(orderId, "购买成功");
}
}
......@@ -35,6 +35,7 @@ public class WebSecurityConfig implements WebMvcConfigurer {
//.excludePathPatterns("/")
registry.addInterceptor(getSessionInterceptor())
.addPathPatterns("/**")
.excludePathPatterns("/callback/**")
.excludePathPatterns("/actuator/*")
.excludePathPatterns("/doc*")
.excludePathPatterns("/v2/**")
......
package cn.timer.api.config.quartz;
//import org.quartz.Job;
//import org.quartz.JobExecutionContext;
//import org.quartz.JobExecutionException;
//
//public interface BaseJob extends Job {
// public void execute(JobExecutionContext context) throws JobExecutionException;
//}
/**
* <p>Title: QyzxBusinessController.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
package cn.timer.api.controller.qyzx;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
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;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.timer.api.bean.qyzx.businessService.QyzxBuyRecord;
import cn.timer.api.bean.qyzx.businessService.QyzxOrderRecord;
import cn.timer.api.bean.qyzx.businessService.QyzxPayContent;
import cn.timer.api.bean.qyzx.businessService.QyzxRemainingQuantity;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <p>
* Title: QyzxBusinessController.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
@RestController
@Api(tags = "4.1企业中心(购买服务)")
@RequestMapping(value = "/qyzxbs", produces = { "application/json" })
public class QyzxBusinessController {
@GetMapping(value = "/getAllQuantity")
@ApiOperation(value = "获取套餐余量信息", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxRemainingQuantity>> s(@CurrentUser UserBean userBean) {
List<QyzxRemainingQuantity> list = QyzxRemainingQuantity.builder().build()
.selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>().eq(QyzxRemainingQuantity::getIsDelete, 0)
.eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode()));
return ResultUtil.data(list, "查询成功");
}
@GetMapping(value = "/getQuantity")
@ApiOperation(value = "获取套餐余量信息(名称,数量,单位)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxRemainingQuantity>> getQuantity(@CurrentUser UserBean userBean) {
List<QyzxRemainingQuantity> qyzxRemainingQuantitys = QyzxRemainingQuantity.builder().build()
.selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>().eq(QyzxRemainingQuantity::getIsDelete, 0)
.eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode())
.select(QyzxRemainingQuantity::getContent, QyzxRemainingQuantity::getCount,
QyzxRemainingQuantity::getUnit));
return ResultUtil.data(qyzxRemainingQuantitys, "获取成功");
}
@GetMapping(value = "/getPayList/Contract")
@ApiOperation(value = "获取短信商品列表", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getPayListwithContract(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getMid, 1).select(
QyzxPayContent::getNowPrice, QyzxPayContent::getOriginalPrice, QyzxPayContent::getSpecification,
QyzxPayContent::getExpiration));
return ResultUtil.data(list, "获取成功");
}
@GetMapping(value = "/getPayList/Msg")
@ApiOperation(value = "获取电子合同商品列表", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getPayListWithMsg(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getMid, 2).select(
QyzxPayContent::getNowPrice, QyzxPayContent::getOriginalPrice, QyzxPayContent::getSpecification,
QyzxPayContent::getExpiration));
return ResultUtil.data(list, "获取成功");
}
@PostMapping(value = "/generateOrder")
@ApiOperation(value = "生成购买订单", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> generateOrder(@CurrentUser UserBean userBean, @RequestBody QyzxOrderRecord qyzxOrderRecord) {
Integer orgCode = userBean.getOrgCode();
String orderNo = String.valueOf(System.currentTimeMillis()) + orgCode; // 时间毫秒数+orgCode
qyzxOrderRecord.setCreateUser(userBean.getEmpNum()); // 创建人
qyzxOrderRecord.setOrgCode(orgCode);
qyzxOrderRecord.setOrderNo(orderNo); // 订单号
qyzxOrderRecord.setOrderStatus(1); // 订单状态-待支付
Integer pcid = qyzxOrderRecord.getPcid(); // 商品id
QyzxPayContent qyzxPayContent = QyzxPayContent.builder().build();
QyzxPayContent qyzxPayContent2 = qyzxPayContent.selectOne(Wrappers.lambdaQuery(qyzxPayContent)
.eq(QyzxPayContent::getId, pcid).select(QyzxPayContent::getContent, QyzxPayContent::getSpecification,
QyzxPayContent::getExpiration, QyzxPayContent::getOriginalPrice, QyzxPayContent::getNowPrice));
JSONObject json = JSONUtil.parseObj(qyzxPayContent2);
qyzxOrderRecord.setOrderDetail(json.toString()); // 订单商品详情-json字符串
qyzxOrderRecord.insert();
// 请求第三方接口生成预支付交易,返回二维码链接code_url TODO
// 生成二维码 TODO
return ResultUtil.data(qyzxOrderRecord, "生成订单成功");
}
@PostMapping(value = "/buyMsg")
@ApiOperation(value = "购买短信", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> buyMsg(@CurrentUser UserBean userBean, @RequestBody QyzxBuyRecord qyzxBuyRecord) {
return ResultUtil.data("购买成功");
}
@PostMapping(value = "/buyContract")
@ApiOperation(value = "购买电子合同", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> buyContract(@CurrentUser UserBean userBean, @RequestBody QyzxBuyRecord qyzxBuyRecord) {
return ResultUtil.data("购买成功");
}
}
/**
* <p>Title: QyzxOrderRecordMapper.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
package cn.timer.api.dao.qyzx.businessService;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.qyzx.businessService.QyzxOrderRecord;
/**
* <p>Title: QyzxOrderRecordMapper.java</p>
* <p>Description: 用户订单持久层</p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
public interface QyzxOrderRecordMapper extends BaseMapper<QyzxOrderRecord>{
}
......@@ -5,7 +5,6 @@ import java.util.Date;
import java.util.List;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
......@@ -28,7 +27,6 @@ import cn.timer.api.utils.aliyun.AliyunSMS;
*/
@Component
@Lazy(false)
@EnableScheduling
public class RemindUtil implements SchedulingConfigurer {
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
......
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