Просмотр исходного кода

Merge branch 'release_toaliyun_real' into release_toaliyun_real_20230308

release_toaliyun_real
winter 3 лет назад
Родитель
Сommit
55faf2474a
16 измененных файлов: 128 добавлений и 41 удалений
  1. +24
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPasswordController.java
  2. +10
    -0
      mallinkAdmin/src/main/resources/db/migration/V2023030300001__card.sql
  3. +2
    -9
      mallinkBApi/src/main/java/com/iformall/controller/WxCardInfoController.java
  4. +3
    -8
      mallinkBApi/src/main/java/com/iformall/controller/WxCardPayController.java
  5. +4
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponPasswordController.java
  6. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponPassword.java
  7. +3
    -3
      mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendMerchantVo.java
  8. +17
    -12
      mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordVo.java
  9. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  10. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponPasswordMapper.java
  11. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponPasswordService.java
  12. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java
  13. +34
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java
  14. +7
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  15. +2
    -2
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  16. +13
    -1
      mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml

+ 24
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPasswordController.java Просмотреть файл

@@ -2,14 +2,19 @@ package com.iformall.controller.market;

import com.github.pagehelper.PageInfo;
import com.iformall.annotation.SystemControllerLog;
import com.iformall.annotation.TenantIgnore;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponPassword;
import com.iformall.domain.vo.WxCouponPasswordCountInfoVO;
import com.iformall.domain.vo.WxCouponPasswordVo;
import com.iformall.enums.EnumCouponPasswordStatus;
import com.iformall.enums.EnumCouponSubsidyType;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.service.WxCouponPasswordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -112,6 +117,25 @@ public class WxCouponPasswordController extends BaseController {
}
return new ResultData();
}
@TenantIgnore
@ApiOperation("后置设置金额")
@PostMapping("setPrice")
public ResultData setPrice(@RequestBody WxCouponPassword wxCouponPassword) {
wxCouponPassword.updateTenantInfo(getTenantInfo());
WxCouponPassword couponPassword = wxCouponPasswordService.getById(wxCouponPassword.getId());
if (null == couponPassword ) {
return new ResultData(ResultData.ERROR, "卡密未查询到。"+wxCouponPassword.getId());
}
if (couponPassword.getIsStop().intValue() == EnumYesOrNo.YES.getCode().intValue() ) {
return new ResultData(ResultData.ERROR, "已停用,不能设置。");
}
if (couponPassword.getPrice() > 0 ) {
return new ResultData(ResultData.ERROR, "已设置面额,不能再次设置面额。");
}
wxCouponPasswordService.setPrice(wxCouponPassword);
return new ResultData();
}


}

+ 10
- 0
mallinkAdmin/src/main/resources/db/migration/V2023030300001__card.sql Просмотреть файл

@@ -0,0 +1,10 @@
alter table wx_coupon_password add column price int(11) not null default 0 comment '面额';

update wx_coupon_password cp inner join wx_coupon_89 c on cp.coupon_id = c.id set cp.price = c.price where cp.price = 0 and c.price > 0 ;








+ 2
- 9
mallinkBApi/src/main/java/com/iformall/controller/WxCardInfoController.java Просмотреть файл

@@ -87,16 +87,9 @@ public class WxCardInfoController extends BaseController {
map.put("cardType", cardInfo.getType());
}else {
//第一次刷卡的时候没有cardInfo
WxCoupon cq = new WxCoupon();
cq.updateTenantInfo(password);
cq.setId(password.getCouponId());
WxCoupon coupon = wxCouponService.findById(cq);
if (null == coupon) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "卡未查询到券:"+cardIdStr);
}
map.put("cardId", couponPasswordId);
map.put("amount", coupon.getPrice());
map.put("remainAmount", coupon.getPrice());
map.put("amount", password.getPrice());
map.put("remainAmount", password.getPrice());
map.put("cardType", EnumCardInfoType.CARD.getCode());
}
}


+ 3
- 8
mallinkBApi/src/main/java/com/iformall/controller/WxCardPayController.java Просмотреть файл

@@ -90,10 +90,6 @@ public class WxCardPayController extends BaseController {
WxMerchantBUser user = getLoginBUser();
wxCardSpendVo.updateTenantInfo(user);
wxCardSpendVo.setMerchantId(user.getMerchantId());
// List<Integer> sources = new ArrayList<Integer>();
// sources.add(EnumMerchantSubsidySource.CARD.getCode());
// wxCardSpendVo.setSources(sources);
// wxCardSpendVo.setCardSpendListShow(1);
wxCardSpendVo.setSortColumns(BaseEntity.SortField.CreateDate_DESC);
final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize);
return new ResultData(page);
@@ -108,10 +104,6 @@ public class WxCardPayController extends BaseController {
WxMerchantBUser user = getLoginBUser();
wxCardSpend.updateTenantInfo(user);
wxCardSpend.setMerchantId(user.getMerchantId());
// List<Integer> sources = new ArrayList<Integer>();
// sources.add(EnumMerchantSubsidySource.CARD.getCode());
// wxCardSpend.setSources(sources);
// wxCardSpend.setCardSpendListShow(1);
final Map<String, BigDecimal> mapList = wxCardSpendService.sumCardSpend(wxCardSpend);
return new ResultData(mapList);
}
@@ -194,6 +186,9 @@ public class WxCardPayController extends BaseController {
if (EnumYesOrNo.YES.getCode().intValue() == couponPassword.getIsStop().intValue()) {
return new ResultData(ErrorCode.CARD_IS_NOT_FOUND.getCode(),"卡已被禁用.");
}
if (couponPassword.getPrice().intValue() <= 0 ) {
return new ResultData(ErrorCode.CARD_IS_NOT_FOUND.getCode(),"卡密面额未设置.");
}
WxCoupon coupon = wxCouponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId());
if (coupon == null) {


+ 4
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxCouponPasswordController.java Просмотреть файл

@@ -80,6 +80,9 @@ public class WxCouponPasswordController extends BaseController {
if (couponPassword.getIsStop().intValue() == EnumYesOrNo.YES.getCode().intValue()) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"卡密已经停用");
}
if (couponPassword.getPrice() <= 0) {
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"卡密面值未设置,请联系管理员.");
}
WxCUserBasicInfo member = userService.getById(memberId,getFinalTenantId());
if(member == null) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "会员用户未找到" + memberId);
@@ -93,7 +96,7 @@ public class WxCouponPasswordController extends BaseController {
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF);
}
if (coupon.getPrice() <= 0) {
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"面值未设置,请联系管理员.");
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"面值未设置,请联系管理员.");
}

// 卡密领取卡券


+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCouponPassword.java Просмотреть файл

@@ -20,6 +20,8 @@ public class WxCouponPassword extends TenantEntity {
protected Long id;
@TableField(exist = false)
private String idLike;
@io.swagger.annotations.ApiModelProperty(value="面额",name="price")
private Integer price;
@io.swagger.annotations.ApiModelProperty(value="卡券ID",name="couponId")
private Long couponId;
@io.swagger.annotations.ApiModelProperty(value="卡券短ID",name="couponShort")


+ 3
- 3
mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendMerchantVo.java Просмотреть файл

@@ -13,11 +13,11 @@ public class WxCardSpendMerchantVo {
private Long merchantId;
@Excel(name = "商户名称", width = 20, orderNum = "2")
private String merchantName;
@Excel(name = "交易总金额", width = 20, orderNum = "3")
@Excel(name = "交易总金额(分)", width = 20, orderNum = "3")
private BigDecimal total;
@Excel(name = "总手续费", width = 20, orderNum = "4")
@Excel(name = "总手续费(分)", width = 20, orderNum = "4")
private BigDecimal fee;
@Excel(name = "总补贴", width = 20, orderNum = "5")
@Excel(name = "总补贴(分)", width = 20, orderNum = "5")
private BigDecimal subsidy;
}

+ 17
- 12
mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordVo.java Просмотреть файл

@@ -25,40 +25,45 @@ public class WxCouponPasswordVo extends TenantEntity {

@Excel(name = "卡号", width = 20, orderNum = "1", prefix = "`")
protected Long id;
@Excel(name = "卡密", width = 20, orderNum = "2", prefix = "`")
@Excel(name = "卡名称", width = 20, orderNum = "2", prefix = "`")
protected String couponTitile;
@Excel(name = "卡密", width = 20, orderNum = "3", prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "卡密", name = "couponPassword")
private String couponPassword;
@Excel(name = "创建时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "3")
@Excel(name = "卡密面额(分)", width = 20, orderNum = "4", prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "卡密面额", name = "couponPasswordPrice")
private Integer couponPasswordPrice;
@Excel(name = "创建时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "5")
@io.swagger.annotations.ApiModelProperty(value = "", name = "createDate")
private Date createDate;
@Excel(name = "卡密状态", width = 20, orderNum = "4", replace = {"初始化_0", "消息发送中_1", "消息已发送_2", "已兑换_3","已作废_4"},prefix = "`")
@Excel(name = "卡密状态", width = 20, orderNum = "6", replace = {"初始化_0", "消息发送中_1", "消息已发送_2", "已兑换_3","已作废_4"},prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "卡密状态", name = "remainPrice")
private Integer status;
@Excel(name = "卡密是否停用", width = 20, orderNum = "5", replace = {"否_0", "是_1"},prefix = "`")
@Excel(name = "卡密是否停用", width = 20, orderNum = "7", replace = {"否_0", "是_1"},prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "卡密是否停用", name = "isStop")
private Integer isStop;
@Excel(name = "卡激活状态", width = 20, orderNum = "6",replace = {"未激活_0", "已激活_1"}, prefix = "`")
@Excel(name = "卡激活状态", width = 20, orderNum = "8",replace = {"未激活_0", "已激活_1"}, prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "卡激活状态EnumYesOrNo", name = "used")
private Integer used;
@Excel(name = "激活时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "7")
@Excel(name = "激活时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "9")
@io.swagger.annotations.ApiModelProperty(value = "", name = "activeDate")
private Date activeDate;
@Excel(name = "激活手机号", width = 20, orderNum = "8", prefix = "`")
@Excel(name = "激活手机号", width = 20, orderNum = "10", prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "激活手机号", name = "phone")
private String phone;
@Excel(name = "激活会员", width = 20, orderNum = "9", prefix = "`")
@Excel(name = "激活会员", width = 20, orderNum = "11", prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "激活会员", name = "userName")
private String userName;
@Excel(name = "电子卡卡号", width = 20, orderNum = "10", prefix = "`")
@Excel(name = "电子卡卡号", width = 20, orderNum = "12", prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "电子卡卡号", name = "cardId")
private Long cardId;
@Excel(name = "面额(元)", width = 20, orderNum = "11", prefix = "`")
@Excel(name = "面额(元)", width = 20, orderNum = "13", prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "面额(元)", name = "price")
private Double price;
@Excel(name = "余额(元)", width = 20, orderNum = "12", prefix = "`")
@Excel(name = "余额(元)", width = 20, orderNum = "14", prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "余额(元)", name = "remainPrice")
private Double remainPrice;
@Excel(name = "电子卡状态", width = 20, orderNum = "13",replace = {"正常_0", "已禁用_1"}, prefix = "`")
@Excel(name = "电子卡状态", width = 20, orderNum = "15",replace = {"正常_0", "已禁用_1"}, prefix = "`")
@io.swagger.annotations.ApiModelProperty(value = "电子卡状态EnumYesOrNo", name = "cardStatus")
private Integer cardStatus;



+ 1
- 1
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java Просмотреть файл

@@ -42,7 +42,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId);
Integer setPrice(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("price")Integer price,@Param("subsidyNum")Integer subsidyNum);
Integer setPrice(WxCoupon wxCoupon);

Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number);


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponPasswordMapper.java Просмотреть файл

@@ -29,5 +29,7 @@ public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, L
void updateExpiredTime(@Param("couponId")Long couponId,@Param("expiredTime")Date expiredTime);
void updateIsStop(@Param("tenantId")String tenantId,@Param("id")Long Id,@Param("isStop")Integer isStop);
void setPrice(WxCouponPassword wxCouponPassword);

}

+ 2
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponPasswordService.java Просмотреть файл

@@ -77,4 +77,6 @@ public interface WxCouponPasswordService {
void postpone(WxCouponPassword wxCouponPassword);
void startOrStop(WxCouponPassword wxCouponPassword);
void setPrice(WxCouponPassword wxCouponPassword);
}

+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java Просмотреть файл

@@ -310,10 +310,10 @@ public class WxCardInfoServiceImpl implements WxCardInfoService {
cardInfo.setId(couponPassword.getId());
cardInfo.updateTenantInfo(couponPassword);
cardInfo.setCouponId(couponPassword.getCouponId());
cardInfo.setAmount(coupon.getPrice());
cardInfo.setAmount(couponPassword.getPrice());
cardInfo.setSaleAmount(coupon.getSalePrice());
cardInfo.setCouponPasswordId(couponPassword.getId());
cardInfo.setRemainingAmount(coupon.getPrice());
cardInfo.setRemainingAmount(couponPassword.getPrice());
cardInfo.setShareFeeAmount(0);
cardInfo.setRemainingShareFeeAmount(0);
cardInfo.setRateAmount(0);


+ 34
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java Просмотреть файл

@@ -22,6 +22,7 @@ import com.iformall.domain.vo.WxMerchantProductVo;
import com.iformall.common.ErrorCode;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxCardInfoMapper;
import com.iformall.mapper.WxCouponMapper;
import com.iformall.mapper.WxCouponPasswordMapper;
import com.iformall.service.ExcelService;
import com.iformall.service.WxCUserBasicInfoService;
@@ -59,6 +60,8 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService {
@Lazy
@Autowired
WxCUserBasicInfoService wxCUserBasicInfoService;
@Autowired
WxCouponMapper wxCouponMapper;

@Autowired
ExcelService excelService;
@@ -83,13 +86,31 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService {
private List<WxCouponPasswordVo> handleQueryResult(List<WxCouponPassword> list,TenantEntity tenantEntity) {
if (null != list && list.size() > 0) {
List<Long> couponPasswordIdList = new ArrayList<Long>();
List<Long> couponIdList = new ArrayList<Long>();
for (int i = 0 ; i < list.size() ; i ++ ) {
WxCouponPassword bo = list.get(i);
if (null != bo.getId() && (!couponPasswordIdList.contains(bo.getId()))) {
couponPasswordIdList.add(bo.getId());
}
if (null != bo.getCouponId() && (!couponIdList.contains(bo.getCouponId()))) {
couponIdList.add(bo.getCouponId());
}
}

Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>();
if (couponIdList.size() > 0 ) {
WxCoupon cQ = new WxCoupon();
cQ.updateTenantInfo(tenantEntity);
cQ.setIds(couponIdList);
List<WxCoupon> cList = wxCouponMapper.findList(cQ);
if (null != cList && cList.size() > 0) {
for (int i = 0 ; i < cList.size(); i++) {
WxCoupon c = cList.get(i);
couponMap.put(c.getId(), c);
}
}
}
List<Long> cUserIdList = new ArrayList<Long>();
Map<Long,WxCardInfo> passwordCardInfoMap = new HashMap<Long,WxCardInfo>();
if (couponPasswordIdList.size() > 0 ) {
@@ -129,7 +150,14 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService {
WxCouponPasswordVo co = new WxCouponPasswordVo();
WxCardInfo cardInfo = passwordCardInfoMap.get(coo.getId());
co.setId(coo.getId());
if (null != coo.getCouponId()) {
WxCoupon coupon = couponMap.get(coo.getCouponId());
if (null != coupon) {
co.setCouponTitile(coupon.getTitle());
}
}
co.setCouponPassword(coo.getPassword());
co.setCouponPasswordPrice(coo.getPrice());
if (null != cardInfo) {
co.setUsed(EnumYesOrNo.YES.getCode());
co.setPrice(new BigDecimal(cardInfo.getAmount()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
@@ -303,5 +331,10 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService {
public void startOrStop(WxCouponPassword wxCouponPassword) {
wxCouponPasswordMapper.updateIsStop(wxCouponPassword.getTenantId(), wxCouponPassword.getId(), wxCouponPassword.getIsStop());
}

@Override
public void setPrice(WxCouponPassword wxCouponPassword) {
wxCouponPasswordMapper.setPrice(wxCouponPassword);
}
}

+ 7
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -1022,10 +1022,16 @@ public class WxCouponServiceImpl implements WxCouponService {
@Override
@Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public ResultData setPrice(WxCoupon record) {
Integer count = wxCouponMapper.setPrice(record.getId(), record.getTenantId(), record.getPrice(),record.getSubsidyNum());
Integer count = wxCouponMapper.setPrice(record);
if (null == count || count <= 0 ) {
return new ResultData(Result.ERROR,"设置失败");
}
//设置卡密price
WxCouponPassword couponPassword = new WxCouponPassword();
couponPassword.updateTenantInfo(record);
couponPassword.setCouponId(record.getId());
couponPassword.setPrice(record.getPrice());
couponPasswordMapper.setPrice(couponPassword);
return new ResultData();
}


+ 2
- 2
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -1524,8 +1524,8 @@
update wx_coupon set make_merchant_id = #{makeMerchantId} where id = #{id} and tenant_id = #{tenantId}
</update>
<update id="setPrice" parameterType="HashMap">
update wx_coupon set price = #{price},subsidy_num={subsidyNum} where id = #{id} and tenant_id = #{tenantId} and price = 0
<update id="setPrice" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon set price = #{price},subsidy_num=#{subsidyNum} where id = #{id} and tenant_id = #{tenantId} and price = 0
</update>

</mapper>

+ 13
- 1
mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml Просмотреть файл

@@ -5,6 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="price" jdbcType="INTEGER" property="price" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="coupon_short" jdbcType="VARCHAR" property="couponShort" />
<result column="password" jdbcType="VARCHAR" property="password" />
@@ -19,7 +20,7 @@
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_short`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`,`expire_date`,`present_id`,`is_stop`
`id`,`tenant_id`,`parent_tenant_id`,`price`,`coupon_id`,`coupon_short`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`,`expire_date`,`present_id`,`is_stop`
</sql>

<sql id="dynamicWhereConditions">
@@ -213,5 +214,16 @@
<update id="updateIsStop" parameterType="map">
update wx_coupon_password set is_stop = #{isStop} , update_date = now() where id = #{id} and tenant_id = #{tenantId}
</update>
<update id="setPrice" parameterType="com.iformall.domain.po.WxCouponPassword">
update wx_coupon_password set price = #{price} , update_date = now()
where tenant_id = #{tenantId} and price = 0
<if test=" null != couponId">
and coupon_id = #{couponId}
</if>
<if test=" null != id">
and id = #{id}
</if>
</update>

</mapper>

Загрузка…
Отмена
Сохранить