diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFloatingLayerController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFloatingLayerController.java index a94f32e74..ad1d52c8b 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFloatingLayerController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFloatingLayerController.java @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.BaseEntity; import com.iformall.domain.po.WxFloatingLayer; +import com.iformall.domain.vo.WxFloatingLayerVO; import com.iformall.enums.EnumFloatingLayerStatus; import com.iformall.exception.MallinkException; import com.iformall.service.WxFloatingLayerService; @@ -29,7 +30,7 @@ public class WxFloatingLayerController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired - private WxFloatingLayerService wxFloatingLayerService; + WxFloatingLayerService wxFloatingLayerService; @ApiOperation("分页列表接口") @GetMapping("/list") @@ -41,7 +42,7 @@ public class WxFloatingLayerController extends BaseController { logger.debug("[" + getIpAddr() + "] WxFloatingLayerController::list"); wxFloatingLayer.setTenantId(getTenantId()); wxFloatingLayer.setSortColumns(BaseEntity.SortField.CreateTime_DESC, BaseEntity.SortField.Id_DESC); - final PageInfo page = wxFloatingLayerService.listAsPage(wxFloatingLayer, pageNum, pageSize); + final PageInfo page = wxFloatingLayerService.listAsPage(wxFloatingLayer, pageNum, pageSize); return new ResultData(page); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreHistoryController.java index 17752c865..797eb070c 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreHistoryController.java @@ -2,10 +2,14 @@ package com.iformall.controller.mem; import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; +import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; +import com.iformall.domain.po.WxCUserBasicInfo; import com.iformall.domain.po.WxScoreHistory; +import com.iformall.enums.EnumCUserBasicInfoStatus; +import com.iformall.service.WxCUserBasicInfoService; import com.iformall.service.WxScoreHistoryService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -23,6 +27,10 @@ public class WxScoreHistoryController extends BaseController { @Autowired private WxScoreHistoryService wxScoreHistoryService; + @Autowired + private WxCUserBasicInfoService wxCUserBasicInfoService; + + @ApiOperation("分页列表接口") @GetMapping("list") @ApiImplicitParams({ @@ -43,6 +51,9 @@ public class WxScoreHistoryController extends BaseController { logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::add"); //Assert.notNull(wxScoreHistory.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); + if (checkMemberStatus(wxScoreHistory.getCUserId())) { + return new ResultData(ErrorCode.MEMBER_IS_LOCKED); + } wxScoreHistoryService.saveOrUpdate(wxScoreHistory); return new ResultData(); } @@ -52,10 +63,22 @@ public class WxScoreHistoryController extends BaseController { @SystemControllerLog(description = "成长值-更新") public ResultData update(@RequestBody WxScoreHistory wxScoreHistory) { logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::update"); + if (checkMemberStatus(wxScoreHistory.getCUserId())) { + return new ResultData(ErrorCode.MEMBER_IS_LOCKED); + } wxScoreHistoryService.saveOrUpdate(wxScoreHistory); return new ResultData(); } + public boolean checkMemberStatus(Long userId) { + WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(userId); + if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { + logger.info("会员权益被锁定:cUserId:" + userId); + return true; + } + return false; + } + @ApiOperation("根据id删除接口") @GetMapping("/del") @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) diff --git a/mallinkAdmin/src/main/resources/db/migration/V201909271530__G_MALL.sql b/mallinkAdmin/src/main/resources/db/migration/V201909271530__G_MALL.sql new file mode 100644 index 000000000..5ff899998 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201909271530__G_MALL.sql @@ -0,0 +1,2 @@ +alter table wx_mall +change column `introduction` `introduction` varchar(1024) DEFAULT '' not null COMMENT '简介'; \ No newline at end of file diff --git a/mallinkAdmin/src/main/resources/db/migration/V201909271732__G_ALTER_CREDIT_HISTORY.sql b/mallinkAdmin/src/main/resources/db/migration/V201909271732__G_ALTER_CREDIT_HISTORY.sql new file mode 100644 index 000000000..0afe00fdf --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201909271732__G_ALTER_CREDIT_HISTORY.sql @@ -0,0 +1 @@ +alter table wx_credit_history change column buserId buser_id bigint(20) default 0 not null comment 'B端微信用户ID'; diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java index cea078e18..977851b7a 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java @@ -28,8 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Date; -import java.util.HashMap; -import java.util.List; import java.util.Map; @RestController @@ -66,6 +64,12 @@ public class WxOrderController extends BaseController { if (resultData != null) return resultData; WxCUser user = getUser(); + WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(user.getId()); + if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { + logger.info("会员权益被锁定:cUserId:" + user.getId()); + return new ResultData(ErrorCode.MEMBER_IS_LOCKED); + } + resultData = couponUserCheck(user, wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId())); if (resultData != null) return resultData; diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index 526a2be4a..381907dd7 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -668,6 +668,7 @@ public class WxUserGrantController extends BaseController { userVo.setBirthdate(wxCUserBasicInfo.getBirthdate()); userVo.setSex(wxCUserBasicInfo.getSex()); userVo.setAddress(wxCUserBasicInfo.getAddress()); + userVo.setStatus(wxCUserBasicInfo.getStatus()); } return new ResultData(userVo); diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/FloatingLayerSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/FloatingLayerSchedule.java index 31d56eed7..7a94396b7 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/FloatingLayerSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/FloatingLayerSchedule.java @@ -1,6 +1,6 @@ package com.iformall.schedule; -import com.iformall.mapper.WxFloatingLayerMapper; +import com.iformall.mapper.WxCuserFloatingLayerMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -16,7 +16,7 @@ public class FloatingLayerSchedule { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired - private WxFloatingLayerMapper wxFloatingLayerMapper; + private WxCuserFloatingLayerMapper wxCuserFloatingLayerMapper; /** @@ -25,7 +25,7 @@ public class FloatingLayerSchedule { @Scheduled(cron = "0 48 10 * * ?") public void sendMsg() { logger.info("删除前一天浮层用户数据开始"); - wxFloatingLayerMapper.delete(null); + wxCuserFloatingLayerMapper.delete(null); logger.info("删除前一天浮层用户数据结束"); } diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index 9e2ab4f0a..8c34b6973 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -525,6 +525,11 @@ public enum ErrorCode{ // 招商管理 53000 begin CUSTOMER_NOT_FOUND(53000, "客户信息不存在"), // 招商管理 53999 end + /** + * 首页浮屠广告 + */ + FLOATING_LAYER_FOUND(60001, "首页广告已存在,请先下线再重新投放"), + ; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java index 53c4c3efb..b8f0ca3c5 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java @@ -126,10 +126,10 @@ public class WxMerchant extends BaseEntity { private String talkUserAux; @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "startTime") - private transient Date starttime; + private transient Date starttime; @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endTime") - private transient Date endtime; + private transient Date endtime; @io.swagger.annotations.ApiModelProperty(value = "昵称", name = "userName") private transient String userName; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/UserTradeRecordVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/UserTradeRecordVo.java index c23014fbc..76c7541c2 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/UserTradeRecordVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/UserTradeRecordVo.java @@ -17,7 +17,7 @@ public class UserTradeRecordVo implements Serializable{ private String sale; @Excel(name="面额",width = 20,orderNum = "3") private String price; - @Excel(name="卷状态",width = 20,orderNum = "4") + @Excel(name="券状态",width = 20,orderNum = "4") private String status; @Excel(name="交易时间",width = 20,orderNum = "5") private String tradeTime; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxCUserVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxCUserVo.java index 0e168514f..0355736a2 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxCUserVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxCUserVo.java @@ -36,4 +36,7 @@ public class WxCUserVo extends WxCUser { private Integer upgradePercent; @io.swagger.annotations.ApiModelProperty(value="升级分",name="upgradeScore") private Integer upgradeScore; + + @io.swagger.annotations.ApiModelProperty(value = "0正常1锁定", name = "status") + private Integer status; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxFloatingLayerVO.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxFloatingLayerVO.java new file mode 100644 index 000000000..760ada70c --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxFloatingLayerVO.java @@ -0,0 +1,39 @@ +package com.iformall.domain.vo; + +import com.iformall.domain.po.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@EqualsAndHashCode(callSuper = true) +public class WxFloatingLayerVO extends BaseEntity { + private static final long serialVersionUID = 1L; + + protected Long id; + + @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") + private String tenantId; + + @io.swagger.annotations.ApiModelProperty(value = "封面图", name = "coverImg") + private String coverImg; + + @io.swagger.annotations.ApiModelProperty(value = "产品ID", name = "produceId") + private Long produceId; + + @io.swagger.annotations.ApiModelProperty(value = "小程序跳转路径", name = "pagePath") + private String pagePath; + + @io.swagger.annotations.ApiModelProperty(value = "0上线 1下线", name = "status") + private Integer status; + + @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createTime") + private Date createTime; + + @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateTime") + private Date updateTime; + + @io.swagger.annotations.ApiModelProperty(value = "名称", name = "title") + private String title; +} diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantTradeDetailVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantTradeDetailVo.java index 522590acc..23a95d95c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantTradeDetailVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantTradeDetailVo.java @@ -23,15 +23,12 @@ public class WxMerchantTradeDetailVo extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value = "券名称", name = "couponName") private String couponName; - @Excel(name="券价格",width = 20,orderNum = "4") @io.swagger.annotations.ApiModelProperty(value = "券价格", name = "couponSale") private Integer couponSale; - @Excel(name="券面额",width = 20,orderNum = "5") @io.swagger.annotations.ApiModelProperty(value = "核销券面额", name = "couponPrice") private Integer couponPrice; - @Excel(name="消费金额",width = 20,orderNum = "6") @io.swagger.annotations.ApiModelProperty(value = "消费金额", name = "tradeAmt") private Integer tradeAmt; @@ -40,6 +37,18 @@ public class WxMerchantTradeDetailVo extends BaseEntity { @Excel(name="交易时间",width = 20,orderNum = "7") @io.swagger.annotations.ApiModelProperty(value = "交易时间", name = "tradeDate") - private Date tradeDateStr; + private String tradeDateStr; + + + + @Excel(name="券价格",width = 20,orderNum = "4") + private String couponSaleStr; + + @Excel(name="券面额",width = 20,orderNum = "5") + private String couponPriceStr; + + @Excel(name="消费金额",width = 20,orderNum = "6") + private String tradeAmtStr; + } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCUserBasicInfoStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumCUserBasicInfoStatus.java new file mode 100644 index 000000000..40587314f --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCUserBasicInfoStatus.java @@ -0,0 +1,35 @@ +package com.iformall.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumCUserBasicInfoStatus { + + NORMAL(0, "正常"), + LOCKED(1, "锁定"),; + + public static EnumCUserBasicInfoStatus getEnum(Integer code) { + for (EnumCUserBasicInfoStatus value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumCUserBasicInfoStatus(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCarSupport.java b/mallinkService/src/main/java/com/iformall/enums/EnumCarSupport.java index aab316a4f..8ffc2efee 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumCarSupport.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCarSupport.java @@ -8,7 +8,7 @@ public enum EnumCarSupport { // 0-不支持 1-ETCP NOCAR(0, "暂未支持"), - ETCP(1, "ETCP"), + CAR(1, "停车支持"), ; public static EnumCarSupport getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxFloatingLayerMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxFloatingLayerMapper.java index c914083ef..74d05d895 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxFloatingLayerMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxFloatingLayerMapper.java @@ -2,6 +2,7 @@ package com.iformall.mapper; import com.iformall.common.CommonMapper; import com.iformall.domain.po.WxFloatingLayer; +import com.iformall.domain.vo.WxFloatingLayerVO; import java.util.List; @@ -12,4 +13,8 @@ public interface WxFloatingLayerMapper extends CommonMapper findList(WxFloatingLayer wxFloatingLayer); + List findListVO(WxFloatingLayer wxFloatingLayer); + + void updateStatus(Long couponId); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index 308922c7a..63c3b7d57 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -209,18 +209,18 @@ public interface WxCouponService { * 库存减少 * * @param id 券ID - * @param remainInventory 当前库存 * @param number 减少数量 + * @param remainInventory 当前库存 */ - void reduceRemainInventory(Long id, Integer remainInventory, Integer number); + void reduceRemainInventory(Long id, Integer number, Integer remainInventory); /** * 库存退回 * * @param id 券ID - * @param remainInventory 当前库存 * @param number 回退数量 + * @param remainInventory 当前库存 */ - void backRemainInventory(Long id, Integer remainInventory, Integer number); + void backRemainInventory(Long id, Integer number, Integer remainInventory); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxFloatingLayerService.java b/mallinkService/src/main/java/com/iformall/service/WxFloatingLayerService.java index f814f03c2..59232c9fd 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFloatingLayerService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFloatingLayerService.java @@ -3,6 +3,7 @@ package com.iformall.service; import com.github.pagehelper.PageInfo; import com.iformall.common.ResultData; import com.iformall.domain.po.WxFloatingLayer; +import com.iformall.domain.vo.WxFloatingLayerVO; /** * @author gongbiao @@ -17,7 +18,7 @@ public interface WxFloatingLayerService { * @param pageSize * @return */ - PageInfo listAsPage(WxFloatingLayer record, Integer pageIndex, Integer pageSize); + PageInfo listAsPage(WxFloatingLayer record, Integer pageIndex, Integer pageSize); /** * 根据Id获得实体 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java index c9f30c7d6..9508757a7 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -849,13 +849,15 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { Date createDate = oldUserBase.getCreateDate() == null ? new Date() : oldUserBase.getCreateDate(); oldUserBase.setUpdateDate(userBase.getUpdateDate() == null ? updateDate : userBase.getUpdateDate()); oldUserBase.setCreateDate(userBase.getCreateDate() == null ? createDate : userBase.getCreateDate()); - // 成长值 - if(points != null) { - oldUserBase.setPoins(points); - } - // 覆盖原积分 - if(credit != null) { - oldUserBase.setCredit(credit); + if (oldUserBase.getStatus().equals(EnumCUserBasicInfoStatus.NORMAL.getCode())) { + // 成长值 + if (points != null) { + oldUserBase.setPoins(points); + } + // 覆盖原积分 + if (credit != null) { + oldUserBase.setCredit(credit); + } } } else { userBase.setId(idWorker.nextId()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index 8e1b4b6b8..6726472ba 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -13,10 +13,7 @@ import com.iformall.domain.vo.WxCouponChannelAddVo; import com.iformall.domain.vo.WxCouponChannelVo; import com.iformall.domain.vo.WxMerchantVo; import com.iformall.enums.*; -import com.iformall.mapper.WxCardInfoMapper; -import com.iformall.mapper.WxCouponChannelMapper; -import com.iformall.mapper.WxCouponMerchantMapper; -import com.iformall.mapper.WxMerchantMapper; +import com.iformall.mapper.*; import com.iformall.service.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,6 +43,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { QrCodeService qrCodeService; @Autowired WxCardInfoMapper wxCardInfoMapper; + @Autowired + WxFloatingLayerMapper wxFloatingLayerMapper; /** * B端业务端 @@ -105,7 +104,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { wxOrderService.updateOrderGroupStatusByCouponChannelId(record.getId(), record.getTenantId(), EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode()); //修改卡状态 wxCardInfoMapper.updateTransferStatusByCouponId(orignal.getCouponId()); - + //浮层下架 + wxFloatingLayerMapper.updateStatus(orignal.getCouponId()); } } record.setUpdateDate(new Date()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java index 8a9fbaf4d..a39e095b8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java @@ -179,7 +179,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { } //更新库存 - wxCouponService.reduceRemainInventory(wxCouponOfDb.getId(), wxCouponOfDb.getRemainInventory(), merchantLnventory); + wxCouponService.reduceRemainInventory(wxCouponOfDb.getId(), merchantLnventory, wxCouponOfDb.getRemainInventory()); } @Override @@ -208,7 +208,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { } //退回coupon库存 if(merchantRemain!=0) { - wxCouponService.backRemainInventory(queryById.getId(), wxCouponOfDb.getRemainInventory(), merchantRemain); + wxCouponService.backRemainInventory(queryById.getId(), merchantRemain, wxCouponOfDb.getRemainInventory()); } } wxCouponSendMapper.updateById(record); @@ -310,6 +310,12 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { return false; } + WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId); + if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { + logger.info("会员权益被锁定:cUserId:" + cUserId); + return false; + } + //查询开关是否打开 WxCouponSendConfig wxCouponSendConfig = new WxCouponSendConfig(); wxCouponSendConfig.setSendType(type.getCode()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index e260fa13c..dc7a41af3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -668,7 +668,7 @@ import java.util.stream.Collectors; @Override @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) - public void reduceRemainInventory(Long id, Integer remainInventory, Integer number) { + public void reduceRemainInventory(Long id, Integer number, Integer remainInventory) { int num = wxCouponMapper.reduceInventory(id, number, remainInventory); if (num == 0) { throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); @@ -677,7 +677,7 @@ import java.util.stream.Collectors; @Override @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) - public void backRemainInventory(Long id, Integer remainInventory, Integer number) { + public void backRemainInventory(Long id, Integer number, Integer remainInventory) { int num = wxCouponMapper.backInventory(id, number, remainInventory); if (num == 0) { throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java index 4b2e792cb..dd9ffbf7d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java @@ -25,13 +25,13 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired - WxCuserFloatingLayerMapper WxCuserFloatingLayerMapper; + WxCuserFloatingLayerMapper wxCuserFloatingLayerMapper; @Autowired - WxFloatingLayerMapper WxFloatingLayerMapper; + WxFloatingLayerMapper wxFloatingLayerMapper; @Autowired - WxCUserMapper WxCUserMapper; + WxCUserMapper wxCUserMapper; @Override @@ -39,14 +39,14 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ //1 查看是否存在用户,用户不存在 直接返回浮层信息 WxCUser user = new WxCUser(); user.setOpenId(openId); - WxCUser byOpenId = WxCUserMapper.findByOpenId(user); + WxCUser byOpenId = wxCUserMapper.findByOpenId(user); if (byOpenId == null) { return getWxFloatingLayer(); } //2 用户存在 查看是否已有弹出记录 没有 保存记录后返回浮层信息 WxCuserFloatingLayer wxCuserFloatingLayerQuery = new WxCuserFloatingLayer(); wxCuserFloatingLayerQuery.setUserId(byOpenId.getId()); - WxCuserFloatingLayer wxCuserFloatingLayer = WxCuserFloatingLayerMapper.selectOne(new QueryWrapper<>(wxCuserFloatingLayerQuery)); + WxCuserFloatingLayer wxCuserFloatingLayer = wxCuserFloatingLayerMapper.selectOne(new QueryWrapper<>(wxCuserFloatingLayerQuery)); if (wxCuserFloatingLayer == null) { saveCuserFloatingLayer(byOpenId); return getWxFloatingLayer(); @@ -62,12 +62,12 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ wxCuserFloatingLayer.setUserId(wxCUser.getId()); wxCuserFloatingLayer.setTenantId(wxCUser.getTenantId()); wxCuserFloatingLayer.setCreateTime(new Date()); - WxCuserFloatingLayerMapper.insert(wxCuserFloatingLayer); + wxCuserFloatingLayerMapper.insert(wxCuserFloatingLayer); } public WxFloatingLayer getWxFloatingLayer() { WxFloatingLayer wxFloatingLayer = new WxFloatingLayer(); wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_THROW_IN.getCode()); - return WxFloatingLayerMapper.selectOne(new QueryWrapper<>(wxFloatingLayer)); + return wxFloatingLayerMapper.selectOne(new QueryWrapper<>(wxFloatingLayer)); } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFloatingLayerServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFloatingLayerServiceImpl.java index 0161c88fd..5ac85241d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFloatingLayerServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFloatingLayerServiceImpl.java @@ -1,5 +1,6 @@ package com.iformall.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; @@ -7,6 +8,7 @@ import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.WxFloatingLayer; +import com.iformall.domain.vo.WxFloatingLayerVO; import com.iformall.mapper.WxFloatingLayerMapper; import com.iformall.service.WxFloatingLayerService; import org.apache.commons.lang3.StringUtils; @@ -27,16 +29,16 @@ public class WxFloatingLayerServiceImpl implements WxFloatingLayerService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired - WxFloatingLayerMapper WxFloatingLayerMapper; + WxFloatingLayerMapper wxFloatingLayerMapper; @Override - public PageInfo listAsPage(WxFloatingLayer record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> WxFloatingLayerMapper.findList(record)); + public PageInfo listAsPage(WxFloatingLayer record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFloatingLayerMapper.findListVO(record)); } @Override public WxFloatingLayer getById(Long id) { - return WxFloatingLayerMapper.selectById(id); + return wxFloatingLayerMapper.selectById(id); } @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @@ -48,16 +50,23 @@ public class WxFloatingLayerServiceImpl implements WxFloatingLayerService { if (StringUtils.isEmpty(wxFloatingLayer.getPagePath())) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "小程序跳转路径不能为空"); } + WxFloatingLayer wxFloatingLayerQuery = new WxFloatingLayer(); + wxFloatingLayerQuery.setTenantId(wxFloatingLayer.getTenantId()); + wxFloatingLayerQuery.setStatus(wxFloatingLayer.getStatus()); + Integer integer = wxFloatingLayerMapper.selectCount(new QueryWrapper<>(wxFloatingLayerQuery)); + if (integer > 0) { + return new ResultData(ErrorCode.FLOATING_LAYER_FOUND); + } Date date = new Date(); if (wxFloatingLayer.getId() == null) { final IdWorker idWorker = IdWorker.get(); wxFloatingLayer.setId(idWorker.nextId()); wxFloatingLayer.setCreateTime(date); wxFloatingLayer.setUpdateTime(date); - WxFloatingLayerMapper.insert(wxFloatingLayer); + wxFloatingLayerMapper.insert(wxFloatingLayer); } else { wxFloatingLayer.setUpdateTime(date); - WxFloatingLayerMapper.updateById(wxFloatingLayer); + wxFloatingLayerMapper.updateById(wxFloatingLayer); } return new ResultData(Result.SUCCESS, "操作成功"); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index cfe9f2610..7468228e3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -19,6 +19,9 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.*; import com.iformall.service.*; import com.iformall.utils.BeanMapping; +import com.iformall.utils.DataUtil; +import com.iformall.utils.DateUtils; +import me.chanjar.weixin.common.util.DataUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -749,6 +753,18 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Override public void exportUserTradeList(WxMerchant record,HttpServletRequest request, HttpServletResponse response) { List datalist = wxMerchantMapper.userTradeDetailList(record); + datalist.stream().forEach(e->{ + if(e.getTradeDate() != null) { + e.setTradeDateStr(DateUtils.formatDateTime(e.getTradeDate())); + } + BigDecimal bigDecimal = new BigDecimal(e.getCouponPrice()); + e.setCouponPriceStr(bigDecimal.divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP).toString()); + bigDecimal = new BigDecimal(e.getCouponSale()); + e.setCouponSaleStr(bigDecimal.divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP).toString()); + bigDecimal = new BigDecimal(e.getTradeAmt()); + e.setTradeAmtStr(bigDecimal.divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP).toString()); + + }); excelService.exportExcel(datalist, null, "商户会员消费列表", WxMerchantTradeDetailVo.class, "商户会员消费列表.xlsx", response, false); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java index f959550f7..b7b352d12 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -513,7 +513,7 @@ public class WxOrderServiceImpl implements WxOrderService { } try { - wxCouponMapper.backInventory(coupon.getId(), coupon.getRemainInventory(), 1); + wxCouponMapper.backInventory(coupon.getId(), 1, coupon.getRemainInventory()); } catch (Exception e) { logger.error("数据库更新失败,库存+1失败, e:" + e.getMessage()); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "库存恢复失败"); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java index b04daf8fe..3e2fbfa02 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java @@ -6,6 +6,7 @@ import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.domain.po.*; import com.iformall.enums.EnumBusiness; +import com.iformall.enums.EnumCUserBasicInfoStatus; import com.iformall.enums.EnumScoreRules; import com.iformall.enums.EnumScoreType; import com.iformall.exception.MallinkException; @@ -555,27 +556,42 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { @Override public int addScore(EnumScoreType scoreType, Object param) { - + WxCUser wxCUser = null; + WxCUserCar userCar = null; + WxCUserBasicInfo userBasicInfo = null; + Long userId = null; + if (param instanceof WxCUser) { + wxCUser = (WxCUser) param; + userId = wxCUser.getId(); + } + if (param instanceof WxCUserCar) { + userCar = (WxCUserCar) param; + userId = userCar.getCUserId(); + } + if (param instanceof WxCUserBasicInfo) { + userBasicInfo = (WxCUserBasicInfo) param; + userId = userBasicInfo.getId(); + } + WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId); + if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { + logger.info("会员权益被锁定:cUserId:" + userId); + return 0; + } switch (scoreType){ case LOGIN: { - WxCUser user = (WxCUser) param; - return loginAddScore(user); + return loginAddScore(wxCUser); } case BIND_CAR:{ - WxCUserCar userCar = (WxCUserCar) param; return bindCarAddScore(userCar); } case WECHAT_PERSION:{ - WxCUser user = (WxCUser) param; - return personAddScore(user); + return personAddScore(wxCUser); } case WECHAT_PHONE:{ - WxCUser user = (WxCUser) param; - return phoneAddScore(user); + return phoneAddScore(wxCUser); } case COMPLETE_INFO:{ - WxCUserBasicInfo user = (WxCUserBasicInfo) param; - return infoAddScore(user); + return infoAddScore(userBasicInfo); } default: { @@ -587,14 +603,30 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { @Override public int addScore2(EnumScoreType scoreType, Object param1, Object param2) { + WxOrder order = null; + WxCUserBasicInfo user = null; + Long userId = null; + if (param1 instanceof WxOrder) { + order = (WxOrder) param1; + userId = order.getCUserId(); + } + if (param1 instanceof WxCUserBasicInfo) { + user = (WxCUserBasicInfo) param1; + userId = user.getId(); + } + + WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId); + if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { + logger.info("会员权益被锁定:cUserId:" + userId); + return 0; + } + switch (scoreType){ case CONSUMPTION: { - WxOrder order = (WxOrder) param1; Integer bussinessId = (Integer) param2; return payAddScore(order, bussinessId); } case MEM_IMPORT: { - WxCUserBasicInfo user = (WxCUserBasicInfo) param1; boolean bHaveCUser = (boolean)(param2); return memResetScore(user, bHaveCUser); } @@ -606,9 +638,13 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { @Override public int reduceScore(EnumScoreType scoreType, Object param1, Object param2, Object param3) { + WxCUserBasicInfo user = (WxCUserBasicInfo) param1; + if (user != null && user.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { + logger.info("会员权益被锁定:cUserId:" + user.getId()); + return 0; + } switch (scoreType){ case MEM_REDUCE: { - WxCUserBasicInfo user = (WxCUserBasicInfo)param1; String reason = (String)param2; Integer scoreNum = (Integer)param3; return memReduceScore(user, reason, scoreNum); diff --git a/mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml b/mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml index 716d2b013..1e4991fe8 100644 --- a/mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml @@ -39,7 +39,7 @@ - select - - from wx_floating_layer - - - - diff --git a/mallinkService/src/main/resources/mapper/WxFloatingLayerMapper.xml b/mallinkService/src/main/resources/mapper/WxFloatingLayerMapper.xml new file mode 100644 index 000000000..06e4d440a --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxFloatingLayerMapper.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + `id`, `tenant_id` , `cover_img` , `produce_id`, `page_path` , `status`, `create_time`, `update_time` + + + + where 1 = 1 + + + and `id` = #{id} + + + + and `tenant_id` = #{tenantId} + + + + and `status` = #{status} + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + fl.`id` as id, fl.`tenant_id` , fl.`cover_img` , fl.`produce_id`, + fl.`page_path` , fl.`status`, fl.`create_time` as create_time, fl.`update_time`, + c.title + + + + + + + + + + + + + + + + + + + + and fl.`id` = #{id} + + + + and fl.`tenant_id` = #{tenantId} + + + + and fl.`status` = #{status} + + + + and fl.id in + + #{idItem} + + + order by ${sortColumns} + + + + + + update wx_floating_layer set status=1 where produce_id=#{value} + + + diff --git a/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml index 53dcdb3f9..096563c53 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml @@ -428,11 +428,13 @@ (select count(*) from wx_coupon_order o left join wx_coupon co on(o.`coupon_id`=co.id) left join wx_coupon_merchant cm on(cm.product_id=co.id) - inner join wx_c_user_basic_info c on(o.c_user_id=c.id) where cm.`merchant_id`=m.id and o.coupon_order_status=1 - + inner join wx_c_user_basic_info c on(o.c_user_id=c.id) + inner join wx_merchant_b_user mb on(mb.id=c.id) + where cm.`merchant_id`=m.id and o.coupon_order_status=1 and mb.merchant_id=m.id + and o.create_date >= #{starttime} - + and o.create_date <= #{endtime} ) consumeCount, @@ -440,11 +442,13 @@ (select count(distinct c.id) from wx_coupon_order o left join wx_coupon co on(o.`coupon_id`=co.id) left join wx_coupon_merchant cm on(cm.product_id=co.id) - inner join wx_c_user_basic_info c on(o.c_user_id=c.id) where cm.`merchant_id`=m.id and o.coupon_order_status=1 - + inner join wx_c_user_basic_info c on(o.c_user_id=c.id) + inner join wx_merchant_b_user mb on(mb.id=c.id) + where cm.`merchant_id`=m.id and o.coupon_order_status=1 and mb.merchant_id=m.id + and o.create_date >= #{starttime} - + and o.create_date <= #{endtime} ) consumeCountP, @@ -452,16 +456,19 @@ IFNULL((select sum(co.price) from wx_coupon_order o left join wx_coupon co on(o.`coupon_id`=co.id) left join wx_coupon_merchant cm on(cm.product_id=co.id) - inner join wx_c_user_basic_info c on(o.c_user_id=c.id) where cm.`merchant_id`=m.id and o.coupon_order_status=1 - + inner join wx_c_user_basic_info c on(o.c_user_id=c.id) + inner join wx_merchant_b_user mb on(mb.id=c.id) + where cm.`merchant_id`=m.id and o.coupon_order_status=1 and mb.merchant_id=m.id + and o.create_date >= #{starttime} - + and o.create_date <= #{endtime} + ),0) tradeAmt - from wx_merchant m where 1=1 + from wx_merchant m where m.status=1 and `name` like concat('%', #{name},'%') @@ -494,6 +501,12 @@ and co.`title` like concat('%', #{couponName},'%') + + and o.create_date >= #{starttime} + + + and o.create_date <= #{endtime} + order by o.create_date desc