提交 d23f84c1 作者: xiaowang

商城云享金余额扣减

上级 a592ee2a
package com.mmc.iuav.user.model.fdd.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author LW
* @date 2023/9/8 11:12
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SealVO implements Serializable {
private static final long serialVersionUID = -8686644521460467009L;
@ApiModelProperty(value = "印章路径")
private String sealUrl;
@ApiModelProperty(value = "印章名称")
private String sealName;
@ApiModelProperty(value = "用户id", hidden = true)
private String unionId;
@ApiModelProperty(value = "端口:0小程序 1后台")
private Integer port;
@ApiModelProperty(value = "印章状态 0非默认 1默认")
private Integer sealStatus;
}
...@@ -20,7 +20,7 @@ public class PayUavWalletVO implements Serializable { ...@@ -20,7 +20,7 @@ public class PayUavWalletVO implements Serializable {
private static final long serialVersionUID = 1683979749411588941L; private static final long serialVersionUID = 1683979749411588941L;
@ApiModelProperty(value = "用户ID") @ApiModelProperty(value = "用户ID", required = true)
private Integer userAccountId; private Integer userAccountId;
@ApiModelProperty(value = "云享金") @ApiModelProperty(value = "云享金")
...@@ -29,6 +29,9 @@ public class PayUavWalletVO implements Serializable { ...@@ -29,6 +29,9 @@ public class PayUavWalletVO implements Serializable {
@ApiModelProperty(value = "佣金") @ApiModelProperty(value = "佣金")
private BigDecimal salaryAmount; private BigDecimal salaryAmount;
@ApiModelProperty(value = "订单状态 100:订单支付 1400:商城订单退款") @ApiModelProperty(value = "订单状态 100:订单支付 1400:商城订单退款 1500:订单提成", required = true)
private Integer orderStatus; private Integer orderStatus;
@ApiModelProperty(value = "订单备注")
private String remark;
} }
...@@ -18,6 +18,8 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -18,6 +18,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("1002", "企业信息与营业执照信息不一致,请重新上传"), BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("1002", "企业信息与营业执照信息不一致,请重新上传"),
THE_BRAND_NAME_CANNOT_BE_EMPTY("1003", "品牌名称不能为空"), THE_BRAND_NAME_CANNOT_BE_EMPTY("1003", "品牌名称不能为空"),
THE_BRAND_LOGO_CANNOT_BE_EMPTY("1004", "logo图标不能为空"), THE_BRAND_LOGO_CANNOT_BE_EMPTY("1004", "logo图标不能为空"),
BUSINESS_LICENSE_CHECK_ERROR("1005", "未进行(企业/个人)认证"),
BUSINESS_LICENSE_CHECK_NOT_PASS("1006", "(企业/个人)认证未通过"),
TAG_ALREADY_EXIST_ERROR("2001", "您已拥有该身份,不需要重复提交"), TAG_ALREADY_EXIST_ERROR("2001", "您已拥有该身份,不需要重复提交"),
TAG_APPLY_ALREADY_EXIST_ERROR("2002", "已存在申请记录,不可重复申请"), TAG_APPLY_ALREADY_EXIST_ERROR("2002", "已存在申请记录,不可重复申请"),
......
package com.mmc.iuav.user.controller.fdd;
/**
* @Author LW
* @date 2022/8/31 15:28
* 概要:
*/
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.controller.BaseController;
import com.mmc.iuav.user.model.fdd.vo.SealVO;
import com.mmc.iuav.user.service.fdd.SealManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
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 javax.servlet.http.HttpServletRequest;
/**
* @Author LW
* @date 2022/8/3 10:22
* 概要:
*/
@Api(tags = {"无人机城--印章管理模块-接口" })
@RequestMapping("/seal/")
@RestController
public class SealManageController extends BaseController {
@Autowired
private SealManageService sealManageService;
@ApiOperation(value = "上传印章")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("/uploadSeal")
public ResultBody uploadSeal(@RequestBody SealVO sealVO, HttpServletRequest request) {
return sealManageService.uploadSeal(sealVO, this.getUserLoginInfoFromRedis(request));
}
// @ApiOperation(value = "当前用户印章列表")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = SealInfoDTO.class)})
// @PostMapping("/getSealInfoList")
// public ResultBody getSealInfoList(HttpServletRequest request, @RequestBody SealInfoVO param) {
// return ResultBody.success(uavAppSealManageService.getSealInfoList(this.getCurrentAccount(request).getId(), param));
// }
//
// @ApiOperation(value = "删除印章")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
// @GetMapping("/removeSeal")
// public ResultBody removeSeal(@ApiParam(value = "印章编号") @RequestParam(value = "signatureId") String signatureId,
// HttpServletRequest request,
// @ApiParam(value = "小程序用户unionId") @RequestParam(value = "unionId", required = false) String unionId
// ) {
// return uavAppSealManageService.removeSeal(signatureId, unionId, this.getCurrentAccount(request).getId());
// }
//
// @ApiOperation(value = "设置默认签章")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
// @GetMapping("/defaultSeal")
// public ResultBody defaultSeal(@ApiParam(value = "印章编号") @RequestParam(value = "signatureId") String signatureId, HttpServletRequest request,
// @ApiParam(value = "小程序用户unionId") @RequestParam(value = "unionId", required = false) String unionId) {
// return uavAppSealManageService.defaultSeal(signatureId, this.getCurrentAccount(request).getId(), unionId);
// }
//
// @ApiOperation(value = "替换印章图片")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
// @PostMapping("/replaceSealImg")
// public ResultBody replaceSealImg(@RequestBody UavSealInfoVO param, HttpServletRequest request) throws Exception {
// return uavAppSealManageService.replaceSealImg(param, this.getCurrentAccount(request).getId());
// }
//
// @ApiOperation(value = "查看印章信息")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
// @GetMapping("/getSealInfo")
// public ResultBody getSealInfo(@ApiParam(value = "印章编号") @RequestParam(value = "signatureId") String signatureId, HttpServletRequest request) {
// return uavAppSealManageService.getSealInfo(signatureId, this.getCurrentAccount(request).getId());
// }
}
package com.mmc.iuav.user.dao.fdd;
import com.mmc.iuav.user.entity.fdd.SealInfoDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @Author LW
* @date 2023/9/8 14:36
* 概要:
*/
@Mapper
public interface SealManageDao {
void insertSealInfo(SealInfoDO sealInfoDO);
}
package com.mmc.iuav.user.entity.fdd;
import java.io.Serializable;
import java.util.Date;
/**
* (SealInfoDO)实体类
*
* @author makejava
* @since 2023-09-08 14:30:13
*/
public class SealInfoDO implements Serializable {
private static final long serialVersionUID = -88451609760389058L;
private Integer id;
/**
* 印章名称
*/
private String sealName;
/**
* 印章编号
*/
private String signatureId;
/**
* 用户唯一标识
*/
private String unionId;
/**
* 印章状态:0未使用 1使用中
*/
private Integer sealStatus;
/**
* 印章图片
*/
private String sealUrl;
private Date createTime;
private Date updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSealName() {
return sealName;
}
public void setSealName(String sealName) {
this.sealName = sealName;
}
public String getSignatureId() {
return signatureId;
}
public void setSignatureId(String signatureId) {
this.signatureId = signatureId;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public Integer getSealStatus() {
return sealStatus;
}
public void setSealStatus(Integer sealStatus) {
this.sealStatus = sealStatus;
}
public String getSealUrl() {
return sealUrl;
}
public void setSealUrl(String sealUrl) {
this.sealUrl = sealUrl;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
...@@ -17,7 +17,8 @@ public enum PayMethodEnums { ...@@ -17,7 +17,8 @@ public enum PayMethodEnums {
FLYING_HAND_NOT_CONFIRMED_GT(900, "飞手未确认修改金额大于原订单状态"), FLYING_HAND_NOT_CONFIRMED_GT(900, "飞手未确认修改金额大于原订单状态"),
FLYING_HAND_CONFIRM_LT(1000, "飞手确认修改金额小于原订单状态"), FLYING_HAND_CONFIRM_LT(1000, "飞手确认修改金额小于原订单状态"),
USER_TOP_UP(1100, "充值"), USER_TOP_UP(1100, "充值"),
PAY_UAV_ORDER_REFUND(1400, "商城订单退款"); PAY_UAV_ORDER_REFUND(1400, "商城订单退款"),
ORDER_INCOME(1500, "订单收益");
PayMethodEnums(Integer code, String method) { PayMethodEnums(Integer code, String method) {
this.code = code; this.code = code;
......
package com.mmc.iuav.user.service.fdd;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.fdd.vo.SealVO;
/**
* @Author LW
* @date 2022/8/31 17:29
* 概要:
*/
public interface SealManageService {
ResultBody uploadSeal(SealVO sealVO, LoginSuccessDTO loginSuccessDTO);
// /**
// * 获取当前用户印章列表
// * @param id
// * @param param
// * @return
// */
// PageResult getSealInfoList(Integer id, SealInfoVO param);
//
// /**
// * 删除印章信息
// * @param signatureId
// * @param id
// * @return
// */
// ResultBody removeSeal(String signatureId, String unionId,Integer id);
//
// /***
// *设置默认章
// * @param signatureId
// * @param id
// * @return
// */
// ResultBody defaultSeal(String signatureId, Integer id,String unionId);
//
// /**
// * 替换印章信息
// * @param param
// * @param id
// * @return
// */
// ResultBody replaceSealImg(UavSealInfoVO param, Integer id) throws Exception;
//
// /**
// * 获取印章详情
// * @param signatureId
// * @param id
// * @return
// */
// ResultBody getSealInfo(String signatureId, Integer id);
}
package com.mmc.iuav.user.service.fdd.impl;
import com.alibaba.fastjson2.JSONObject;
import com.fadada.sdk.base.client.FddBaseClient;
import com.fadada.sdk.base.model.req.AddSignatureParams;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.constant.fdd.FddConnectConstant;
import com.mmc.iuav.user.constant.fdd.FddConstant;
import com.mmc.iuav.user.dao.UserServiceDao;
import com.mmc.iuav.user.dao.fdd.SealManageDao;
import com.mmc.iuav.user.dao.fdd.UserFddAuthDao;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.fdd.SealInfoDO;
import com.mmc.iuav.user.entity.fdd.UserFddDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.fdd.vo.SealVO;
import com.mmc.iuav.user.service.fdd.SealManageService;
import com.mmc.iuav.user.service.fdd.UserFddAuthService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Author LW
* @date 2022/8/31 17:29
* 概要:
*/
@Service
public class SealManageServiceImpl implements SealManageService {
@Resource
UserServiceDao userServiceDao;
@Resource
UserFddAuthService userFddAuthService;
@Resource
UserFddAuthDao userFddAuthDao;
@Resource
SealManageDao sealManageDao;
@Override
public ResultBody uploadSeal(SealVO sealVO, LoginSuccessDTO loginSuccessDTO) {
// 判断当前用户是那个端口进来的用户,根据不同端口用户设置不同的unionId
if (sealVO.getPort().equals(0)) {
UserAccountDO userInfo = userServiceDao.getUserAccountById(loginSuccessDTO.getUserAccountId());
String uid = userFddAuthService.replaceUnableString(userInfo.getUnionId());
sealVO.setUnionId(uid);
} else {
sealVO.setUnionId(loginSuccessDTO.getUserAccountId().toString());
}
// 获取用户法大大的(实名/企业)认证信息
UserFddDO userFddInfo = userFddAuthDao.getAppUserFddInfo(sealVO.getUnionId());
if (userFddInfo == null) {
return ResultBody.error(ResultEnum.BUSINESS_LICENSE_CHECK_ERROR);
} else if (!userFddInfo.getPersonVerifyStatus().equals(2) || !userFddInfo.getEntVerifyStatus().equals(4)) {
return ResultBody.error(ResultEnum.BUSINESS_LICENSE_CHECK_NOT_PASS);
}
FddBaseClient baseClient = new FddBaseClient(FddConnectConstant.APP_ID, FddConnectConstant.APP_KEY, FddConnectConstant.VERSION, FddConnectConstant.HOST);
AddSignatureParams params = new AddSignatureParams();
//客户编号
params.setCustomerId(userFddInfo.getCustomerId());
//下面章图片base64、签章图片、图片公网地址三选一
// params.setSignatureImgBase64(""); //签章图片base64
// params.setFile(new File("D:\\sign.png")); //签章图片
//签章图片公网地址
params.setImgUrl(sealVO.getSealUrl());
String result = baseClient.invokeAddSignature(params);
if (!JSONObject.parseObject(result).getString(FddConstant.CODE).equals(FddConstant.SUCCESS)) {
return ResultBody.error(JSONObject.parseObject(result).getString(FddConstant.MSG));
} else {
// 获取返回的印章编号
String dataStr = JSONObject.parseObject(result).getString(FddConstant.DATA);
String signatureId = JSONObject.parseObject(dataStr).getString(FddConstant.SIGNATURE_ID);
SealInfoDO sealInfoDO = new SealInfoDO();
sealInfoDO.setSealName(sealVO.getSealName());
sealInfoDO.setSignatureId(signatureId);
sealInfoDO.setUnionId(sealVO.getUnionId());
sealInfoDO.setSealStatus(sealVO.getSealStatus());
sealInfoDO.setSealUrl(sealVO.getSealUrl());
// 新增印章信息
sealManageDao.insertSealInfo(sealInfoDO);
return ResultBody.success();
}
}
}
...@@ -617,7 +617,7 @@ public class PayWalletServiceImpl implements PayWalletService { ...@@ -617,7 +617,7 @@ public class PayWalletServiceImpl implements PayWalletService {
payWalletDO.setCashFreeze(userWalletInfo.getCashAmt().add(payUavWalletVO.getCashAmount())); payWalletDO.setCashFreeze(userWalletInfo.getCashAmt().add(payUavWalletVO.getCashAmount()));
payWalletDO.setSalaryAmt(userWalletInfo.getSalaryAmt().subtract(payUavWalletVO.getSalaryAmount())); payWalletDO.setSalaryAmt(userWalletInfo.getSalaryAmt().subtract(payUavWalletVO.getSalaryAmount()));
payWalletDO.setSalaryFreeze(userWalletInfo.getSalaryAmt().add(payUavWalletVO.getSalaryAmount())); payWalletDO.setSalaryFreeze(userWalletInfo.getSalaryAmt().add(payUavWalletVO.getSalaryAmount()));
} else { } else if (payUavWalletVO.getOrderStatus().equals(PayMethodEnums.PAY_UAV_ORDER_REFUND.getCode())) {
payLogDO.setPayMethod(payUavWalletVO.getOrderStatus()); payLogDO.setPayMethod(payUavWalletVO.getOrderStatus());
payLogDO.setCashAmtPaid(payUavWalletVO.getCashAmount()); payLogDO.setCashAmtPaid(payUavWalletVO.getCashAmount());
payLogDO.setSalaryAmtPaid(payUavWalletVO.getSalaryAmount()); payLogDO.setSalaryAmtPaid(payUavWalletVO.getSalaryAmount());
...@@ -626,6 +626,12 @@ public class PayWalletServiceImpl implements PayWalletService { ...@@ -626,6 +626,12 @@ public class PayWalletServiceImpl implements PayWalletService {
payWalletDO.setCashFreeze(userWalletInfo.getCashAmt().subtract(payUavWalletVO.getCashAmount())); payWalletDO.setCashFreeze(userWalletInfo.getCashAmt().subtract(payUavWalletVO.getCashAmount()));
payWalletDO.setSalaryAmt(userWalletInfo.getSalaryAmt().add(payUavWalletVO.getSalaryAmount())); payWalletDO.setSalaryAmt(userWalletInfo.getSalaryAmt().add(payUavWalletVO.getSalaryAmount()));
payWalletDO.setSalaryFreeze(userWalletInfo.getSalaryAmt().subtract(payUavWalletVO.getSalaryAmount())); payWalletDO.setSalaryFreeze(userWalletInfo.getSalaryAmt().subtract(payUavWalletVO.getSalaryAmount()));
} else {
payLogDO.setPayMethod(payUavWalletVO.getOrderStatus());
payLogDO.setCashAmtPaid(BigDecimal.ZERO);
payLogDO.setSalaryAmtPaid(payUavWalletVO.getSalaryAmount());
// 订单收益
payWalletDO.setSalaryAmt(userWalletInfo.getSalaryAmt().add(payUavWalletVO.getSalaryAmount()));
} }
payWalletDao.insertPayLogDO(payLogDO); payWalletDao.insertPayLogDO(payLogDO);
payWalletDao.updatePayWallet(payWalletDO); payWalletDao.updatePayWallet(payWalletDO);
......
<?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="com.mmc.iuav.user.dao.fdd.SealManageDao">
<insert id="insertSealInfo">
insert into seal_info (seal_name, signature_id, seal_url, union_id, seal_status)
values (#{sealName}, #{signatureId}, #{sealUrl}, #{unionId}, #{sealStatus})
</insert>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论