Commit 33cff41f by 东州 翁

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

parents d753b309 3d7766fc
...@@ -52,7 +52,13 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{ ...@@ -52,7 +52,13 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
private Integer id; private Integer id;
@ApiModelProperty(value="付费模块id",example="1") @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="短信") @ApiModelProperty(value="付费内容描述",example="短信")
private String content; private String content;
...@@ -60,7 +66,13 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{ ...@@ -60,7 +66,13 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
@ApiModelProperty(value="购买单价",example="888") @ApiModelProperty(value="购买单价",example="888")
private Double price; private Double price;
@ApiModelProperty(value="数量",example="500") @ApiModelProperty(value="购买总价",example="888")
private Double totalPrice;
@ApiModelProperty(value="规格",example="500")
private Integer specification;
@ApiModelProperty(value="购入份数",example="2")
private Integer count; private Integer count;
@ApiModelProperty(value="单位",example="条") @ApiModelProperty(value="单位",example="条")
...@@ -69,6 +81,12 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{ ...@@ -69,6 +81,12 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
@ApiModelProperty(value="到期时间",example="365天") @ApiModelProperty(value="到期时间",example="365天")
private Date expireDate; 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") @ApiModelProperty(value="企业",example="117")
private Integer orgCode; private Integer orgCode;
...@@ -88,7 +106,7 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{ ...@@ -88,7 +106,7 @@ public class QyzxBuyRecord extends Model<QyzxBuyRecord>{
@ApiModelProperty(value="创建人 ",example="") @ApiModelProperty(value="创建人 ",example="")
private Integer createUser; private Integer createUser;
@TableField(fill = FieldFill.UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="") @ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime; private Date modifyTime;
......
...@@ -29,7 +29,7 @@ import lombok.NoArgsConstructor; ...@@ -29,7 +29,7 @@ import lombok.NoArgsConstructor;
/** /**
* <p>Title: QyzxInvoiceData.java</p> * <p>Title: QyzxInvoiceData.java</p>
* <p>Description: </p> * <p>Description: 发票资料实体类</p>
* @author dsc * @author dsc
* @date 2020年4月21日 * @date 2020年4月21日
* @version 1.0 * @version 1.0
...@@ -52,8 +52,8 @@ public class QyzxInvoiceData extends Model<QyzxInvoiceData>{ ...@@ -52,8 +52,8 @@ public class QyzxInvoiceData extends Model<QyzxInvoiceData>{
@ApiModelProperty(value="主键",example="1") @ApiModelProperty(value="主键",example="1")
private Integer id; private Integer id;
@ApiModelProperty(value="购买记录id",example="1") @ApiModelProperty(value="订单号",example="1")
private Integer pcid; private String orderNo;
@ApiModelProperty(value="发票抬头",example="广东优领") @ApiModelProperty(value="发票抬头",example="广东优领")
...@@ -105,7 +105,7 @@ public class QyzxInvoiceData extends Model<QyzxInvoiceData>{ ...@@ -105,7 +105,7 @@ public class QyzxInvoiceData extends Model<QyzxInvoiceData>{
@ApiModelProperty(value="创建人 ",example="") @ApiModelProperty(value="创建人 ",example="")
private Integer createUser; private Integer createUser;
@TableField(fill = FieldFill.UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="") @ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime; private Date modifyTime;
......
/**
* <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 pmid;
@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 Integer 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.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime;
@ApiModelProperty(value="修改人 ",example="")
private Integer modifyUser;
}
...@@ -53,13 +53,16 @@ public class QyzxPayContent extends Model<QyzxPayContent>{ ...@@ -53,13 +53,16 @@ public class QyzxPayContent extends Model<QyzxPayContent>{
private Integer id; private Integer id;
@ApiModelProperty(value="付费模块id",example="1") @ApiModelProperty(value="付费模块id",example="1")
private Integer mid; private Integer pmid;
@ApiModelProperty(value="付费内容描述",example="短信") @ApiModelProperty(value="付费内容描述",example="短信")
private String content; private String content;
@ApiModelProperty(value="数量",example="500") @ApiModelProperty(value="规格",example="500")
private Integer count; private Integer specification;
// @ApiModelProperty(value="数量",example="2")
// private Integer count;
@ApiModelProperty(value="单位",example="条") @ApiModelProperty(value="单位",example="条")
private String unit; private String unit;
...@@ -70,6 +73,9 @@ public class QyzxPayContent extends Model<QyzxPayContent>{ ...@@ -70,6 +73,9 @@ public class QyzxPayContent extends Model<QyzxPayContent>{
@ApiModelProperty(value="现在价格",example="888") @ApiModelProperty(value="现在价格",example="888")
private Double nowPrice; private Double nowPrice;
@ApiModelProperty(value="有效期",example="365")
private Long expiration;
@ApiModelProperty(value="排序",example="") @ApiModelProperty(value="排序",example="")
private Integer sort; private Integer sort;
...@@ -86,7 +92,7 @@ public class QyzxPayContent extends Model<QyzxPayContent>{ ...@@ -86,7 +92,7 @@ public class QyzxPayContent extends Model<QyzxPayContent>{
@ApiModelProperty(value="创建人 ",example="") @ApiModelProperty(value="创建人 ",example="")
private Integer createUser; private Integer createUser;
@TableField(fill = FieldFill.UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="") @ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime; private Date modifyTime;
......
...@@ -63,7 +63,7 @@ public class QyzxPayModule extends Model<QyzxPayModule>{ ...@@ -63,7 +63,7 @@ public class QyzxPayModule extends Model<QyzxPayModule>{
@ApiModelProperty(value="创建人 ",example="") @ApiModelProperty(value="创建人 ",example="")
private Integer createUser; private Integer createUser;
@TableField(fill = FieldFill.UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="") @ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime; private Date modifyTime;
......
...@@ -52,17 +52,38 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{ ...@@ -52,17 +52,38 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{
@ApiModelProperty(value="主键",example="1") @ApiModelProperty(value="主键",example="1")
private Integer id; private Integer id;
@ApiModelProperty(value="付费模块id",example="1")
private Integer pmid;
@ApiModelProperty(value="付费内容id",example="1") @ApiModelProperty(value="付费内容id",example="1")
private Integer pcid; private Integer pcid;
@ApiModelProperty(value="订单号",example="1")
private String orderNo;
@ApiModelProperty(value="付费内容",example="短信")
private String content;
@ApiModelProperty(value="到期时间",example="365天") @ApiModelProperty(value="到期时间",example="365天")
private Date expireDate; 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; private Integer count;
@ApiModelProperty(value="单位",example="条") @ApiModelProperty(value="单位",example="条")
private Integer unit; private String unit;
@ApiModelProperty(value="企业",example="117")
private Integer orgCode;
@ApiModelProperty(value="排序",example="") @ApiModelProperty(value="排序",example="")
private String sort; private String sort;
...@@ -80,7 +101,7 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{ ...@@ -80,7 +101,7 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{
@ApiModelProperty(value="创建人 ",example="") @ApiModelProperty(value="创建人 ",example="")
private Integer createUser; private Integer createUser;
@TableField(fill = FieldFill.UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="") @ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime; private Date modifyTime;
......
...@@ -29,7 +29,7 @@ import lombok.NoArgsConstructor; ...@@ -29,7 +29,7 @@ import lombok.NoArgsConstructor;
/** /**
* <p>Title: QyzxUseRecord.java</p> * <p>Title: QyzxUseRecord.java</p>
* <p>Description: 使用记录表</p> * <p>Description: 使用记录表实体类</p>
* @author dsc * @author dsc
* @date 2020年4月21日 * @date 2020年4月21日
* @version 1.0 * @version 1.0
...@@ -55,14 +55,17 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{ ...@@ -55,14 +55,17 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{
@ApiModelProperty(value="模块id",example="1") @ApiModelProperty(value="模块id",example="1")
private Integer pmid; private Integer pmid;
@ApiModelProperty(value="订单号",example="1")
private String orderNo;
@ApiModelProperty(value="使用场景",example="1") @ApiModelProperty(value="使用场景",example="1")
private Integer scene; private Integer scene;
@ApiModelProperty(value="原始量",example="500") @ApiModelProperty(value="原始量",example="500")
private Integer originalCount; private Integer originalTotalNum;
@ApiModelProperty(value="现在数量",example="499") @ApiModelProperty(value="当前总量",example="499")
private Integer nowCount; private Integer nowTotalNum;
@ApiModelProperty(value="模块状态",example="默认0-开启,1-关闭") @ApiModelProperty(value="模块状态",example="默认0-开启,1-关闭")
private Integer status; private Integer status;
...@@ -80,7 +83,7 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{ ...@@ -80,7 +83,7 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{
@ApiModelProperty(value="创建人 ",example="") @ApiModelProperty(value="创建人 ",example="")
private Integer createUser; private Integer createUser;
@TableField(fill = FieldFill.UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value="修改时间 ",example="") @ApiModelProperty(value="修改时间 ",example="")
private Date modifyTime; private Date modifyTime;
......
/**
* <p>Title: AlipayCallbackController.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
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;
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
@Transactional
@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 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
*/
@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 = "购买服务(pro)", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> wxcallback_pro(@RequestBody String orderNo) { // 入参修改 TODO
// 验证微信回调信息 TODO
// 交易成功
// updateAndInsert(orderNo);
return ResultUtil.data(orderNo, "购买成功");
}
@PostMapping(value = "/test")
@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, "购买成功");
}
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(); // 公司
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();
}
}
...@@ -35,6 +35,7 @@ public class WebSecurityConfig implements WebMvcConfigurer { ...@@ -35,6 +35,7 @@ public class WebSecurityConfig implements WebMvcConfigurer {
//.excludePathPatterns("/") //.excludePathPatterns("/")
registry.addInterceptor(getSessionInterceptor()) registry.addInterceptor(getSessionInterceptor())
.addPathPatterns("/**") .addPathPatterns("/**")
.excludePathPatterns("/callback/**")
.excludePathPatterns("/actuator/*") .excludePathPatterns("/actuator/*")
.excludePathPatterns("/doc*") .excludePathPatterns("/doc*")
.excludePathPatterns("/v2/**") .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 javax.transaction.Transactional;
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.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
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.QyzxInvoiceData;
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.bean.qyzx.businessService.QyzxUseRecord;
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
*/
@Transactional
@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::getOrderNo, QyzxRemainingQuantity::getContent,
QyzxRemainingQuantity::getRemainder, QyzxRemainingQuantity::getUnit));
return ResultUtil.data(qyzxRemainingQuantitys, "获取成功");
}
@GetMapping(value = "/getPayList/Contract")
@ApiOperation(value = "获取短信商品列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxPayContent>> getPayListwithContract(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 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<List<QyzxPayContent>> getPayListWithMsg(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 2).select(
QyzxPayContent::getNowPrice, QyzxPayContent::getOriginalPrice, QyzxPayContent::getSpecification,
QyzxPayContent::getExpiration));
return ResultUtil.data(list, "获取成功");
}
@PostMapping(value = "/generateOrder")
@ApiOperation(value = "生成购买订单", httpMethod = "POST", notes = "接口发布说明")
public Result<QyzxOrderRecord> 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(0); // 订单状态-无
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::getUnit, 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, "生成订单成功");
}
@GetMapping(value = "/queryBuyRecord")
@ApiOperation(value = "查询购买记录", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxBuyRecord>> queryBuyRecord(@CurrentUser UserBean userBean,
@RequestParam(defaultValue = "1", required = false) Integer pageNum,
@RequestParam(defaultValue = "10", required = false) Integer pageSize,
@RequestParam(required = false) String query, @RequestParam(required = false) String stime,
@RequestParam(required = false) String etime) {
QueryWrapper<QyzxBuyRecord> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("org_code", userBean.getOrgCode())
// .between(!StrUtil.hasBlank(stime) && !StrUtil.hasBlank(etime), "create_time",
// !StrUtil.hasBlank(stime) ? stime : "1000-01-01 00:00:00",
// !StrUtil.hasBlank(etime) ? etime : "9999-01-01 00:00:00")
// .and(!StrUtil.hasBlank(query), wq -> wq.like("order_no", query).or().like("content", query));
Page<Object> page = PageHelper.startPage(pageNum, pageSize);
List<QyzxBuyRecord> list = QyzxBuyRecord.builder().build().selectList(queryWrapper);
System.out.println(page.getTotal());
return ResultUtil.data(list, "查询成功");
}
@PostMapping(value = "/invoicing")
@ApiOperation(value = "开发票", httpMethod = "POST", notes = "接口发布说明")
public Result<QyzxInvoiceData> generateOrder(@CurrentUser UserBean userBean,
@RequestBody QyzxInvoiceData qyzxInvoiceData) {
String orderNo = qyzxInvoiceData.getOrderNo();
QyzxBuyRecord qyzxBuyRecord = QyzxBuyRecord.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxBuyRecord>().eq(QyzxBuyRecord::getOrderNo, orderNo));
if (qyzxBuyRecord.getInvoiceStatus() != 0) {
return ResultUtil.error("开票失败,请检查发票状态");
}
qyzxInvoiceData.setCreateUser(userBean.getEmpNum());
qyzxInvoiceData.setOrgCode(userBean.getOrgCode());
qyzxInvoiceData.insert();
qyzxBuyRecord.setInvoiceStatus(1);
qyzxBuyRecord.update(new LambdaUpdateWrapper<QyzxBuyRecord>().eq(QyzxBuyRecord::getOrderNo, orderNo));
return ResultUtil.data(qyzxInvoiceData, "开票成功");
}
@GetMapping(value = "/queryInvoiceDetail")
@ApiOperation(value = "查询开票详情", httpMethod = "GET", notes = "接口发布说明")
public Result<QyzxInvoiceData> queryInvoiceDetail(@CurrentUser UserBean userBean, @RequestParam String orderNo) {
return ResultUtil.data(QyzxInvoiceData.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxInvoiceData>().eq(QyzxInvoiceData::getOrderNo, orderNo)), "查询成功");
}
@GetMapping(value = "/queryMsgRecord")
@ApiOperation(value = "查询短信套餐余量", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxRemainingQuantity>> queryMsgRecord(@CurrentUser UserBean userBean) {
List<QyzxRemainingQuantity> list = QyzxRemainingQuantity.builder().build()
.selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>()
.eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode())
.eq(QyzxRemainingQuantity::getPmid, 1));
return ResultUtil.data(list, "查询成功");
}
@GetMapping(value = "/queryContractRecord")
@ApiOperation(value = "查询电子合同套餐余量", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxRemainingQuantity>> queryContractRecord(@CurrentUser UserBean userBean) {
List<QyzxRemainingQuantity> list = QyzxRemainingQuantity.builder().build()
.selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>()
.eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode())
.eq(QyzxRemainingQuantity::getPmid, 2));
return ResultUtil.data(list, "查询成功");
}
@GetMapping(value = "/queryMsgUseRecord")
@ApiOperation(value = "查询短信使用记录", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxUseRecord>> queryMsgUseRecord(@CurrentUser UserBean userBean, String orderNo) {
return ResultUtil.data(QyzxUseRecord.builder().build()
.selectList(new LambdaQueryWrapper<QyzxUseRecord>().eq(QyzxUseRecord::getOrderNo, orderNo)), "查询成功");
}
// TODO 不同业务使用 不同数据表
@GetMapping(value = "/queryContractUseRecord")
@ApiOperation(value = "查询电子合同套餐使用记录", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> queryContractUseRecord(@CurrentUser UserBean userBean) {
return null;
}
}
package cn.timer.api.controller.spmk; package cn.timer.api.controller.spmk;
import java.util.ArrayList; import java.util.ArrayList;
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.Autowired;
...@@ -23,6 +24,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -23,6 +24,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
...@@ -33,8 +35,10 @@ import cn.timer.api.bean.spmk.SpmkApprovalG; ...@@ -33,8 +35,10 @@ import cn.timer.api.bean.spmk.SpmkApprovalG;
import cn.timer.api.bean.spmk.SpmkApprovalTemplate; import cn.timer.api.bean.spmk.SpmkApprovalTemplate;
import cn.timer.api.bean.spmk.SpmkApprovalTemplateG; import cn.timer.api.bean.spmk.SpmkApprovalTemplateG;
import cn.timer.api.bean.spmk.SpmkApproveDetail; import cn.timer.api.bean.spmk.SpmkApproveDetail;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary; import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.spmk.SpmkCustomApproval; import cn.timer.api.bean.spmk.SpmkCustomApproval;
import cn.timer.api.bean.spmk.SpmkExecutor;
import cn.timer.api.bean.spmk.SpmkIcon; import cn.timer.api.bean.spmk.SpmkIcon;
import cn.timer.api.bean.spmk.SpmkInitiatorConfig; import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import cn.timer.api.bean.spmk.SpmkJqgz; import cn.timer.api.bean.spmk.SpmkJqgz;
...@@ -787,8 +791,6 @@ public class SpmkServiceImpl { ...@@ -787,8 +791,6 @@ public class SpmkServiceImpl {
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>(); List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren); RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
// System.out.println(jSONObject); // System.out.println(jSONObject);
// System.out.println(listRouter); // System.out.println(listRouter);
// System.out.println(listFlowChildren); // System.out.println(listFlowChildren);
...@@ -860,11 +862,14 @@ public class SpmkServiceImpl { ...@@ -860,11 +862,14 @@ public class SpmkServiceImpl {
SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, id)); SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, id));
SpmkApproveDetailDto adD = SpmkApproveDetailDto.builder().build(); SpmkApproveDetailDto adD = SpmkApproveDetailDto.builder().build();
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectListByAsId(id);
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord"); BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord");
adD.setRequestData(ObjectUtil.unserialize(ad.getRequestData())); adD.setRequestData(ObjectUtil.unserialize(ad.getRequestData()));
adD.setFroms(ObjectUtil.unserialize(ad.getFroms())); adD.setFroms(ObjectUtil.unserialize(ad.getFroms()));
adD.setRouter((Router)ObjectUtil.unserialize(ad.getRouter())); adD.setRouter((Router)ObjectUtil.unserialize(ad.getRouter()));
adD.setListFlowChildren((List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren())); adD.setListFlowChildren((List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren()));
adD.setListSpmkApproveExecuteRecord(listAer);
return ResultUtil.data(adD, "操作成功!"); return ResultUtil.data(adD, "操作成功!");
} }
...@@ -882,6 +887,14 @@ public class SpmkServiceImpl { ...@@ -882,6 +887,14 @@ public class SpmkServiceImpl {
.lambda() .lambda()
.eq(SpmkApproveDetail::getApproveSummaryId, approvingDto.getAsId())); .eq(SpmkApproveDetail::getApproveSummaryId, approvingDto.getAsId()));
Integer count = SpmkExecutor.builder().build().selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getSts, "1"));
if (count == 0) {
return ResultUtil.error("您已审批过!");
}
SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectById(approvingDto.getAsId()); SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectById(approvingDto.getAsId());
if (aSummary.getSts() == 0) { if (aSummary.getSts() == 0) {
List<FlowChildren> listFlowChildren = (List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren()); List<FlowChildren> listFlowChildren = (List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren());
...@@ -895,7 +908,12 @@ public class SpmkServiceImpl { ...@@ -895,7 +908,12 @@ public class SpmkServiceImpl {
System.out.println(listFlowChildren); System.out.println(listFlowChildren);
// 更新 flowChildren // 更新 flowChildren
SpmkApproveDetail.builder().id(ad.getId()).froms(ObjectUtil.serialize(listFlowChildren)).build().updateById(); SpmkApproveDetail.builder().id(ad.getId()).flowChildren(ObjectUtil.serialize(listFlowChildren)).build().updateById();
if (CollUtil.getLast(listFlowChildren).getExecute() == "2") {
// 更新 审批汇总 状态
SpmkApproveSummary.builder().id(approvingDto.getAsId()).endTime(new Date()).sts(2).build().updateById();
}
}else { }else {
return ResultUtil.error("该审批已结束!"); return ResultUtil.error("该审批已结束!");
......
/**
* <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>{
}
package cn.timer.api.dao.spmk; package cn.timer.api.dao.spmk;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -14,4 +17,6 @@ import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord; ...@@ -14,4 +17,6 @@ import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
@Repository @Repository
public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveExecuteRecord> { public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveExecuteRecord> {
List<SpmkApproveExecuteRecord> selectListByAsId(@Param("id") Integer id);
} }
...@@ -19,6 +19,19 @@ public class Relation implements Serializable{ ...@@ -19,6 +19,19 @@ public class Relation implements Serializable{
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 向上id
*/
private Integer upward;
/**
* 向下id
*/
private Integer down;
/**
* empty
*/
private Integer empty;
/**
* 类型 * 类型
*/ */
private String type; private String type;
......
...@@ -41,6 +41,6 @@ public class SpmkApproveDetailDto { ...@@ -41,6 +41,6 @@ public class SpmkApproveDetailDto {
private List<FlowChildren> listFlowChildren; private List<FlowChildren> listFlowChildren;
@ApiModelProperty(value = "审批执行记录 ", example = "审批执行记录") @ApiModelProperty(value = "审批执行记录 ", example = "审批执行记录")
private SpmkApproveExecuteRecord spmkApproveExecuteRecord; private List<SpmkApproveExecuteRecord> listSpmkApproveExecuteRecord;
} }
...@@ -38,7 +38,7 @@ public class SpmkApproveSummaryDto{ ...@@ -38,7 +38,7 @@ public class SpmkApproveSummaryDto{
@ApiModelProperty(value = "申请数据 ", example = "申请数据") @ApiModelProperty(value = "申请数据 ", example = "申请数据")
private JSONObject requestData; private JSONObject requestData;
@ApiModelProperty(value = "审批表单 ", example = "审批表单") @ApiModelProperty(value = "审批表单 ", example = "数组")
private List<JSONObject> froms; private List<JSONObject> froms;
@ApiModelProperty(value = "审批流程 ", example = "审批流程") @ApiModelProperty(value = "审批流程 ", example = "审批流程")
......
...@@ -54,13 +54,13 @@ public class ZcglPersonalAssetsDto extends Page implements Serializable { ...@@ -54,13 +54,13 @@ public class ZcglPersonalAssetsDto extends Page implements Serializable {
@ApiModelProperty(value = "资产名称", example = "桌子") @ApiModelProperty(value = "资产名称", example = "桌子")
private String zcmc; private String zcmc;
@ApiModelProperty(value = "查询条件", example = "名称 或 规格型号") // @ApiModelProperty(value = "查询条件", example = "名称 或 规格型号")
private String query; // private String query;
//
@ApiModelProperty(value = "查询开始时间", example = "") // @ApiModelProperty(value = "查询开始时间", example = "")
private Date startTime; // private Date startTime;
//
@ApiModelProperty(value = "查询结束时间", example = "") // @ApiModelProperty(value = "查询结束时间", example = "")
private Date endTime; // private Date endTime;
} }
package cn.timer.api.utils; package cn.timer.api.utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -105,14 +106,22 @@ public class RouterUtils { ...@@ -105,14 +106,22 @@ public class RouterUtils {
// 装配 部门人员 // 装配 部门人员
if (RELATION_TYPE_DEPARTMENT.equals(listRelations.get(i).getType())) { if (RELATION_TYPE_DEPARTMENT.equals(listRelations.get(i).getType())) {
List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(Integer.parseInt(obj.get("orgCode",FromData.class).getValue()), Integer.valueOf(listRelations.get(i).getDepartmentId())); List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(Integer.parseInt(obj.get("orgCode",FromData.class).getValue()), Integer.valueOf(listRelations.get(i).getDepartmentId()));
List<User> listUsers = new ArrayList<User>();
for (YgglMainEmp emp : listYgglMainEmp) { System.out.println(listYgglMainEmp);
User user = new User();
user.setName(emp.getName()); if (listYgglMainEmp != null && listYgglMainEmp.size() > 0) {
user.setId(String.valueOf(emp.getEmpNum())); List<User> listUsers = new ArrayList<User>();
listUsers.add(user); for (YgglMainEmp emp : listYgglMainEmp) {
User user = new User();
user.setName(emp.getName());
user.setId(String.valueOf(emp.getEmpNum()));
listUsers.add(user);
}
listRelations.get(i).setUsers(listUsers);
}else {
listRelations.get(i).setUsers(null);
} }
listRelations.get(i).setUsers(listUsers);
}else if (RELATION_TYPE_USERS.equals(listRelations.get(i).getType())) { }else if (RELATION_TYPE_USERS.equals(listRelations.get(i).getType())) {
...@@ -293,8 +302,11 @@ public class RouterUtils { ...@@ -293,8 +302,11 @@ public class RouterUtils {
public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) { public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) {
for (int i = 0,m = listFlowChildren.size() ; i < m; i++) { for (int i = 0,m = listFlowChildren.size() ; i < m; i++) {
if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
i++;
continue; continue;
}
switch (listFlowChildren.get(i).getClassName()) { switch (listFlowChildren.get(i).getClassName()) {
case CREATOR: case CREATOR:
...@@ -402,14 +414,14 @@ public class RouterUtils { ...@@ -402,14 +414,14 @@ public class RouterUtils {
// 新增 执行人 // 新增 执行人
List<User> listUser = listFlowChildren.get(i).getRelation().get(0).getUsers(); List<User> listUser = listFlowChildren.get(i).getRelation().get(0).getUsers();
if (EXECUTED.equals(listFlowChildren.get(i).getExecute())) { if (EXECUTED.equals(listFlowChildren.get(i).getExecute())) {
continue;
}else if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) { }else if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) {
// 新增 执行人 // 新增 执行人
// listUser = flowChildren.getRelation().get(0).getUsers(); // listUser = flowChildren.getRelation().get(0).getUsers();
for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) { for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) {
if (EXECUTED.equals(listUser.get(i_user).getExecute())) { if (EXECUTED.equals(listUser.get(i_user).getExecute())) {
continue;
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) { }else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
SpmkExecutor.builder() SpmkExecutor.builder()
.id(executorId) .id(executorId)
...@@ -420,15 +432,15 @@ public class RouterUtils { ...@@ -420,15 +432,15 @@ public class RouterUtils {
.build() .build()
.updateById(); .updateById();
listUser.get(i_user).setExecute(EXECUTED); listUser.get(i_user).setExecute(EXECUTED);
// 历史审批人
SpmkApproveSummary.builder().id(asId).historyApprover(listUser.get(i_user).getName()).build().updateById();
// 0未执行 1执行中 2同意 3拒绝 // 0未执行 1执行中 2同意 3拒绝
if (sts == 3) { if (sts == 3) {
// 更新 审批汇总 状态 // 更新 审批汇总 状态
SpmkApproveSummary.builder().id(asId).sts(sts).build().updateById(); SpmkApproveSummary.builder().id(asId).endTime(new Date()).sts(sts).build().updateById();
return; return;
} }
}else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) { }else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) {
SpmkExecutor.builder() SpmkExecutor.builder()
.approveExecuteRecordId(executeRecordId) .approveExecuteRecordId(executeRecordId)
...@@ -439,6 +451,9 @@ public class RouterUtils { ...@@ -439,6 +451,9 @@ public class RouterUtils {
.insert(); .insert();
hasNextApprover = true; hasNextApprover = true;
listUser.get(i_user).setExecute(EXECUTING); listUser.get(i_user).setExecute(EXECUTING);
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user).getName()).build().updateById();
} }
} }
......
/**
* <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 { ...@@ -14,7 +14,6 @@ public class CronUtil {
ScheduleTask task = ScheduleTask.builder().build().selectOne(new LambdaQueryWrapper<ScheduleTask>() ScheduleTask task = ScheduleTask.builder().build().selectOne(new LambdaQueryWrapper<ScheduleTask>()
.eq(ScheduleTask::getClassName, className).eq(ScheduleTask::getMethodName, methodName)); // 数据库查询 .eq(ScheduleTask::getClassName, className).eq(ScheduleTask::getMethodName, methodName)); // 数据库查询
System.err.println(task);
if (task != null && task.getCron() != null) { if (task != null && task.getCron() != null) {
cron = task.getCron(); cron = task.getCron();
} }
......
...@@ -5,7 +5,6 @@ import java.util.Date; ...@@ -5,7 +5,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.scheduling.config.ScheduledTaskRegistrar;
...@@ -28,7 +27,6 @@ import cn.timer.api.utils.aliyun.AliyunSMS; ...@@ -28,7 +27,6 @@ import cn.timer.api.utils.aliyun.AliyunSMS;
*/ */
@Component @Component
@Lazy(false) @Lazy(false)
@EnableScheduling
public class RemindUtil implements SchedulingConfigurer { public class RemindUtil implements SchedulingConfigurer {
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.spmk.SpmkApproveExecuteRecordMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord" >
<id column="id" property="id" />
<result column="approve_summary_id" property="approveSummaryId" />
<result column="name" property="name" />
<result column="type" property="type" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
</resultMap>
<resultMap id="BaseResultMapDto" type="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord" >
<id column="id" property="id" />
<result column="approve_summary_id" property="approveSummaryId" />
<result column="name" property="name" />
<result column="type" property="type" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<collection column="SpmkExecutor_id" property="spmkExecutors" ofType="cn.timer.api.bean.spmk.SpmkExecutor"
resultMap="cn.timer.api.dao.spmk.SpmkExecutorMapper.BaseResultMap" columnPrefix="SpmkExecutor_">
</collection>
</resultMap>
<sql id="Base_Column_List">
id,
approve_summary_id,
name,
type,
sts,
create_time
</sql>
<sql id="Base_Column_List_a">
a.id,
a.approve_summary_id,
a.name,
a.type,
a.sts,
a.create_time
</sql>
<sql id="Base_Column_List_Alias_b">
b.id SpmkExecutor_id,
b.approve_execute_record_id SpmkExecutor_approve_execute_record_id,
b.emp_num SpmkExecutor_emp_num,
b.executor_name SpmkExecutor_executor_name,
b.operator_header_url SpmkExecutor_operator_header_url,
b.opinion SpmkExecutor_opinion,
b.sts SpmkExecutor_sts,
b.create_time SpmkExecutor_create_time
</sql>
<sql id="Base_Column_List_Alias">
id SpmkApproveExecuteRecord_id,
approve_summary_id SpmkApproveExecuteRecord_approve_summary_id,
name SpmkApproveExecuteRecord_name,
type SpmkApproveExecuteRecord_type,
sts SpmkApproveExecuteRecord_sts,
create_time SpmkApproveExecuteRecord_create_time
</sql>
<select id="selectListByAsId" resultMap="BaseResultMapDto">
SELECT
<include refid="Base_Column_List_a" />,
<include refid="Base_Column_List_Alias_b" />
FROM spmk_approve_execute_record a
LEFT JOIN spmk_executor b ON a.id = b.approve_execute_record_id
WHERE a.approve_summary_id = #{id}
ORDER BY a.id, b.id
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord">
INSERT INTO spmk_approve_execute_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != approveSummaryId'>
approve_summary_id,
</if>
<if test ='null != name'>
name,
</if>
<if test ='null != type'>
type,
</if>
<if test ='null != sts'>
sts,
</if>
<if test ='null != createTime'>
create_time
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != approveSummaryId'>
#{approveSummaryId},
</if>
<if test ='null != name'>
#{name},
</if>
<if test ='null != type'>
#{type},
</if>
<if test ='null != sts'>
#{sts},
</if>
<if test ='null != createTime'>
#{createTime}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM spmk_approve_execute_record
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord">
UPDATE spmk_approve_execute_record
<set>
<if test ='null != approveSummaryId'>approve_summary_id = #{approveSummaryId},</if>
<if test ='null != name'>name = #{name},</if>
<if test ='null != type'>type = #{type},</if>
<if test ='null != sts'>sts = #{sts},</if>
<if test ='null != createTime'>create_time = #{createTime}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM spmk_approve_execute_record
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM spmk_approve_execute_record
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM spmk_approve_execute_record
</select>
-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.spmk.SpmkExecutorMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkExecutor" >
<id column="id" property="id" />
<result column="approve_execute_record_id" property="approveExecuteRecordId" />
<result column="emp_num" property="empNum" />
<result column="executor_name" property="executorName" />
<result column="operator_header_url" property="operatorHeaderUrl" />
<result column="opinion" property="opinion" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id,
approve_execute_record_id,
emp_num,
executor_name,
operator_header_url,
opinion,
sts,
create_time
</sql>
<sql id="Base_Column_List_Alias">
id SpmkExecutor_id,
approve_execute_record_id SpmkExecutor_approve_execute_record_id,
emp_num SpmkExecutor_emp_num,
executor_name SpmkExecutor_executor_name,
operator_header_url SpmkExecutor_operator_header_url,
opinion SpmkExecutor_opinion,
sts SpmkExecutor_sts,
create_time SpmkExecutor_create_time
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkExecutor">
INSERT INTO spmk_executor
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != approveExecuteRecordId'>
approve_execute_record_id,
</if>
<if test ='null != empNum'>
emp_num,
</if>
<if test ='null != executorName'>
executor_name,
</if>
<if test ='null != operatorHeaderUrl'>
operator_header_url,
</if>
<if test ='null != opinion'>
opinion,
</if>
<if test ='null != sts'>
sts,
</if>
<if test ='null != createTime'>
create_time
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != approveExecuteRecordId'>
#{approveExecuteRecordId},
</if>
<if test ='null != empNum'>
#{empNum},
</if>
<if test ='null != executorName'>
#{executorName},
</if>
<if test ='null != operatorHeaderUrl'>
#{operatorHeaderUrl},
</if>
<if test ='null != opinion'>
#{opinion},
</if>
<if test ='null != sts'>
#{sts},
</if>
<if test ='null != createTime'>
#{createTime}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM spmk_executor
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.spmk.SpmkExecutor">
UPDATE spmk_executor
<set>
<if test ='null != approveExecuteRecordId'>approve_execute_record_id = #{approveExecuteRecordId},</if>
<if test ='null != empNum'>emp_num = #{empNum},</if>
<if test ='null != executorName'>executor_name = #{executorName},</if>
<if test ='null != operatorHeaderUrl'>operator_header_url = #{operatorHeaderUrl},</if>
<if test ='null != opinion'>opinion = #{opinion},</if>
<if test ='null != sts'>sts = #{sts},</if>
<if test ='null != createTime'>create_time = #{createTime}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM spmk_executor
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM spmk_executor
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM spmk_executor
</select>
-->
</mapper>
\ 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