Commit ce339f4e by 邓实川

企业中心商品实体类,部分查询接口

parent 68aa7e5c
......@@ -52,7 +52,13 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
private Integer id;
@ApiModelProperty(value="付费模块id",example="1")
private Integer mid;
private Integer pmid;
@ApiModelProperty(value="付费商品id",example="1")
private Integer pcid;
@ApiModelProperty(value="订单号",example="1")
private String orderNo;
@ApiModelProperty(value="付费内容描述",example="短信")
private String content;
......@@ -60,6 +66,9 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
@ApiModelProperty(value="购买单价",example="888")
private Double price;
@ApiModelProperty(value="购买总价",example="888")
private Double totalPrice;
@ApiModelProperty(value="规格",example="500")
private Integer specification;
......@@ -72,6 +81,12 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
@ApiModelProperty(value="到期时间",example="365天")
private Date expireDate;
@ApiModelProperty(value="支付方式",example="0-无 1-微信 2-支付宝")
private Integer payment;
@ApiModelProperty(value="开票状态",example="0-待开票 1-开票中 2-已开票 3-开票失败")
private Integer invoiceStatus;
@ApiModelProperty(value="企业",example="117")
private Integer orgCode;
......@@ -91,7 +106,7 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
@ApiModelProperty(value="创建人 ",example="")
private Integer createUser;
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
......
......@@ -52,8 +52,8 @@ public class QyzxInvoiceData extends Model<QyzxInvoiceData>{
@ApiModelProperty(value="主键",example="1")
private Integer id;
@ApiModelProperty(value="购买记录id",example="1")
private Integer pcid;
@ApiModelProperty(value="订单号",example="1")
private String orderNo;
@ApiModelProperty(value="发票抬头",example="广东优领")
......@@ -105,7 +105,7 @@ public class QyzxInvoiceData extends Model<QyzxInvoiceData>{
@ApiModelProperty(value="创建人 ",example="")
private Integer createUser;
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
......
......@@ -51,6 +51,9 @@ public class QyzxOrderRecord extends Model<QyzxOrderRecord>{
@ApiModelProperty(value="主键",example="1")
private Integer id;
@ApiModelProperty(value="付费模块id",example="1")
private Integer pmid;
@ApiModelProperty(value="付费内容id",example="1")
private Integer pcid;
......@@ -67,7 +70,7 @@ public class QyzxOrderRecord extends Model<QyzxOrderRecord>{
private String orderDetail;
@ApiModelProperty(value="支付方式",example="0-无 1-微信 2-支付宝")
private String payment;
private Integer payment;
@ApiModelProperty(value="公司",example="117")
private Integer orgCode;
......@@ -88,7 +91,7 @@ public class QyzxOrderRecord extends Model<QyzxOrderRecord>{
@ApiModelProperty(value="创建人 ",example="")
private Integer createUser;
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
......
......@@ -53,7 +53,7 @@ public class QyzxPayContent extends Model<QyzxPayContent>{
private Integer id;
@ApiModelProperty(value="付费模块id",example="1")
private Integer mid;
private Integer pmid;
@ApiModelProperty(value="付费内容描述",example="短信")
private String content;
......@@ -92,7 +92,7 @@ public class QyzxPayContent extends Model<QyzxPayContent>{
@ApiModelProperty(value="创建人 ",example="")
private Integer createUser;
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
......
......@@ -63,7 +63,7 @@ public class QyzxPayModule extends Model<QyzxPayModule>{
@ApiModelProperty(value="创建人 ",example="")
private Integer createUser;
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
......
......@@ -52,16 +52,31 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{
@ApiModelProperty(value="主键",example="1")
private Integer id;
@ApiModelProperty(value="付费模块id",example="1")
private Integer pmid;
@ApiModelProperty(value="付费内容id",example="1")
private Integer pcid;
@ApiModelProperty(value="订单号",example="1")
private String orderNo;
@ApiModelProperty(value="付费内容",example="短信")
private String content;
@ApiModelProperty(value="到期时间",example="365天")
private Date expireDate;
@ApiModelProperty(value="数量",example="500")
@ApiModelProperty(value="规格",example="500")
private Integer specification;
@ApiModelProperty(value="套餐总量=规格*数量",example="1000")
private Integer totalNum;
@ApiModelProperty(value="套餐剩余数量",example="499")
private Integer remainder;
@ApiModelProperty(value="数量",example="2")
private Integer count;
@ApiModelProperty(value="单位",example="条")
......@@ -86,7 +101,7 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{
@ApiModelProperty(value="创建人 ",example="")
private Integer createUser;
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
......
......@@ -55,14 +55,17 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{
@ApiModelProperty(value="模块id",example="1")
private Integer pmid;
@ApiModelProperty(value="订单号",example="1")
private String orderNo;
@ApiModelProperty(value="使用场景",example="1")
private Integer scene;
@ApiModelProperty(value="原始量",example="500")
private Integer originalCount;
@ApiModelProperty(value="原始量",example="500")
private Integer originalTotalNum;
@ApiModelProperty(value="现在数量",example="499")
private Integer nowCount;
@ApiModelProperty(value="当前总量",example="499")
private Integer nowTotalNum;
@ApiModelProperty(value="模块状态",example="默认0-开启,1-关闭")
private Integer status;
......@@ -80,7 +83,7 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{
@ApiModelProperty(value="创建人 ",example="")
private Integer createUser;
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
......
......@@ -7,6 +7,8 @@
*/
package cn.timer.api.callback.alipay;
import javax.transaction.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -26,6 +28,7 @@ import io.swagger.annotations.ApiOperation;
*/
@RestController
@Transactional
@Api(tags = "99.99 支付宝回调接口")
@RequestMapping(value = "/callback/alipay", produces = { "application/json" })
public class AlipayCallBackController {
......
......@@ -4,71 +4,142 @@
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
*/
package cn.timer.api.callback.wx;
import java.util.Date;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Value;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.businessService.QyzxBuyRecord;
import cn.timer.api.bean.qyzx.businessService.QyzxOrderRecord;
import cn.timer.api.bean.qyzx.businessService.QyzxRemainingQuantity;
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
*/
/**
* <p>
* Title: WxCallBackController.java
* </p>
* <p>
* Description: 微信回调接口类
* </p>
*
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
@RestController
@Transactional
@Api(tags = "99.98 微信回调接口")
@RequestMapping(value = "/callback/wx", produces = { "application/json" })
public class WxCallBackController {
@Value("${spring.profiles.active}")
private String env;
@GetMapping(value = "/t")
public String testEnv() {
System.out.println(env);
return env;
}
@PostMapping(value = "/pro")
@ApiOperation(value = "购买服务", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> wxcallback_pro(@RequestBody String orderId) { // 入参修改 TODO
@ApiOperation(value = "购买服务(pro)", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> wxcallback_pro(@RequestBody String orderNo) { // 入参修改 TODO
// 验证微信回调信息 TODO
// 交易成功
// 修改订单表
// 修改套餐余量表
// 修改购买记录表
return ResultUtil.data(orderId, "购买成功");
// updateAndInsert(orderNo);
return ResultUtil.data(orderNo, "购买成功");
}
@PostMapping(value = "/test")
@ApiOperation(value = "购买服务", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> wxcallback_test(@RequestBody String orderId) { // 入参修改 TODO
@ApiOperation(value = "购买服务(test)", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> wxcallback_test(@RequestParam String orderNo) {
if (!env.equals("dev") && !env.equals("test")) {
return ResultUtil.error("请切换到开发/测试环境");
}
updateAndInsert(orderNo);
return ResultUtil.data(orderNo, "购买成功");
}
// 验证微信回调信息 TODO
// 交易成功
private void updateAndInsert(String orderNo) {
// 修改订单表
QyzxOrderRecord qyzxOrderRecord = QyzxOrderRecord.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxOrderRecord>().eq(QyzxOrderRecord::getOrderNo, orderNo)); // 查询该订单
qyzxOrderRecord.setOrderStatus(1); // 修改订单状态
qyzxOrderRecord.update(new LambdaUpdateWrapper<QyzxOrderRecord>().eq(QyzxOrderRecord::getOrderNo, orderNo)); // 更新数据
// 插入套餐余量表
String jsonStr = qyzxOrderRecord.getOrderDetail(); // json字符串
JSONObject jsonObject = JSONUtil.parseObj(jsonStr); // json对象
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"); // 商品规格
String unit = jsonObject.getStr("unit");
// Double originalPrice = jsonObject.getDouble("originalPrice"); // 商品原价
Double nowPrice = jsonObject.getDouble("nowPrice"); // 购买价
Integer count = qyzxOrderRecord.getCount(); // 订单购买数量
Integer pmid = qyzxOrderRecord.getPmid(); // 付费模块id
Integer pcid = qyzxOrderRecord.getPcid(); // 付费内容id
Integer createdUser = qyzxOrderRecord.getCreateUser(); // 订单创建人
Integer orgCode = qyzxOrderRecord.getOrgCode(); // 公司
// 修改套餐余量表
// 修改购买记录表
return ResultUtil.data(orderId, "购买成功");
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.setCreateUser(createdUser);
quantity.setOrgCode(orgCode);
quantity.insert();
// 插入购买记录表
QyzxBuyRecord qyzxBuyRecord = new QyzxBuyRecord();
qyzxBuyRecord.setSpecification(specification);
qyzxBuyRecord.setUnit(unit);
qyzxBuyRecord.setContent(content);
qyzxBuyRecord.setCreateUser(createdUser);
qyzxBuyRecord.setOrderNo(orderNo);
qyzxBuyRecord.setPmid(pmid);
qyzxBuyRecord.setPcid(pcid);
qyzxBuyRecord.setPrice(nowPrice);
qyzxBuyRecord.setCount(count);
qyzxBuyRecord.setTotalPrice(nowPrice * count);
qyzxBuyRecord.setExpireDate(expireDate);
qyzxBuyRecord.setPayment(1); // 1-微信 2-支付宝
qyzxBuyRecord.setInvoiceStatus(0); // 0-待开票 1-开票中 2-已开票 3-开票失败
qyzxBuyRecord.setOrgCode(orgCode);
qyzxBuyRecord.insert();
}
}
......@@ -54,13 +54,13 @@ public class ZcglPersonalAssetsDto extends Page implements Serializable {
@ApiModelProperty(value = "资产名称", example = "桌子")
private String zcmc;
@ApiModelProperty(value = "查询条件", example = "名称 或 规格型号")
private String query;
@ApiModelProperty(value = "查询开始时间", example = "")
private Date startTime;
@ApiModelProperty(value = "查询结束时间", example = "")
private Date endTime;
// @ApiModelProperty(value = "查询条件", example = "名称 或 规格型号")
// private String query;
//
// @ApiModelProperty(value = "查询开始时间", example = "")
// private Date startTime;
//
// @ApiModelProperty(value = "查询结束时间", example = "")
// private Date endTime;
}
/**
* <p>Title: BaseQuery.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月23日
* @version 1.0
*/
package cn.timer.api.utils.query;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>
* Title: BaseQuery.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年4月23日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BaseQuery implements Serializable{
private static final long serialVersionUID = -2244756601623536423L;
// 当前页
@ApiModelProperty(value="当前页",example="1",required = false)
private Integer pageNum;
// 当前页总条数
@ApiModelProperty(value="模块id",example="10",required = false)
private Integer pageSize;
// 模糊查询
@ApiModelProperty(value="模糊查询",example="",required = false)
private String query;
// 开始时间
@ApiModelProperty(value="开始时间",example="",required = false)
private String stime;
// 结束时间
@ApiModelProperty(value="结束时间",example="",required = false)
private String etime;
}
......@@ -14,7 +14,6 @@ public class CronUtil {
ScheduleTask task = ScheduleTask.builder().build().selectOne(new LambdaQueryWrapper<ScheduleTask>()
.eq(ScheduleTask::getClassName, className).eq(ScheduleTask::getMethodName, methodName)); // 数据库查询
System.err.println(task);
if (task != null && task.getCron() != null) {
cron = task.getCron();
}
......
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