增加了用户余额线下扣款 , 套餐包线下核销功能
This commit is contained in:
parent
92e272664c
commit
45eb9b07a9
@ -1,5 +1,6 @@
|
||||
package cn.com.tenlion.operator.controller.api.packageorder;
|
||||
|
||||
import cn.com.tenlion.operator.pojo.vos.packageorder.PackageOrderWriteoffVO;
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
@ -54,6 +55,18 @@ public class PackageOrderController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改套餐包-订单", notes = "修改套餐包-订单接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "packageOrderId", value = "套餐包-订单ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update-writeoff/{packageOrderId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult updateWriteoff(@PathVariable("packageOrderId") String packageOrderId, @RequestBody PackageOrderWriteoffVO packageOrderWriteoffVO) {
|
||||
packageOrderService.updateWriteoff(packageOrderId, packageOrderWriteoffVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改套餐包-订单", notes = "修改套餐包-订单接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "packageOrderId", value = "套餐包-订单ID", paramType = "path")
|
||||
|
@ -0,0 +1,64 @@
|
||||
package cn.com.tenlion.operator.controller.api.user.info;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 支付实体
|
||||
* @author : LY
|
||||
* @date :2024-1-30 10:16
|
||||
* @description :
|
||||
* @modyified By:
|
||||
*/
|
||||
public class PayVO {
|
||||
|
||||
@ApiModelProperty(name = "auditExplain", value = "用户ID")
|
||||
private String userId;
|
||||
@ApiModelProperty(name = "accountMoney", value = "金额")
|
||||
private Integer accountMoney;
|
||||
@ApiModelProperty(name = "description", value = "说明")
|
||||
private String description;
|
||||
@ApiModelProperty(name = "orderId", value = "订单ID")
|
||||
private String orderId;
|
||||
@ApiModelProperty(name = "code", value = "")
|
||||
private String code;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getAccountMoney() {
|
||||
return accountMoney;
|
||||
}
|
||||
|
||||
public void setAccountMoney(Integer accountMoney) {
|
||||
this.accountMoney = accountMoney;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import cn.com.tenlion.operator.pojo.vos.useric.UserRechargeVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.useric.UsericVO;
|
||||
import cn.com.tenlion.operator.service.user.info.IUserInfoService;
|
||||
import cn.com.tenlion.operator.serviceother.operator.accountrecharge.IAccountRechargeService;
|
||||
import cn.com.tenlion.operator.util.PayUtil;
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
@ -47,19 +48,30 @@ public class UserInfoController extends DefaultBaseController {
|
||||
@PutMapping("save-recharge/{userId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult saveRecharge(@PathVariable("userId") String userId, @RequestBody UserRechargeVO userRechargeVO) {
|
||||
/**
|
||||
* 创建充值记录
|
||||
*/
|
||||
AccountRechargeVO rechargeVO = new AccountRechargeVO();
|
||||
rechargeVO.setThirdParty(ThirdPartyEnum.XT.getValue());
|
||||
rechargeVO.setAccountId(userId);
|
||||
rechargeVO.setReconciliationStatus("1");
|
||||
rechargeVO.setRechargeCheck("2");
|
||||
rechargeVO.setRechargeFinalTime(DateUtil.getTime());
|
||||
rechargeVO.setRechargeType("1");
|
||||
rechargeVO.setRechargeRemark(userRechargeVO.getRechargeRemark());
|
||||
rechargeVO.setRechargeMoney(userRechargeVO.getRechargeMoney());
|
||||
iAccountRechargeService.saveSystem(rechargeVO);
|
||||
if(userRechargeVO.getThirdPartyMode().equals("充值")) {
|
||||
/**
|
||||
* 创建充值记录
|
||||
*/
|
||||
AccountRechargeVO rechargeVO = new AccountRechargeVO();
|
||||
rechargeVO.setThirdParty(ThirdPartyEnum.XT.getValue());
|
||||
rechargeVO.setAccountId(userId);
|
||||
rechargeVO.setReconciliationStatus("1");
|
||||
rechargeVO.setRechargeCheck("2");
|
||||
rechargeVO.setRechargeFinalTime(DateUtil.getTime());
|
||||
rechargeVO.setRechargeType("1");
|
||||
rechargeVO.setRechargeRemark(userRechargeVO.getRechargeRemark());
|
||||
rechargeVO.setRechargeMoney(userRechargeVO.getRechargeMoney());
|
||||
iAccountRechargeService.saveSystem(rechargeVO);
|
||||
}else {
|
||||
/**
|
||||
* 创建扣款记录
|
||||
*/
|
||||
AccountRechargeVO rechargeVO = new AccountRechargeVO();
|
||||
rechargeVO.setAccountId(userId);
|
||||
rechargeVO.setRechargeRemark(userRechargeVO.getRechargeRemark());
|
||||
rechargeVO.setRechargeMoney(userRechargeVO.getRechargeMoney());
|
||||
iAccountRechargeService.saveSystemReduce(rechargeVO);
|
||||
}
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.com.tenlion.operator.controller.route.user.info;
|
||||
|
||||
import cn.com.tenlion.projectconfig.util.ProjectConfigUtil;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -35,10 +36,23 @@ public class UserInfoRouteController {
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@GetMapping("recharge-pay")
|
||||
public ModelAndView rechargePay() {
|
||||
ModelAndView modelAndView = new ModelAndView("user/info/recharge-pay");
|
||||
@GetMapping("package-list")
|
||||
public ModelAndView packageList() {
|
||||
ModelAndView modelAndView = new ModelAndView("user/info/package-list");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@GetMapping("recharge-pay")
|
||||
public ModelAndView rechargePay() {
|
||||
ModelAndView modelAndView = new ModelAndView("user/info/recharge-pay");
|
||||
modelAndView.addObject("phone", ProjectConfigUtil.getText("HandleInvoicePhones"));
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@GetMapping("package-writeoff")
|
||||
public ModelAndView packageWriteof() {
|
||||
ModelAndView modelAndView = new ModelAndView("user/info/package-writeoff");
|
||||
modelAndView.addObject("phone", ProjectConfigUtil.getText("HandleInvoicePhones"));
|
||||
return modelAndView;
|
||||
}
|
||||
}
|
@ -24,6 +24,8 @@ public class PackageOrderItemDTO {
|
||||
private String accountItemId;
|
||||
@ApiModelProperty(name = "mode", value = "方式1:次数+1,2:次数-1")
|
||||
private Integer mode;
|
||||
@ApiModelProperty(name = "itemUseCount", value = "本次使用")
|
||||
private Integer itemUseCount;
|
||||
@ApiModelProperty(name = "description", value = "流水描述")
|
||||
private String description;
|
||||
@ApiModelProperty(name = "orderId", value = "关联的平台订单ID")
|
||||
@ -41,6 +43,14 @@ public class PackageOrderItemDTO {
|
||||
@ApiModelProperty(name = "packageName", value = "套餐包名称")
|
||||
private String packageName;
|
||||
|
||||
public Integer getItemUseCount() {
|
||||
return itemUseCount == null ? 0 : itemUseCount;
|
||||
}
|
||||
|
||||
public void setItemUseCount(Integer itemUseCount) {
|
||||
this.itemUseCount = itemUseCount;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName == null ? "" : packageName.trim();
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package cn.com.tenlion.operator.pojo.vos.packageorder;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import ink.wgink.annotation.CheckNumberAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: PackageOrderVO
|
||||
* @Description: 套餐包-订单
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2025-02-26 14:48:15
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class PackageOrderWriteoffVO {
|
||||
|
||||
@ApiModelProperty(name = "packageOutCount", value = "核销次数")
|
||||
@CheckEmptyAnnotation(name = "核销次数")
|
||||
private Integer packageOutCount;
|
||||
@ApiModelProperty(name = "packageTotalMoney", value = "核销备注")
|
||||
@CheckEmptyAnnotation(name = "核销备注")
|
||||
private String packageOutRemark;
|
||||
|
||||
public Integer getPackageOutCount() {
|
||||
return packageOutCount == null ? 0 : packageOutCount;
|
||||
}
|
||||
|
||||
public void setPackageOutCount(Integer packageOutCount) {
|
||||
this.packageOutCount = packageOutCount;
|
||||
}
|
||||
|
||||
public String getPackageOutRemark() {
|
||||
return packageOutRemark == null ? "" : packageOutRemark.trim();
|
||||
}
|
||||
|
||||
public void setPackageOutRemark(String packageOutRemark) {
|
||||
this.packageOutRemark = packageOutRemark;
|
||||
}
|
||||
}
|
@ -34,6 +34,16 @@ public class PackageOrderItemAppVO {
|
||||
@ApiModelProperty(name = "code", value = "加密内容")
|
||||
@CheckEmptyAnnotation(name = "加密内容")
|
||||
private String code;
|
||||
@ApiModelProperty(name = "itemUseCount", value = "次数")
|
||||
private Integer itemUseCount;
|
||||
|
||||
public Integer getItemUseCount() {
|
||||
return itemUseCount == null ? 1 : itemUseCount;
|
||||
}
|
||||
|
||||
public void setItemUseCount(Integer itemUseCount) {
|
||||
this.itemUseCount = itemUseCount;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
|
@ -36,6 +36,15 @@ public class PackageOrderItemVO {
|
||||
private String orderTitle;
|
||||
@ApiModelProperty(name = "itemCount", value = "剩余次数")
|
||||
private Integer itemCount;
|
||||
@ApiModelProperty(name = "itemUseCount", value = "本次使用")
|
||||
private Integer itemUseCount;
|
||||
public Integer getItemUseCount() {
|
||||
return itemUseCount == null ? 1 : itemUseCount;
|
||||
}
|
||||
|
||||
public void setItemUseCount(Integer itemUseCount) {
|
||||
this.itemUseCount = itemUseCount;
|
||||
}
|
||||
|
||||
public Integer getItemCount() {
|
||||
return itemCount == null ? 0 : itemCount;
|
||||
|
@ -19,7 +19,8 @@ public class UserRechargeVO {
|
||||
@ApiModelProperty(name = "rechargeMoney", value = "金额")
|
||||
@CheckNumberAnnotation(name = "金额")
|
||||
private Double rechargeMoney;
|
||||
|
||||
@ApiModelProperty(name = "thirdPartyMode", value = "充值扣款")
|
||||
private String thirdPartyMode;
|
||||
@ApiModelProperty(name = "rechargeRemark", value = "备注")
|
||||
private String rechargeRemark;
|
||||
@ApiModelProperty(name = "userId", value = "用户")
|
||||
@ -29,6 +30,14 @@ public class UserRechargeVO {
|
||||
@ApiModelProperty(name = "code", value = "加密串")
|
||||
private String code;
|
||||
|
||||
public String getThirdPartyMode() {
|
||||
return thirdPartyMode == null ? "" : thirdPartyMode.trim();
|
||||
}
|
||||
|
||||
public void setThirdPartyMode(String thirdPartyMode) {
|
||||
this.thirdPartyMode = thirdPartyMode;
|
||||
}
|
||||
|
||||
public String getRechargeRemark() {
|
||||
return rechargeRemark == null ? "" : rechargeRemark.trim();
|
||||
}
|
||||
|
@ -38,6 +38,16 @@ public interface IAccountItemRemoteService {
|
||||
SuccessResult payOut(@RemoteServerParams String server,
|
||||
@RemoteJsonBodyParams AccountItemOrderVO accountItemOrderVO,
|
||||
@RemoteQueryParams("access_token") String accessToken);
|
||||
|
||||
/**
|
||||
* 支出
|
||||
* @param server
|
||||
* @param accountItemOrderVO
|
||||
* @param accessToken
|
||||
* @return
|
||||
*/
|
||||
@RemotePostMethod("pay-in/ai")
|
||||
SuccessResult payIn(@RemoteServerParams String server,
|
||||
@RemoteJsonBodyParams AccountItemOrderVO accountItemOrderVO,
|
||||
@RemoteQueryParams("access_token") String accessToken);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.com.tenlion.operator.service.packageorder;
|
||||
|
||||
import cn.com.tenlion.operator.pojo.vos.packageorder.PackageOrderAppVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.packageorder.PackageOrderWriteoffVO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import cn.com.tenlion.operator.pojo.dtos.packageorder.PackageOrderDTO;
|
||||
@ -202,4 +203,6 @@ public interface IPackageOrderService {
|
||||
void updateClose(String packageNo);
|
||||
|
||||
Map<String, Integer> getCount(String userId);
|
||||
|
||||
void updateWriteoff(String packageOrderId, PackageOrderWriteoffVO packageOrderWriteoffVO);
|
||||
}
|
@ -10,10 +10,13 @@ import cn.com.tenlion.operator.pojo.dtos.user.info.UserInfoDTO;
|
||||
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemOrderVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.packageorder.PackageOrderAppVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.packageorder.PackageOrderWriteoffVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.packageorderitem.PackageOrderItemAppVO;
|
||||
import cn.com.tenlion.operator.properties.SystemApiPathProperties;
|
||||
import cn.com.tenlion.operator.remote.accountitem.IAccountItemRemoteService;
|
||||
import cn.com.tenlion.operator.remote.user.info.IUserInfoRemoteService;
|
||||
import cn.com.tenlion.operator.service.packageinfo.IPackageInfoService;
|
||||
import cn.com.tenlion.operator.service.packageorderitem.IPackageOrderItemService;
|
||||
import cn.com.tenlion.operator.serviceother.operator.accountitem.IAccountItemService;
|
||||
import cn.com.tenlion.operator.serviceother.operator.accountrecharge.IAccountRechargeService;
|
||||
import cn.com.tenlion.operator.util.EncryptUtil;
|
||||
@ -273,6 +276,9 @@ public class PackageOrderServiceImpl extends DefaultBaseService implements IPack
|
||||
packageOrderDao.remove(params);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IPackageOrderItemService packageOrderItemService;
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getCount(String userId) {
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
@ -295,6 +301,24 @@ public class PackageOrderServiceImpl extends DefaultBaseService implements IPack
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWriteoff(String packageOrderId, PackageOrderWriteoffVO packageOrderWriteoffVO) {
|
||||
PackageOrderDTO packageOrderDTO = get(packageOrderId);
|
||||
if(packageOrderWriteoffVO.getPackageOutCount() > packageOrderDTO.getPackageTotalSurplusCount()) {
|
||||
throw new SaveException("核销次数超出了剩余次数");
|
||||
}
|
||||
PackageInfoDTO infoDTO = iPackageInfoService.get(packageOrderDTO.getPackageInfoId());
|
||||
PackageOrderItemAppVO packageOrderItemAppVO = new PackageOrderItemAppVO();
|
||||
packageOrderItemAppVO.setUserId(packageOrderDTO.getCreator());
|
||||
packageOrderItemAppVO.setOrderId("SYS" + DateUtil.getSdfTimes() + ( (int) (Math.random() * (99999 - 10000 + 1)) + 10000 ));
|
||||
packageOrderItemAppVO.setPackageOrderId(packageOrderId);
|
||||
packageOrderItemAppVO.setOrderType(infoDTO.getPackageType());
|
||||
packageOrderItemAppVO.setOrderTitle("系统核销");
|
||||
packageOrderItemAppVO.setItemUseCount(packageOrderWriteoffVO.getPackageOutCount());
|
||||
packageOrderItemAppVO.setDescription("系统核销 . " + packageOrderWriteoffVO.getPackageOutRemark());
|
||||
packageOrderItemService.saveApp("minus", packageOrderItemAppVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PackageOrderDTO> list(Map<String, Object> params) {
|
||||
List<PackageOrderDTO> list = packageOrderDao.list(params);
|
||||
|
@ -218,11 +218,11 @@ public class PackageOrderItemServiceImpl extends DefaultBaseService implements I
|
||||
throw new SaveException("无可用的套餐包");
|
||||
}
|
||||
if (!type.equals("plus")) {
|
||||
if (orderDTO.getPackageTotalSurplusCount() < 1) {
|
||||
if (orderDTO.getPackageTotalSurplusCount() < packageOrderItemAppVO.getItemUseCount()) {
|
||||
throw new SaveException("该套餐包余额不足");
|
||||
}
|
||||
}else{
|
||||
if (orderDTO.getPackageTotalCount() < orderDTO.getPackageTotalSurplusCount() + 1) {
|
||||
if (orderDTO.getPackageTotalCount() < orderDTO.getPackageTotalSurplusCount() + packageOrderItemAppVO.getItemUseCount()) {
|
||||
throw new SaveException("说你想干嘛?");
|
||||
}
|
||||
}
|
||||
@ -233,8 +233,9 @@ public class PackageOrderItemServiceImpl extends DefaultBaseService implements I
|
||||
itemVO.setOrderType(packageOrderItemAppVO.getOrderType());
|
||||
itemVO.setPackageOrderAvgMoney(orderDTO.getPackageTotalAvgMoney());
|
||||
itemVO.setMode(type.equals("plus") ? 1 : 2);
|
||||
itemVO.setItemUseCount( packageOrderItemAppVO.getItemUseCount() );
|
||||
itemVO.setOrderTitle(packageOrderItemAppVO.getOrderTitle());
|
||||
itemVO.setItemCount(type.equals("plus") ? orderDTO.getPackageTotalSurplusCount() + 1 : orderDTO.getPackageTotalSurplusCount() - 1);
|
||||
itemVO.setItemCount(type.equals("plus") ? orderDTO.getPackageTotalSurplusCount() + packageOrderItemAppVO.getItemUseCount() : orderDTO.getPackageTotalSurplusCount() - packageOrderItemAppVO.getItemUseCount());
|
||||
|
||||
String packageOrderItemId = UUIDUtil.getUUID();
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(itemVO);
|
||||
@ -252,7 +253,7 @@ public class PackageOrderItemServiceImpl extends DefaultBaseService implements I
|
||||
Map<String, Object> update = super.getHashMap(2);
|
||||
update.put("packageOrderId", orderDTO.getPackageOrderId() );
|
||||
update.put("gmtModified", currentDate);
|
||||
update.put("packageTotalSurplusCount", type.equals("plus") ? orderDTO.getPackageTotalSurplusCount() + 1 : orderDTO.getPackageTotalSurplusCount() - 1);
|
||||
update.put("packageTotalSurplusCount", type.equals("plus") ? orderDTO.getPackageTotalSurplusCount() + packageOrderItemAppVO.getItemUseCount() : orderDTO.getPackageTotalSurplusCount() - packageOrderItemAppVO.getItemUseCount());
|
||||
iPackageOrderService.updateCount(update);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,9 @@ public interface IAccountRechargeService {
|
||||
*/
|
||||
void save(AccountRechargeVO accountRechargeVO);
|
||||
|
||||
String saveSystem(AccountRechargeVO accountRechargeVO);
|
||||
void saveSystemReduce(AccountRechargeVO accountRechargeVO);
|
||||
|
||||
void saveSystem(AccountRechargeVO accountRechargeVO);
|
||||
|
||||
/**
|
||||
* 新增账户充值
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.com.tenlion.operator.serviceother.operator.accountrecharge.impl;
|
||||
|
||||
import cn.com.tenlion.operator.controller.api.user.info.PayVO;
|
||||
import cn.com.tenlion.operator.daoother.operator.IAccountRechargeDao;
|
||||
import cn.com.tenlion.operator.daoother.operator.userinfo.IUserInfoDao;
|
||||
import cn.com.tenlion.operator.enums.RechargeCheckEnum;
|
||||
@ -16,10 +17,12 @@ import cn.com.tenlion.operator.pojo.dtos.packageinfo.PackageInfoDTO;
|
||||
import cn.com.tenlion.operator.pojo.dtos.packageorder.PackageOrderDTO;
|
||||
import cn.com.tenlion.operator.pojo.dtos.user.info.UserInfoDTO;
|
||||
import cn.com.tenlion.operator.pojo.pos.accountrecharge.AccountRechargePO;
|
||||
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemOrderVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeVO;
|
||||
import cn.com.tenlion.operator.pojo.vos.packageorder.PackageOrderAppVO;
|
||||
import cn.com.tenlion.operator.properties.SystemApiPathProperties;
|
||||
import cn.com.tenlion.operator.remote.accountitem.IAccountItemRemoteService;
|
||||
import cn.com.tenlion.operator.service.packageinfo.IPackageInfoService;
|
||||
import cn.com.tenlion.operator.service.packageorder.IPackageOrderService;
|
||||
import cn.com.tenlion.operator.serviceother.operator.account.IAccountService;
|
||||
@ -27,6 +30,7 @@ import cn.com.tenlion.operator.serviceother.operator.accountitem.IAccountItemSer
|
||||
import cn.com.tenlion.operator.serviceother.operator.accountrecharge.IAccountRechargeService;
|
||||
import cn.com.tenlion.operator.service.user.info.IUserInfoService;
|
||||
import cn.com.tenlion.operator.service.sys.callback.SysCallbackService;
|
||||
import cn.com.tenlion.operator.util.EncryptUtil;
|
||||
import cn.com.tenlion.operator.util.PayUtil;
|
||||
import cn.com.tenlion.operator.util.TenlionSMS;
|
||||
import cn.com.tenlion.operator.util.UserUtil;
|
||||
@ -39,6 +43,7 @@ import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.user.IUserBaseService;
|
||||
import ink.wgink.module.oauth2.manager.OAuth2ClientTokenManager;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
@ -84,6 +89,8 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
||||
private SysCallbackService sysCallbackService;
|
||||
@Autowired
|
||||
private IAccountItemService iAccountItemService;
|
||||
@Autowired
|
||||
private IAccountItemRemoteService iAccountItemRemoteService;
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<AccountRechargeInvoiceDTO>> getCanIsSueInvoices(String userId, ListPage page) {
|
||||
@ -117,39 +124,81 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveSystem(AccountRechargeVO accountRechargeVO) {
|
||||
accountRechargeVO.setReconciliationStatus("0");
|
||||
public void saveSystemReduce(AccountRechargeVO accountRechargeVO) {
|
||||
// 生成流水记录
|
||||
AccountItemOrderVO accountItemOrderVO = new AccountItemOrderVO();
|
||||
accountItemOrderVO.setOrderId("SYS" + DateUtil.getSdfTimes() + ( (int) (Math.random() * (99999 - 10000 + 1)) + 10000 ));
|
||||
accountItemOrderVO.setUserId(accountRechargeVO.getAccountId()); // 代理商userId
|
||||
accountItemOrderVO.setAccountMoney(PayUtil.buiderMoney(accountRechargeVO.getRechargeMoney()));
|
||||
accountItemOrderVO.setDescription("系统扣款" + (StringUtils.isEmpty(accountRechargeVO.getRechargeRemark()) ? "" : " * " + accountRechargeVO.getRechargeRemark() ) );
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("time", DateUtil.getTime());
|
||||
jsonObject.put("money" ,PayUtil.buiderMoney(accountRechargeVO.getRechargeMoney()));
|
||||
jsonObject.put("userId", accountRechargeVO.getAccountId());
|
||||
jsonObject.put("orderId", accountItemOrderVO.getOrderId());
|
||||
accountItemOrderVO.setCode(EncryptUtil.encode(jsonObject.toJSONString()));
|
||||
accountItemOrderVO.setType(4);
|
||||
iAccountItemRemoteService.payOut(apiPathProperties.getUserCenter(), accountItemOrderVO, getAccessToken());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSystem(AccountRechargeVO accountRechargeVO) {
|
||||
accountRechargeVO.setReconciliationStatus("1");
|
||||
accountRechargeVO.setRechargeCheck("2");
|
||||
String accountRechargeId = getUUID("sys");
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(accountRechargeVO);
|
||||
params.put("accountRechargeId", accountRechargeId);
|
||||
params.put("reconciliationTime", DateUtil.getTime());
|
||||
setSaveInfo(params);
|
||||
accountRechargeDao.save(params);
|
||||
|
||||
AccountRechargeDTO dto = get(accountRechargeId);
|
||||
if (StringUtils.isEmpty(dto.getAccountItemId()) && dto.getReconciliationStatus().equals(ReconciliationStatusEnum.UN_RECONCILIATION.getValue())) {
|
||||
// 1. 生成流水记录
|
||||
AccountItemVO vo = new AccountItemVO();
|
||||
vo.setType(1);
|
||||
vo.setMode(1);
|
||||
vo.setAccountId(dto.getAccountId());
|
||||
vo.setAccountMoney(PayUtil.buiderMoney(dto.getRechargeMoney()));
|
||||
vo.setDescription("系统充值" + (StringUtils.isEmpty(accountRechargeVO.getRechargeRemark()) ? "" : " * " + accountRechargeVO.getRechargeRemark() ) );
|
||||
iAccountItemService.saveReturnId(vo);
|
||||
// 1. 生成流水记录
|
||||
/* AccountItemVO vo = new AccountItemVO();
|
||||
vo.setType(1);
|
||||
vo.setMode(1);
|
||||
vo.setAccountId(dto.getAccountId());
|
||||
vo.setAccountMoney(PayUtil.buiderMoney(dto.getRechargeMoney()));
|
||||
vo.setDescription("系统充值" + (StringUtils.isEmpty(accountRechargeVO.getRechargeRemark()) ? "" : " * " + accountRechargeVO.getRechargeRemark() ) );
|
||||
iAccountItemService.saveReturnId(vo);*/
|
||||
|
||||
|
||||
// 生成流水记录
|
||||
AccountItemOrderVO accountItemOrderVO = new AccountItemOrderVO();
|
||||
accountItemOrderVO.setOrderId("SYS" + DateUtil.getSdfTimes() + ( (int) (Math.random() * (99999 - 10000 + 1)) + 10000 ));
|
||||
accountItemOrderVO.setUserId(accountRechargeVO.getAccountId()); // 代理商userId
|
||||
accountItemOrderVO.setType(1);
|
||||
accountItemOrderVO.setAccountMoney(PayUtil.buiderMoney(accountRechargeVO.getRechargeMoney()));
|
||||
accountItemOrderVO.setDescription("系统充值" + (StringUtils.isEmpty(accountRechargeVO.getRechargeRemark()) ? "" : " * " + accountRechargeVO.getRechargeRemark() ) );
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("time", DateUtil.getTime());
|
||||
jsonObject.put("money" ,PayUtil.buiderMoney(accountRechargeVO.getRechargeMoney()));
|
||||
jsonObject.put("userId", accountRechargeVO.getAccountId());
|
||||
jsonObject.put("orderId", accountItemOrderVO.getOrderId());
|
||||
accountItemOrderVO.setCode(EncryptUtil.encode(jsonObject.toJSONString()));
|
||||
iAccountItemRemoteService.payIn(apiPathProperties.getUserCenter(), accountItemOrderVO, getAccessToken());
|
||||
|
||||
try{
|
||||
// 3. 调用第三方接口, 告知充值到账
|
||||
JSONObject jsonobject =new JSONObject();
|
||||
jsonobject.put("money", dto.getRechargeMoney());
|
||||
sysCallbackService.save("系统充值到账", systemApiPathProperties.getCopyright() + "api/pay/recharge-success/user-id/" + dto.getAccountId(), jsonobject);
|
||||
// 更新到账状态
|
||||
Map<String, Object> params1 = getHashMap(2);
|
||||
params1.put("accountRechargeIds", "1");
|
||||
params1.put("reconciliationTime", DateUtil.getTime());
|
||||
params1.put("accountRechargeId", accountRechargeId);
|
||||
accountRechargeDao.update(params1);
|
||||
jsonobject.put("money", accountRechargeVO.getRechargeMoney());
|
||||
sysCallbackService.save("系统充值到账", systemApiPathProperties.getCopyright() + "api/pay/recharge-success/user-id/" + accountRechargeVO.getAccountId(), jsonobject);
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return accountRechargeId;
|
||||
/**
|
||||
* 获取accesstoken
|
||||
* @return
|
||||
*/
|
||||
private String getAccessToken(){
|
||||
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
||||
if(StringUtils.isBlank(accessToken)){
|
||||
throw new SearchException("获取accesstoken失败");
|
||||
}
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,6 +12,7 @@
|
||||
<result column="order_id" property="orderId"/>
|
||||
<result column="package_name" property="packageName"/>
|
||||
<result column="item_count" property="itemCount"/>
|
||||
<result column="item_use_count" property="itemUseCount"/>
|
||||
<result column="order_type" property="orderType"/>
|
||||
<result column="order_title" property="orderTitle"/>
|
||||
<result column="creator" property="creator"/>
|
||||
@ -56,6 +57,7 @@
|
||||
mode,
|
||||
description,
|
||||
item_count,
|
||||
item_use_count,
|
||||
order_id,
|
||||
order_type,
|
||||
order_title,
|
||||
@ -69,6 +71,7 @@
|
||||
#{mode},
|
||||
#{description},
|
||||
#{itemCount},
|
||||
#{itemUseCount},
|
||||
#{orderId},
|
||||
#{orderType},
|
||||
#{orderTitle},
|
||||
@ -134,7 +137,8 @@
|
||||
t1.order_id,
|
||||
t1.order_type,
|
||||
t1.order_title,
|
||||
t1.package_order_item_id
|
||||
t1.package_order_item_id,
|
||||
t1.item_use_count
|
||||
FROM
|
||||
operator_package_order_item t1
|
||||
WHERE
|
||||
@ -208,7 +212,8 @@
|
||||
t1.order_title,
|
||||
t1.creator,
|
||||
t1.gmt_create,
|
||||
t3.package_name
|
||||
t3.package_name,
|
||||
t1.item_use_count
|
||||
FROM
|
||||
operator_package_order_item t1
|
||||
LEFT JOIN
|
||||
|
@ -87,16 +87,17 @@
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'mode', width: 100, title: '类型', align:'center', fixed: 'left',
|
||||
{field: 'mode', width: 120, title: '类型', align:'center', fixed: 'left',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
var itemUseCount = row["itemUseCount"];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
if(rowData == 1) {
|
||||
return '<span class="layui-badge layui-bg-green">退回 + 1次</span>';
|
||||
return '<span class="layui-badge layui-bg-green">退回 + ' + itemUseCount + ' 次</span>';
|
||||
}else if(rowData == 2) {
|
||||
return '<span class="layui-badge">使用 - 1 次</span>';
|
||||
return '<span class="layui-badge">使用 - ' + itemUseCount + ' 次</span>';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
|
@ -104,7 +104,10 @@
|
||||
<i class="fa fa-lg fa-globe "></i> 充值记录
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="rechargeEvent">
|
||||
<i class="fa fa-lg fa-shopping-bag "></i> 系统充值
|
||||
<i class="fa fa-lg fa-paypal "></i> 充值与扣款
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="packageEvent">
|
||||
<i class="fa fa-lg fa-shopping-bag "></i> 用户套餐包
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
@ -434,7 +437,7 @@
|
||||
} else {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: "用户 <b>" + checkDatas[0].userName + "</b> <b style='color: rgba(255, 127, 80, 0.75)'>" + checkDatas[0].userInfoName+ "</b> 系统充值【<b style='color: rgba(255, 27, 20, 0.75)'>当前余额 " + (checkDatas[0].accountMoney / 100.0) + ' 元</b>】',
|
||||
title: "用户 <b>" + checkDatas[0].userName + "</b> <b style='color: rgba(255, 127, 80, 0.75)'>" + checkDatas[0].userInfoName+ "</b> 系统充值与扣款【<b style='color: rgba(255, 27, 20, 0.75)'>当前余额 " + (checkDatas[0].accountMoney / 100.0) + ' 元</b>】',
|
||||
closeBtn: 1,
|
||||
area: ['50%', '50%'],
|
||||
shadeClose: true,
|
||||
@ -445,6 +448,25 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
}else if(layEvent === 'packageEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
} else if(checkDatas.length > 1) {
|
||||
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||
} else {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: "用户 <b>" + checkDatas[0].userName + "</b> <b style='color: rgba(255, 127, 80, 0.75)'>" + checkDatas[0].userInfoName+ "</b> 套餐包【<b style='color: rgba(255, 27, 20, 0.75)'>当前余额 " + (checkDatas[0].accountMoney / 100.0) + ' 元</b>】',
|
||||
closeBtn: 1,
|
||||
area: ['80%', '80%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/user/info/package-list?accountId={accountId}', [checkDatas[0].userId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
}else if(layEvent === 'rechargeRecordEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
|
317
src/main/resources/templates/user/info/package-list.html
Normal file
317
src/main/resources/templates/user/info/package-list.html
Normal file
@ -0,0 +1,317 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item" >
|
||||
<select id="keYong" name="keYong">
|
||||
<option value="">全部</option>
|
||||
<option value="keYong" selected>未用完的</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- <div class="layui-inline layui-form search-item" >
|
||||
<select id="packagePayStatus" name="packagePayStatus">
|
||||
<option value="">付款状态</option>
|
||||
<option value="1">已付款</option>
|
||||
<option value="0">未付款</option>
|
||||
</select>
|
||||
</div>-->
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-recycle"></i> 使用记录
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="writeOffEvent">
|
||||
<i class="fa fa-lg fa-paypal"></i> 套餐包核销
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var accountId = top.restAjax.params(window.location.href).accountId;
|
||||
var tableUrl = 'api/packageorder/listpage?userId=' + accountId;
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
defaultToolbar:[],
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
where: {
|
||||
keYong: 'keYong'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'packageName', width: 210, title: '套餐名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'packageOrderId', width: 210, title: '订单号', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'userName', width: 320, title: '购买人', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
var userType = row["userType"];
|
||||
var creator = row["creator"];
|
||||
var userUsername = row["userUsername"];
|
||||
if(creator == '1') {
|
||||
return '<b>系统管理员</b>';
|
||||
}
|
||||
return '<img style="height:21px;width:21px" src="assets/images/plugin/' + userType + '.png"/><span>' + (rowData + '【' + userUsername + '】' ) + '</span>';
|
||||
}
|
||||
},
|
||||
{field: 'packageTotalMoney', width: 120, title: '订单金额', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return (rowData / 100) + "元";
|
||||
}
|
||||
},
|
||||
{field: 'packageTotalSurplusCount', width: 150, title: '总件/剩余件', align:'center',
|
||||
templet: function(row) {
|
||||
var packageTotalCount = row["packageTotalCount"];
|
||||
var rowData = row[this.field];
|
||||
return packageTotalCount + " / " + (rowData == 0 ? '<font style="color: red">0</font>' : rowData);
|
||||
}
|
||||
},
|
||||
{field: 'gmtCreate', width: 180, title: '购买时间', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'packagePayStatus', width: 120, title: '付款状态', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '' || rowData == '0') {
|
||||
return '-';
|
||||
}
|
||||
if(rowData == '1') {
|
||||
return '<b style="color:green">已付款</b>';
|
||||
}
|
||||
}
|
||||
},
|
||||
{field: 'packagePay', width: 180, title: '付款时间', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val(),
|
||||
userInfoType: $('#userInfoType').val(),
|
||||
packagePayStatus: $('#packagePayStatus').val(),
|
||||
keYong: $('#keYong').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
});
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
}
|
||||
// 删除
|
||||
function removeData(ids) {
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/packageorder/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
initTable();
|
||||
initDate();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
// 事件 - 增删改
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'saveEvent') {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: "用户 <b>" + checkDatas[0].userUsername + "</b> <b style='color: rgba(255, 127, 80, 0.75)'>" + checkDatas[0].userName+ "</b> 订单 " + checkDatas[0].packageOrderId + " 的使用流水",
|
||||
closeBtn: 1,
|
||||
area: ['90%', '90%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/packageorderitem/list?packageOrderId={packageOrderId}', [checkDatas[0].packageOrderId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'writeOffEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
} else if(checkDatas.length > 1) {
|
||||
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||
} else {
|
||||
if(checkDatas[0].packageTotalSurplusCount < 1) {
|
||||
layer.msg("选择的套餐包已用完");
|
||||
reloadTable();
|
||||
return;
|
||||
}
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: "用户 <b>" + checkDatas[0].userUsername + "</b> <b style='color: rgba(255, 127, 80, 0.75)'>" + checkDatas[0].userName+ "</b> 订单 " + checkDatas[0].packageOrderId + " 套餐包核销",
|
||||
closeBtn: 1,
|
||||
area: ['50%', '50%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/user/info/package-writeoff?packageOrderId={packageOrderId}', [checkDatas[0].packageOrderId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if(layEvent === 'removeEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||
} else {
|
||||
var ids = '';
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
}
|
||||
ids += item['packageOrderId'];
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
221
src/main/resources/templates/user/info/package-writeoff.html
Normal file
221
src/main/resources/templates/user/info/package-writeoff.html
Normal file
@ -0,0 +1,221 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div class="layui-form-item layui-row" >
|
||||
<div class="layui-col-xs6 layui-col-md6 layui-col-lg6" >
|
||||
<label class="layui-form-label">交易流水号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="packageNo" name="packageNo" readonly class="layui-input" value="" placeholder="请输入交易流水号" maxlength="50">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-md6 layui-col-lg6" >
|
||||
<label class="layui-form-label">付款时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="packagePay" readonly name="packagePay" class="layui-input" value="" placeholder="请输入订单付款时间" maxlength="50">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-row" >
|
||||
<div class="layui-col-xs6 layui-col-md6 layui-col-lg6" >
|
||||
<label class="layui-form-label">订单总金额</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="packageTotalMoney" readonly name="packageTotalMoney" class="layui-input" value="" placeholder="请输入套餐订单总金额/单位分" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-md6 layui-col-lg6" >
|
||||
<label class="layui-form-label">订单总次数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="packageTotalCount" readonly name="packageTotalCount" class="layui-input" value="" placeholder="请输入套餐订单总次数/单位分" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-row" >
|
||||
<div class="layui-col-xs6 layui-col-md6 layui-col-lg6" >
|
||||
<label class="layui-form-label">单次均价</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="packageTotalAvgMoney" readonly name="packageTotalAvgMoney" class="layui-input" value="" placeholder="请输入套餐订单单次均价/单位分" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-md6 layui-col-lg6" >
|
||||
<label class="layui-form-label">剩余次数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="packageTotalSurplusCount" readonly name="packageTotalSurplusCount" class="layui-input" value="" placeholder="请输入当前剩余次数" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-row" >
|
||||
<div class="layui-col-xs6 layui-col-md6 layui-col-lg6" >
|
||||
<label class="layui-form-label">核销次数<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="packageOutCount" name="packageOutCount" class="layui-input" value="" placeholder="请输入本次需要核销的次数" maxlength="50">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-md6 layui-col-lg6" >
|
||||
<label class="layui-form-label">核销备注<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="packageOutRemark" name="packageOutRemark" class="layui-input" value="" placeholder="请输入核销备注" maxlength="50">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交核销</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var packageOrderId = top.restAjax.params(window.location.href).packageOrderId;
|
||||
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
function refreshDownloadTemplet(fileName, file) {
|
||||
var dataRander = {};
|
||||
dataRander[fileName] = file;
|
||||
|
||||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化文件列表
|
||||
function initFileList(fileName, ids, callback) {
|
||||
var dataForm = {};
|
||||
dataForm[fileName] = ids;
|
||||
form.val('dataForm', dataForm);
|
||||
|
||||
if(!ids) {
|
||||
refreshDownloadTemplet(fileName, []);
|
||||
if(callback) {
|
||||
callback(fileName, []);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
refreshDownloadTemplet(fileName, data);
|
||||
if(callback) {
|
||||
callback(fileName, data);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化视频
|
||||
function initVideo(fileName, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var player = new ckplayer({
|
||||
container: '#'+ fileName + i,
|
||||
variable: 'player',
|
||||
flashplayer: false,
|
||||
video: {
|
||||
file: 'route/file/download/true/'+ item.fileId,
|
||||
type: 'video/mp4'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/packageorder/get/{packageOrderId}', [packageOrderId]), {}, null, function(code, data) {
|
||||
var dataFormData = {};
|
||||
for(var i in data) {
|
||||
dataFormData[i] = data[i] +'';
|
||||
}
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render(null, 'dataForm');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm("该操作提交后无法回退, 确认核销?", function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/packageorder/update-writeoff/{packageOrderId}', [packageOrderId]), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg("核销成功", {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -35,14 +35,14 @@
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<input type="hidden" id="accountRechargeId" name="accountRechargeId" value=""/>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">充值金额<span style="color: red">*</span></label>
|
||||
<label class="layui-form-label">操作金额<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="rechargeMoney" value="" step="0.1" max="2000" name="rechargeMoney" class="layui-input" placeholder="请输入充值的金额" lay-verify="required" style="width: 70%;float: left" maxlength="36">
|
||||
<input type="number" id="rechargeMoney" value="" step="0.1" max="2000" name="rechargeMoney" class="layui-input" placeholder="请输入操作的金额" lay-verify="required" style="width: 70%;float: left" maxlength="36">
|
||||
<button type="button" class="layui-btn" style="width: 30%" >元</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane="">
|
||||
<label class="layui-form-label">付款方式<span style="color: red">*</span></label>
|
||||
<label class="layui-form-label">交易方式<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="thirdParty" lay-skin="primary" disabled lay-verify="required" value="微信" lay-filter="thirdParty" title="微信">
|
||||
<input type="radio" name="thirdParty" value="支付宝" disabled lay-filter="thirdParty" title="支付宝">
|
||||
@ -50,16 +50,23 @@
|
||||
<input type="radio" name="thirdParty" value="对公转账" disabled lay-filter="thirdParty" title="对公转账">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane="">
|
||||
<label class="layui-form-label">充值扣款<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="thirdPartyMode" value="充值" lay-verify="required" title="充值">
|
||||
<input type="radio" name="thirdPartyMode" value="扣款" lay-verify="required" title="扣款">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">备注内容<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="rechargeRemark" name="rechargeRemark" class="layui-input" placeholder="请输入备注内容" >
|
||||
<input type="text" id="rechargeRemark" name="rechargeRemark" lay-verify="required" class="layui-input" placeholder="请输入备注内容" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" id="submit" lay-submit lay-filter="submitForm">确认充值</button>
|
||||
<button type="button" class="layui-btn" id="submit" lay-submit lay-filter="submitForm">确认操作</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">关闭窗口</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -104,13 +111,21 @@
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm("提交后会充值到用户账号中,且无法回退。", function(index) {
|
||||
top.dialog.confirm("提交后会直接操作用户账号,且无法回退。", function(index) {
|
||||
$('#submit').attr("disabled", "disabled");
|
||||
$('#submit').addClass("layui-btn-disabled");
|
||||
top.dialog.close(index);
|
||||
/*
|
||||
layer.prompt({title: '已发送验证码 至 [[${phone}]]', formType: 3 , value: "" , placeholder : "请输入验证码" }, function(title, index1){
|
||||
if(title) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/user/info/save-recharge/{accountId}', [accountId]), formData.field, null, function(code, data) {
|
||||
layer.alert("充值成功");
|
||||
layer.alert("操作成功");
|
||||
closeBox();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
|
Loading…
Reference in New Issue
Block a user