Browse Source

Merge branch 'release_toaliyun_real_202211' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_202211

release_toaliyun_real
zhengfangyuan 3 years ago
parent
commit
53a24b6499
19 changed files with 456 additions and 72 deletions
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java
  2. +0
    -15
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  3. +4
    -0
      mallinkAdmin/src/main/resources/db/migration/V2022111600001__add_mall_permission.sql
  4. +23
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  5. +97
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java
  6. +24
    -2
      mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java
  7. +5
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java
  8. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMallMapper.java
  9. +8
    -0
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  10. +6
    -1
      mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java
  11. +11
    -1
      mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java
  12. +54
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  13. +75
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  14. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMallServiceImpl.java
  15. +10
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  16. +47
    -21
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  17. +29
    -0
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml
  18. +53
    -21
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  19. +5
    -1
      mallinkService/src/main/resources/mapper/WxMallMapper.xml

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java View File

@@ -152,7 +152,7 @@ public class TtPoiPlanController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"定向达人抖音号为空");
}
//达人去重
List<String> collect = record.getDouyinIdList().stream().collect(Collectors.toList());
List<String> collect = record.getDouyinIdList().stream().distinct().collect(Collectors.toList());
record.setDouyinIdList(collect);

if(record.getCouponId() == null){


+ 0
- 15
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java View File

@@ -85,21 +85,6 @@ public class WxCouponController extends BaseController {
wxCoupon.setSortColumn(null);
}

if(wxCoupon.getTargetAd() != null ){
if(wxCoupon.getTargetAd() == EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode()
|| wxCoupon.getTargetAd() == EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode()){
Integer[] typeArray = {
EnumCouponType.COUPON_MANJIAN.getCode(),
EnumCouponType.COUPON_DAIJIN.getCode(),
EnumCouponType.COUPON_LIPIN.getCode(),
EnumCouponType.COUPON_TINGCHE.getCode(),
EnumCouponType.COUPON_MULTIMCH.getCode(),
EnumCouponType.COUPON_DOUYIN.getCode()};

wxCoupon.setTypes(Arrays.asList(typeArray));
}
}

//isList true 查全部 / 否则 只查询主动领取和定向投放的。
if(!(isList == null?false:isList)){
Integer[] sendTypeArray = {


+ 4
- 0
mallinkAdmin/src/main/resources/db/migration/V2022111600001__add_mall_permission.sql View File

@@ -0,0 +1,4 @@
INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (648, '抖音平台券', 602, 'Y', NULL, 1, NULL, NULL, 'douyinPlatCoupon', NULL, 0, 648);
INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (649, '抖音品牌券', 602, 'Y', NULL, 1, NULL, NULL, 'douyinBrandCoupon', NULL, 0, 649);

INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (101, '抖音集团版', 101, 12, '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 211, 212, 221, 222, 223, 224, 251, 409, 410, 411, 416, 500, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 610, 615, 622, 648, 649, 676, 711, 901, 902, 904, 907, 61501, 61502]');

+ 23
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java View File

@@ -42,6 +42,9 @@ public class WxCoupon extends TenantEntity {
@TableField(exist = false)
protected List<Long> notinTypes;

@TableField(exist = false)
protected Integer plat;

@TableField(exist = false)
protected String channels;

@@ -363,6 +366,26 @@ public class WxCoupon extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams")
private Map<String, Object> flowParams;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="spuId",name="spuId")//goodsId
private String spuId;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="状态:0-审核中,1-上架,2-下架,3-审核拒绝 4-审核通过",name="poiStatus")
private Integer poiStatus;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="描述",name="statusDesc")
private String statusDesc;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="状态:0-审核中,1-上架,2-下架,3-审核拒绝 4-审核通过",name="lastStatus")
private Integer lastStatus;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="描述",name="lastStatusDesc")
private String lastStatusDesc;

@io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel")
private Integer isDel;



+ 97
- 0
mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java View File

@@ -1,5 +1,11 @@
package com.iformall.enums;

import com.iformall.common.ErrorCode;
import com.iformall.exception.MallinkException;

import java.util.ArrayList;
import java.util.List;

/**
* Created by Stormeye on 2018/08/09.
*/
@@ -10,9 +16,12 @@ public enum EnumCouponChannelType {
* //初次投放,只为展示审核,不让购买。
* //当券投放到其他渠道时,此渠道自动上架,才可购买。
* //其他所有渠道下架后,该渠道自动下架。
*
* //该渠道不做任何查询
*/
COUPON_CHANNEL_ID_DOUYIN(0,"抖音"),


COUPON_CHANNEL_ID_LIST(1, "列表"),
COUPON_CHANNEL_ID_TIMED(2, "限时抢购"),
COUPON_CHANNEL_ID_CAMPAIN(3, "幻灯片"), // banner图, 宣传页,轮播图,走马灯
@@ -46,6 +55,41 @@ public enum EnumCouponChannelType {
this.message = message;
}

/**
* 微信平台的渠道
*/
public static List<Integer> getWeiXinType(){
List<Integer> typeList = new ArrayList<>();
typeList.add(COUPON_CHANNEL_ID_LIST.getCode());
typeList.add(COUPON_CHANNEL_ID_TIMED.getCode());
typeList.add(COUPON_CHANNEL_ID_GAME.getCode());
typeList.add(COUPON_CHANNEL_ID_CARD.getCode());
typeList.add(COUPON_CHANNEL_ID_PRESS.getCode());
typeList.add(COUPON_CHANNEL_ID_ORDER_GROUP.getCode());
typeList.add(COUPON_CHANNEL_ID_CREDIT.getCode());
typeList.add(COUPON_CHANNEL_ID_H5.getCode());
typeList.add(COUPON_CHANNEL_ID_WXLIVE_LIST.getCode());
return typeList;
}

/**
* 抖音平台的渠道
*/
public static List<Integer> getDouYinType(){
List<Integer> typeList = new ArrayList<>();
typeList.add(COUPON_CHANNEL_ID_DOUYIN_LIST.getCode());
return typeList;
}

public static EnumAppPlat getAppPlat(Integer code) {
if(getWeiXinType().contains(code)){
return EnumAppPlat.WX;
}else if(getDouYinType().contains(code)){
return EnumAppPlat.TOUTIAO;
}
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "券类型错误,未找到对应平台");
}

public Integer getCode() {
return code;
}
@@ -53,4 +97,57 @@ public enum EnumCouponChannelType {
public String getMessage() {
return message;
}

//根据渠道筛选券类型
public static List<Integer> getCouponTypeBy(Integer code){
List<Integer> codes = new ArrayList<>();
if(COUPON_CHANNEL_ID_LIST.getCode().equals(code)){
//微信 列表 渠道
//满减,代金,礼品,停车,通用,预购商品,可配送商品,券礼包
codes.add(EnumCouponType.COUPON_MANJIAN.getCode());
codes.add(EnumCouponType.COUPON_DAIJIN.getCode());
codes.add(EnumCouponType.COUPON_LIPIN.getCode());
codes.add(EnumCouponType.COUPON_TINGCHE.getCode());
codes.add(EnumCouponType.COUPON_MULTIMCH.getCode());
codes.add(EnumCouponType.COUPON_PREORDER.getCode());
codes.add(EnumCouponType.COUPON_DISTRIBUTION.getCode());
codes.add(EnumCouponType.COUPON_GIFT.getCode());
}else if(COUPON_CHANNEL_ID_TIMED.getCode().equals(code)
|| COUPON_CHANNEL_ID_GAME.getCode().equals(code)){
//微信 限时抢购,游戏 渠道
//可用 满减,代金,礼品,停车,通用
codes.add(EnumCouponType.COUPON_MANJIAN.getCode());
codes.add(EnumCouponType.COUPON_DAIJIN.getCode());
codes.add(EnumCouponType.COUPON_LIPIN.getCode());
codes.add(EnumCouponType.COUPON_TINGCHE.getCode());
codes.add(EnumCouponType.COUPON_MULTIMCH.getCode());
}else if(COUPON_CHANNEL_ID_CARD.getCode().equals(code)){
//微信 卡频道
//可用 消费卡
codes.add(EnumCouponType.CARD_MULTIMCH.getCode());
}else if(COUPON_CHANNEL_ID_PRESS.getCode().equals(code)){
//微信 砍价频道
//可用 砍价券
codes.add(EnumCouponType.COUPON_PRESS.getCode());
}else if(COUPON_CHANNEL_ID_ORDER_GROUP.getCode().equals(code)){
//微信 拼团频道
//可用 拼团券
codes.add(EnumCouponType.COUPON_GROUP.getCode());
}else if(COUPON_CHANNEL_ID_CAMPAIN.getCode().equals(code)
|| COUPON_CHANNEL_ID_TOPIC.getCode().equals(code)){
//宣传页 专题 (不分平台)查所有券
//平台从其他地方区分
codes.addAll(EnumCouponType.getAllCodes());
}else if(COUPON_CHANNEL_ID_CREDIT.getCode().equals(code)){
//微信 积分商城
codes.add(EnumCouponType.COUPON_CREDIT.getCode());
codes.add(EnumCouponType.COUPON_CREDIT_PARK.getCode());
}else if(COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(code)){
//抖音 列表
codes.add(EnumCouponType.COUPON_DOUYIN.getCode());
codes.add(EnumCouponType.COUPON_DOUYIN_PLAT.getCode());
codes.add(EnumCouponType.COUPON_DOUYIN_BRAND.getCode());
}
return codes;
}
}

+ 24
- 2
mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java View File

@@ -28,7 +28,10 @@ public enum EnumCouponType {
COUPON_CREDIT(50,"积分券"),
COUPON_CREDIT_PARK(51,"积分停车券"),
// COUPON_CREDIT_DOUYIN(55,"抖音积分券"),
COUPON_PLAT(53,"平台券"),

COUPON_DOUYIN_PLAT(67, "抖音集团平台券"),
COUPON_DOUYIN_BRAND(68, "抖音集团品牌券"),

CARD_MULTIMCH(100, "消费卡"),
;

@@ -40,6 +43,14 @@ public enum EnumCouponType {
}
return null;
}

public static List<Integer> getAllCodes(){
List<Integer> codes = new ArrayList<>();
for (EnumCouponType value : values()) {
codes.add(value.getCode());
}
return codes;
}
public static boolean mustHasMerchant(Integer code) {
if (null == code) {
@@ -75,6 +86,8 @@ public enum EnumCouponType {
List<Integer> typeList = new ArrayList<>();
typeList.add(COUPON_DOUYIN.getCode());
// typeList.add(COUPON_CREDIT_DOUYIN.getCode());
typeList.add(COUPON_DOUYIN_PLAT.getCode());
typeList.add(COUPON_DOUYIN_BRAND.getCode());
return typeList;
}

@@ -101,7 +114,7 @@ public enum EnumCouponType {
}

/**
* 有价 并且永不分账的券类型
* 微信 有价 并且永不分账的券类型
*/
public static List<Integer> getPlatType(){
List<Integer> typeList = new ArrayList<>();
@@ -119,4 +132,13 @@ public enum EnumCouponType {
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "券类型错误,未找到对应平台");
}

public static List<Integer> getTypeCode(Integer plat){
if(EnumAppPlat.WX.getCode().equals(plat)){
return getWeiXinType();
}else if(EnumAppPlat.TOUTIAO.getCode().equals(plat)){
return getDouYinType();
}
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "券平台错误,未找到对应类型");
}

}

+ 5
- 1
mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java View File

@@ -24,7 +24,7 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str

WxCouponChannel findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId);

void updateStatusByCouponId(WxCouponChannel wxCouponChannel);
int updateStatusByCouponId(WxCouponChannel wxCouponChannel);

int updateEndTimeByCouponId(WxCouponChannel wxCouponChannel);

@@ -70,4 +70,8 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str
List<TtCouponChannelVo> ttChannelList(TtCouponChannelVo ttChannelVo);

Long findCouponIdById(@Param("id")Long id,@Param("tenantId")String tenantId);

int updateStatusByTargetAd(WxCouponChannel updCC);

int selectCountExclude(WxCouponChannel ccQ);
}

+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMallMapper.java View File

@@ -20,6 +20,7 @@ public interface WxMallMapper extends CommonMapper<WxMall, Long> {

String queryMenusByTenantInfo(WxMall wxMall);

void updateUnSubMall(@Param(value = "parentTenantId")String parentTenantId);
void undateSubmall(@Param(value = "parentTenantId")String parentTenantId, @Param(value = "tenantIds")List<String> tenantIds);

List<WxMall> listAsSelectMall(@Param(value = "id")Long id);
@@ -27,4 +28,6 @@ public interface WxMallMapper extends CommonMapper<WxMall, Long> {
List<TenantEntity> getTenantEntitys(TenantEntity tenantEntity);

List<WxMall> findListAadmin(WxMall record);


}

+ 8
- 0
mallinkService/src/main/java/com/iformall/service/WxMerchantService.java View File

@@ -95,6 +95,14 @@ public interface WxMerchantService {
*/
List<WxMerchant> findList(WxMerchant record);

/**
* 根据商管商户
*
* @param tenantEntity
* @return
*/
List<WxMerchant> findAdminList(TenantEntity tenantEntity);

/**
* 查询商户列表
* @param tenantEntity


+ 6
- 1
mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java View File

@@ -127,7 +127,12 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer
updateUser.setId(cuser.getId());
updateUser.updateTenantInfo(cuser);
updateUser.setUnionId(userInfo.getUnionId());
updateUser.setNickName(userInfo.getNickName());
if(userInfo.getNickName() == null){
updateUser.setNickName(AppUtils.getAppId());//获取不到微信昵称
}else{
updateUser.setNickName(userInfo.getNickName());
}

updateUser.setGender(Integer.parseInt(userInfo.getGender()));
updateUser.setAvatarUrl(userInfo.getAvatarUrl());
updateUser.setProvince(userInfo.getProvince());


+ 11
- 1
mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java View File

@@ -379,7 +379,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
WxCouponChannel wxCouponChannelQuery = new WxCouponChannel();
wxCouponChannelQuery.updateTenantInfo(wxCoupon);
wxCouponChannelQuery.setCouponId(wxCoupon.getId());
wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode());
// wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode());
wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery);
if(wxCouponChannels.size() > 0){
@@ -653,6 +653,9 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
if(oldTakeRate == null || StringUtils.isBlank(oldTakeRate.getDouyinId())){
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR);
}
if(!EnumCpsPlanStatus.ING.getCode().equals(oldTakeRate.getStatus())){
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该计划已取消或已完成");
}

List<String> addDouyinIdList = new ArrayList<>();
addDouyinIdList.addAll(record.getDouyinIdList());
@@ -672,6 +675,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}

if(EnumCpsPlanContentType.VIDEO.getCode().equals(record.getContentType())){
//当时间改变时,
if(record.getStartTime() != null && record.getStartTime().after(oldTakeRate.getStartTime())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"开始时间只能向前修改");
}
if(record.getEndTime() != null && record.getEndTime().before(oldTakeRate.getEndTime())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"结束时间只能向后延长");
}
//当时间未改变时,
if(record.getStartTime() == null || record.getStartTime().equals(oldTakeRate.getStartTime())){
record.setStartTime(null);


+ 54
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java View File

@@ -153,6 +153,16 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
if (list != null && list.size() > 0) {
return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED);
}

if(EnumCouponType.getDouYinType().contains(orignal.getType())){
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId());
if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该商品未提交审核或审核未通过");
}
//上架该券的审核渠道
updateOnlineDouyin(orignal,orignal.getCouponId());
}

}
}
Long couponId = null;
@@ -169,6 +179,10 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
//浮层下架
wxFloatingLayerMapper.updateStatus(orignal.getCouponId());

if(EnumCouponType.getDouYinType().contains(orignal.getType())){
//下架该券的审核渠道(如所有渠道都已下线)
updateTakeOffDouyin(orignal);
}
}
}
record.setUpdateDate(new Date());
@@ -190,6 +204,45 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
return new ResultData();
}

/**
* 前置 该券已审核通过
* //上架该券的审核渠道
* @param tenantEntity
* @param couponId
*/
public void updateOnlineDouyin(TenantEntity tenantEntity,Long couponId){
WxCouponChannel updCC = new WxCouponChannel();
updCC.updateTenantInfo(tenantEntity);
updCC.setCouponId(couponId);
updCC.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode());
updCC.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
updCC.setUpdateDate(new Date());
wxCouponChannelMapper.updateStatusByTargetAd(updCC);
}

/**
* //下架该券的审核渠道(如所有其他渠道都已下线)
* @param couponChannel
*/
public void updateTakeOffDouyin(WxCouponChannel couponChannel){
WxCouponChannel ccQ = new WxCouponChannel();
ccQ.updateTenantInfo(couponChannel);
ccQ.setCouponId(couponChannel.getCouponId());
ccQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
//Exclude
ccQ.setId(couponChannel.getId());
ccQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode());
if(wxCouponChannelMapper.selectCountExclude(ccQ) == 0){
WxCouponChannel updCC = new WxCouponChannel();
updCC.updateTenantInfo(couponChannel);
updCC.setCouponId(couponChannel.getCouponId());
updCC.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode());
updCC.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode());
updCC.setUpdateDate(new Date());
wxCouponChannelMapper.updateStatusByTargetAd(updCC);
}
}

@Override
public void spuStatusSyncByCoupon(TenantEntity tenantEntity, Long couponId) {
FmInsideProductPushMsg productPush = new FmInsideProductPushMsg();
@@ -646,6 +699,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
wxCouponChannel.setBusiness(wxCoupon.getBusiness());
wxCouponChannel.setSubBusiness(wxCoupon.getSubBusiness());
wxCouponChannel.setTitle(wxCoupon.getTitle());
wxCouponChannel.setTtSpuId(wxCoupon.getGoodsId());
wxCouponChannel.setChannelPrice(channelPrice);
wxCouponChannel.setChannelStock(channelStock);
ResultData resultData = saveOrUpdate(wxCouponChannel);


+ 75
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java View File

@@ -152,12 +152,7 @@ public class WxCouponServiceImpl implements WxCouponService {
public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
if (null == wxCoupon) wxCoupon = new WxCoupon();
wxCoupon.updateTenantInfo(tenantEntity);
if(StringUtils.isBlank(wxCoupon.getSortColumns())){
wxCoupon.setSortColumns(BaseEntity.SortField.CCreateDate_DESC, BaseEntity.SortField.CId_DESC);
}
PageInfo<WxCoupon> page = null;
if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1)
wxCoupon.setStatus(null);
handCouponList(wxCoupon);

//除了a端列表 其他默认需要过滤
if(!EnumFilterPut.NO.equals(wxCoupon.getFilterCanPut())) {
@@ -169,8 +164,8 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCoupon.setPressModelId(couponModel.getPressModelId());
}
}
page = listAsPage(wxCoupon, pageNum, pageSize);
PageInfo<WxCoupon> page = listAsPage(wxCoupon, pageNum, pageSize);

List<WxCoupon> wxCouponList = page.getList();

@@ -212,6 +207,78 @@ public class WxCouponServiceImpl implements WxCouponService {
return new ResultData(page);
}


private void handCouponList(WxCoupon wxCoupon){
//默认排序
if(StringUtils.isBlank(wxCoupon.getSortColumns())){
wxCoupon.setSortColumns(BaseEntity.SortField.CCreateDate_DESC, BaseEntity.SortField.CId_DESC);
}
if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1){
wxCoupon.setStatus(null);
}
//门店处理
if(wxCoupon.getMerchantId() != null){
List<Long> merchantIds = new ArrayList<Long>();
merchantIds.add(wxCoupon.getMerchantId());
List<Long> mcids = wxCouponMerchantMapper.findMerchantProductIds(wxCoupon.getTenantId(), merchantIds,0);
if(mcids == null || mcids.isEmpty()){
wxCoupon.setId(-999L);
return;
}else{
wxCoupon.setIds(mcids);
}
}

//券类型处理
if(wxCoupon.getType() != null){
if(wxCoupon.getPlat() == null){
wxCoupon.setPlat(EnumCouponType.getAppPlat(wxCoupon.getType()).getCode());
}
}else{
List<Integer> types = wxCoupon.getTypes();
if(wxCoupon.getTargetAd() != null){
if(wxCoupon.getPlat() == null){
wxCoupon.setPlat(EnumCouponChannelType.getAppPlat(wxCoupon.getTargetAd()).getCode());
}
if(EnumAppPlat.TOUTIAO.getCode().equals(wxCoupon.getPlat())){
//渠道查询时只查询审核通过的
wxCoupon.setLastStatus(EnumSpuSyncStatus.sync_audit_pass.getCode());
}
List<Integer> couponTypes = EnumCouponChannelType.getCouponTypeBy(wxCoupon.getTargetAd());
if(couponTypes.isEmpty()){
wxCoupon.setId(-999L);
return;
}else{
if(types == null || types.isEmpty()){
types = couponTypes;
}else{
types.retainAll(couponTypes);
if(types.isEmpty()){
wxCoupon.setId(-999L);
return;
}
}
}
}
if(wxCoupon.getPlat() == null){
//默认查微信平台
wxCoupon.setPlat(EnumAppPlat.WX.getCode());
}
List<Integer> typeCode = EnumCouponType.getTypeCode(wxCoupon.getPlat());
if(types == null || types.isEmpty()){
types = typeCode;
}else{
types.retainAll(typeCode);
if(types.isEmpty()){
wxCoupon.setId(-999L);
return;
}
}
wxCoupon.setTypes(types);
}

}

@Override
public List<WxCoupon> list(WxCoupon wxCoupon){


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMallServiceImpl.java View File

@@ -238,6 +238,7 @@ public class WxMallServiceImpl implements WxMallService {

@Override
public void undateSubmall(String parentTenantId, List<String> tenantIds) {
wxMallMapper.updateUnSubMall(parentTenantId);
wxMallMapper.undateSubmall(parentTenantId, tenantIds);
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(parentTenantId);


+ 10
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java View File

@@ -275,6 +275,16 @@ public class WxMerchantServiceImpl implements WxMerchantService {
return wxMerchantMapper.findList(record);
}

@Override
public List<WxMerchant> findAdminList(TenantEntity tenantEntity) {
WxMerchant wxMerchant = new WxMerchant();
wxMerchant.updateTenantInfo(tenantEntity);
wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode());
wxMerchant.setIsAdmin(EnumMerchantAdmin.PUBLIC_ADMIN.getCode());
List<WxMerchant> list = findList(wxMerchant);
return list;
}

@Override
public List<WxMerchantSimpleVo> findList(TenantEntity tenantEntity) {
WxMerchant wxMerchant = new WxMerchant();


+ 47
- 21
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -1389,6 +1389,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}


private static Date getCurrentYearRentDate(Date yearEndDate,Date rentDate){
Calendar calendar = Calendar.getInstance();
calendar.setTime(yearEndDate);
Calendar rentCalendar = Calendar.getInstance();
rentCalendar.setTime(rentDate);
calendar.set(Calendar.DAY_OF_MONTH,rentCalendar.get(Calendar.DAY_OF_MONTH));
calendar.set(Calendar.MONTH, rentCalendar.get(Calendar.MONTH));
return calendar.getTime();
}
public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) {
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
@@ -1422,6 +1434,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
long needpay = 0;

boolean flag = false;
//此处逻辑处理这一年和下一年交接那一期账单。
if(yearList.size() > 1) {
if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) {
if(yearList.size() > 1) {
@@ -1436,18 +1449,26 @@ public class WxRentContractServiceImpl implements WxRentContractService {
long needpayAfter = 0;
//同一天,算一天
if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false);
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}else{
if(billTimeVo.getStartDate().before(endDate)){
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType()) && EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
//设置跳点率为年周期 price不变
needpayFront = priceArrs[index - 1];
}else {
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true);
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
}
}else{
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false);
//如果是按自然月,则这一年和下一年交叉部分需要重新计算
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) {
Date currentYearRentDate = getCurrentYearRentDate(endDate,wxRentContract.getRentalStartDate());
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
}else {
//按账单日
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false,false);
}
}
}
needpay = needpayFront+needpayAfter;
@@ -1466,7 +1487,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {

//计算金额
if(!flag){
needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false);
needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}

WxBillRent wxBillRent = new WxBillRent();
@@ -1519,13 +1540,16 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return resultMap;
}

public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod,boolean part){
public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod,boolean part,boolean monthCalDay){
long needpay;
//按日
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){
Double priceD = new Double(price);
double needpayD = WxRentContractServiceImpl.getNeedPay(0,priceD,startDate,endDate);
needpay = new Double(needpayD).longValue();
//取整
//needpay = new Double(needpayD).longValue();
//四舍五入
needpay = new BigDecimal(needpayD).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}else{
Double priceD = new Double(price);
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType())) {
@@ -1547,7 +1571,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {

//生成金额直接计算
if(!saveDb){
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue();
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
return needpay;
}

@@ -1564,7 +1589,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int months = getMonths(sdM.format(startDate)+"-01",sdM.format(DateUtils.getDaySet(endDate,Calendar.DATE,1))+"-01");
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}else if(i == 0){//第一期
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){
@@ -1573,7 +1599,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
months++;
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}else{
if(isFirstDay(startDate)){
@@ -1583,7 +1610,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}
}else{//中间
@@ -1591,12 +1619,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if(isFirstDay(startDate)){
months++;
}
needpay = new Double(months * priceD).longValue();
//如果当月费用需要按天计算
if (monthCalDay) {
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}else {
needpay = new Double(months * priceD).longValue();
}
}
}
return needpay;
}

public void setExpiredDay(WxBillRent wxBillRent,int dayType, int receivePeriod){
//截止收租日在当前时间之前
Date date = new Date();
@@ -3288,12 +3322,4 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return count;
}


public static void main(String[] args) {
String s = "{\"siteMoney\":\"2\",\"facilityMoney\":\"3\",\"administratorMoney\":\"4\"}";
JSONObject jsonObject = JSONObject.parseObject(s);
String siteMoney = jsonObject.getString("siteMoney");
System.out.println(siteMoney);
}

}

+ 29
- 0
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml View File

@@ -535,4 +535,33 @@
and id = #{id}
</select>

<update id="updateStatusByTargetAd" parameterType="com.iformall.domain.po.WxCouponChannel">
update wx_coupon_channel
set status=#{status}, update_date=#{updateDate}
where status != #{status}
and coupon_id = #{couponId}
and target_ad = #{targetAd}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>

<select id="selectCountExclude" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="Integer">
select count(1) from wx_coupon_channel
where status = #{status}
and coupon_id = #{couponId}
and id != #{id}
and target_ad != #{targetAd}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>


</mapper>

+ 53
- 21
mallinkService/src/main/resources/mapper/WxCouponMapper.xml View File

@@ -60,6 +60,12 @@
<result column="product_type" jdbcType="INTEGER" property="productType"/>
<result column="category_id" jdbcType="INTEGER" property="categoryId"/>
<result column="goods_id" jdbcType="VARCHAR" property="goodsId"/>

<result column="spu_id" jdbcType="VARCHAR" property="spuId"/>
<result column="poi_status" jdbcType="INTEGER" property="poiStatus"/>
<result column="status_desc" jdbcType="VARCHAR" property="statusDesc"/>
<result column="last_status" jdbcType="INTEGER" property="lastStatus"/>
<result column="last_status_desc" jdbcType="VARCHAR" property="lastStatusDesc"/>
</resultMap>
<resultMap id="statisMap" type="com.iformall.domain.vo.WxCouponStatisVo">
<id column="id" jdbcType="BIGINT" property="id"/>
@@ -115,7 +121,7 @@
</resultMap>

<sql id="allColumns">
distinct c.`id`,c.`tenant_id`,c.`parent_tenant_id`,c.`make_merchant_id`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`,
c.`id`,c.`tenant_id`,c.`parent_tenant_id`,c.`make_merchant_id`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`,
c.`title`,c.`sub_title`,c.`item_group`,c.`sale_price`,c.`freight_price`,c.`use_price`,c.`use_limit_rule`,c.`use_limit_quantity`,c.`send_type`,
c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,c.pick_start_date,c.pick_end_date,c.`valid_days`,c.`detail`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`,
c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`,
@@ -476,13 +482,6 @@


<sql id="dynamicWhereConditionsForCoupon">
where c.is_del = 0
<if test=" null != targetAd ">
and 0 = (select count(*) from wx_coupon_channel cc
where c.`id` = cc.coupon_id
and cc.status = 0
and cc.target_ad = #{targetAd})
</if>

<if test=" null != id ">
and c.`id` = #{id}
@@ -495,11 +494,6 @@
and c.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null == type and null == types">
<!-- and ( c.`type` &lt; 7 or c.`type` = 10 ) -->
and c.`type` in (1,2,3,4,5,6,10,11,12,66)
</if>

<if test=" null != type ">
and c.`type` = #{type}
</if>
@@ -647,14 +641,17 @@
and c.`merchant_type` = #{merchantType}
</if>

<if test=" null != merchantId ">
and cm.`merchant_id` = #{merchantId}
</if>

<if test=" null != giftList">
and JSON_CONTAINS(c.gift_list,json_array(#{giftList}))
</if>

<if test=" null != targetAd ">
and 0 = (select count(*) from wx_coupon_channel cc
where c.`id` = cc.coupon_id
and cc.status = 0
and cc.target_ad = #{targetAd})
</if>

<if test=" null != ids ">
and c.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -676,15 +673,34 @@
</foreach>
</if>

<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findCouponList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
<if test="plat != null and plat == 3">
,poi.spu_id,poi.status poi_status,poi.status_desc,poi.last_status,poi.last_status_desc
</if>
from wx_coupon c
left join wx_coupon_merchant cm on c.id = cm.product_id and cm.status = 0
<if test="plat != null and plat == 3">
left join tt_coupon_channel_poi poi on poi.id = c.id
</if>
where c.is_del = 0
<if test="plat != null and plat == 3">
<if test=" null != spuId and '' != spuId">
and poi.`spu_id` = #{spuId}
</if>

<if test=" null != poiStatus">
and poi.`status` = #{poiStatus}
</if>

<if test=" null != lastStatus">
and poi.`last_status` = #{lastStatus}
</if>
</if>
<include refid="dynamicWhereConditionsForCoupon"/>
<if test=" null != sortColumns">order by ${sortColumns}</if>

<if test="null != limitStart and null != limitEnd">
limit #{limitStart},#{limitEnd}
@@ -693,9 +709,25 @@

<select id="findCouponListCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Integer">
select
count(distinct c.id)
count(c.id)
from wx_coupon c
left join wx_coupon_merchant cm on c.id = cm.product_id and cm.status = 0
<if test="plat != null and plat == 3">
left join tt_coupon_channel_poi poi on poi.id = c.id
</if>
where c.is_del = 0
<if test="plat != null and plat == 3">
<if test=" null != spuId and '' != spuId">
and poi.`spu_id` = #{spuId}
</if>

<if test=" null != poiStatus">
and poi.`status` = #{poiStatus}
</if>

<if test=" null != lastStatus">
and poi.`last_status` = #{lastStatus}
</if>
</if>
<include refid="dynamicWhereConditionsForCoupon"/>
</select>



+ 5
- 1
mallinkService/src/main/resources/mapper/WxMallMapper.xml View File

@@ -207,9 +207,13 @@
and m.`parent_tenant_id` = #{parentTenantId}
</if>
</select>


<update id="updateUnSubMall">
update wx_mall set parent_tenant_id = null where parent_tenant_id = #{parentTenantId}
</update>
<update id="undateSubmall">
update wx_mall set parent_tenant_id = null where parent_tenant_id = #{parentTenantId} ;
<if test="tenantIds != null and tenantIds.size > 0">
update wx_mall set parent_tenant_id = #{parentTenantId} where tenant_id in
<foreach collection="tenantIds" item="item" index="index" open="("


Loading…
Cancel
Save