diff --git a/mallinkAdmin/src/main/resources/db/migration/V201909101027__CHANGE_COUPON_CHANNEL.sql b/mallinkAdmin/src/main/resources/db/migration/V201909101027__CHANGE_COUPON_CHANNEL.sql new file mode 100644 index 000000000..86b72b0fc --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201909101027__CHANGE_COUPON_CHANNEL.sql @@ -0,0 +1,2 @@ +ALTER TABLE `wx_coupon_channel` +ADD INDEX `coupon_index` (`coupon_id`) comment ''; diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java index b00c9aeff..607638fa8 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java @@ -20,10 +20,12 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Objects; @RestController @RequestMapping("/api/credit") @@ -44,9 +46,9 @@ public class WxCreditHistoryController extends BaseController { @GetMapping("/findByMerchantIdAndSpend") @ApiImplicitParams({ @ApiImplicitParam(name="merchantId",value="商户ID",dataType="long", paramType = "query",required=true), - @ApiImplicitParam(name="spend",value="消费金额",dataType="int", paramType = "query",required=true), + @ApiImplicitParam(name="spendStr",value="消费金额",dataType="int", paramType = "query",required=true), @ApiImplicitParam(name = "userId", value = "会员Id", dataType = "long", paramType = "query", required = true)}) - public ResultData findByMerchantIdAndSpend(@RequestParam Long merchantId, @RequestParam String spendStr,@RequestParam Long userId) { + public ResultData findByMerchantIdAndSpend(Long merchantId, String spendStr,Long userId) { log.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend"); WxMerchant wxMerchant = new WxMerchant(); wxMerchant.setStatus(EnumYesOrNo.YES.getCode()); @@ -56,6 +58,9 @@ public class WxCreditHistoryController extends BaseController { if (wxMerchant.getIsAdmin() != EnumYesOrNo.YES.getCode() && merchantId.longValue() != getUser().getMerchantId().longValue()) { return new ResultData(ErrorCode.USER_NO_PERMISSION); } + if(Objects.isNull(merchantId)|| StringUtils.isEmpty(spendStr)||Objects.isNull(userId)) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; + } return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId,spendStr,userId,getTenantId())); } diff --git a/mallinkCApi/src/main/java/com/iformall/config/RedisConfig.java b/mallinkCApi/src/main/java/com/iformall/config/RedisConfig.java index 7e167a93e..39666265b 100644 --- a/mallinkCApi/src/main/java/com/iformall/config/RedisConfig.java +++ b/mallinkCApi/src/main/java/com/iformall/config/RedisConfig.java @@ -4,6 +4,7 @@ import com.iformall.domain.po.PushLimit; import com.iformall.domain.po.WxCUser; import com.iformall.domain.po.WxMall; import com.iformall.domain.po.WxScoreRules; +import com.iformall.domain.vo.WxCouponCVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cache.CacheManager; @@ -122,4 +123,21 @@ public class RedisConfig extends CachingConfigurerSupport { return template; } + @Bean("couponDetailRedisTemplate") + public RedisTemplate getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { + RedisTemplate template = new RedisTemplate(); + + Jackson2JsonRedisSerializer j = new Jackson2JsonRedisSerializer(WxCouponCVo.class); + // value值的序列化 + template.setValueSerializer(j); + template.setHashKeySerializer(j); + + // key的序列化 + template.setKeySerializer(new StringRedisSerializer()); + template.setHashKeySerializer(new StringRedisSerializer()); + + template.setConnectionFactory(connectionFactory); + return template; + } + } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java index 9dd32a89b..10b47e864 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -17,9 +17,13 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.web.bind.annotation.*; import java.util.Date; +import java.util.concurrent.TimeUnit; @RestController @RequestMapping("/api/wxCoupon") @@ -29,31 +33,80 @@ public class WxCouponController extends BaseController { @Autowired private WxCouponChannelService wxCouponChannelService; + + @Autowired + private WxCouponService couponService; + @Autowired - private WxCouponService wxCouponService; + @Qualifier("couponDetailRedisTemplate") + RedisTemplate cdRedisTemplate; @ApiOperation("根据id(couponChannel)查询接口") @GetMapping("/detail") @ApiImplicitParams({ - @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) - public ResultData detailC(String couponChannelId) { + @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true), + @ApiImplicitParam(name = "couponId", value = "couponId", dataType = "String", paramType = "query", required = false)}) + public ResultData detailC(String couponChannelId, String couponId) { if (StringUtils.isBlank(couponChannelId) || couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId/couponId为空"); } - Long couponChannelIdL = 0L; + Long couponChannelIdL = 0L, couponIdL = 0L; try { couponChannelIdL = Long.valueOf(couponChannelId); + if (StringUtils.isNotBlank(couponId) && !couponId.equalsIgnoreCase(Constant.UNDEFINED)) { + couponIdL = Long.valueOf(couponId); + } } catch (NumberFormatException e) { logger.error("id转换失败" + couponChannelId); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponChannelId); } + String key = "cc:" + couponChannelId; + + ValueOperations operations = cdRedisTemplate.opsForValue(); + // 缓存 + boolean hasKey = cdRedisTemplate.hasKey(key); + if (hasKey) { + // 从缓存获取用户信息 + WxCouponCVo wxCouponCVo = operations.get(key); + if (couponIdL > 0L) { + // 更新状态 + WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL); + if (wxCouponCVo == null) { + return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + wxCouponCVo.setRemainInventory(couponCVo.getRemainInventory()); + wxCouponCVo.setStatus(couponCVo.getStatus()); + } else { + // 更新状态 + WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelIdL); + if (wxCouponCVo == null) { + return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + wxCouponCVo.setRemainInventory(couponCVo.getRemainInventory()); + wxCouponCVo.setStatus(couponCVo.getStatus()); + } + // end of 更新状态 + updateActivityStatus(wxCouponCVo); + return new ResultData(wxCouponCVo); + } + WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(couponChannelIdL); - if (wxCouponCVo == null) + if (wxCouponCVo == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + + // 插入缓存 + operations.set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); + + updateActivityStatus(wxCouponCVo); + + return new ResultData(wxCouponCVo); + } - if (wxCouponCVo.getTargetAd()!= null && + private void updateActivityStatus(WxCouponCVo wxCouponCVo) { + if (wxCouponCVo.getTargetAd() != null && wxCouponCVo.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) { Date now = new Date(); @@ -65,8 +118,6 @@ public class WxCouponController extends BaseController { wxCouponCVo.setActivityStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); } } - - return new ResultData(wxCouponCVo); } } diff --git a/mallinkCApi/src/main/java/com/iformall/interceptor/HttpServletRequestWrapperFilter.java b/mallinkCApi/src/main/java/com/iformall/interceptor/HttpServletRequestWrapperFilter.java index 5b5d5b971..ec4e7cb7d 100644 --- a/mallinkCApi/src/main/java/com/iformall/interceptor/HttpServletRequestWrapperFilter.java +++ b/mallinkCApi/src/main/java/com/iformall/interceptor/HttpServletRequestWrapperFilter.java @@ -48,9 +48,9 @@ public class HttpServletRequestWrapperFilter implements Filter { //sql,xss过滤 XssHttpServletRequestWrapper xssHttpServletRequestWrapper = new XssHttpServletRequestWrapper((HttpServletRequest)request); - + String url = ""; if (request instanceof HttpServletRequest) { - String url = ((HttpServletRequest) request).getRequestURI(); + url = ((HttpServletRequest) request).getRequestURI(); if (!UrlCheck.checkUrl(url)) { requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request); } @@ -60,7 +60,7 @@ public class HttpServletRequestWrapperFilter implements Filter { } else { chain.doFilter(requestWrapper, response); } - logger.debug("doFilter end: " + (System.currentTimeMillis()- start) + "ms"); + logger.debug("doFilter end: " + url + " "+ (System.currentTimeMillis()- start) + "ms"); } @Override diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java b/mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java index 9fc0f2520..1b6e74503 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumBillAction.java @@ -13,7 +13,8 @@ public enum EnumBillAction { DEPOSIT_RETURN(5, "押金退款"), DEPOSIT_MODIFY(6, "押金变更"), IMPORT_PAY(6, "导入缴费"), - UPDATE_LATE_PAY_MONEY(7, "滞纳金变更"); + UPDATE_LATE_PAY_MONEY(7, "滞纳金变更"), + UPDATE_SETTLE_MONEY(8, "结算单清算"); public static EnumBillAction getEnum(Integer code) { for (EnumBillAction value : values()) { diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java index eae1b6590..332e4a631 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java @@ -23,6 +23,8 @@ public interface WxCouponChannelMapper extends CommonMapper { WxCouponCVo findVoDetail(@Param("id")Long id); + WxCouponCVo findVoStatusDetail(@Param("id")Long id); Integer reduceInventory(@Param("id")Long id,@Param("number")Integer number,@Param("remainInventory")Integer remainInventory); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java index 70d3b5043..02d6991ba 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java @@ -43,6 +43,8 @@ public interface WxCouponChannelService { WxCouponCVo findDetailVo(Long id); + WxCouponCVo findVoStatusDetail(Long id); + /** * 根据实体查询Vo分页列表 * diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index dffc887e8..308922c7a 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -56,6 +56,8 @@ public interface WxCouponService { WxCouponCVo getVoById(Long id); + + WxCouponCVo getVoStatusById(Long id); /** * 保存或更新实体 * diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 69f23e55b..a3c3dd23c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -1184,7 +1184,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { Date date = new Date(); daily.setCreatetime(date); daily.setUpdatetime(date); - daily.setOwe(receivePay - pay); + daily.setOwe(receivePay); daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); daily.setStarttime(bill.getStarttime()); daily.setEndtime(bill.getEndtime()); @@ -1249,7 +1249,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { Date date = new Date(); other.setCreatetime(date); other.setUpdatetime(date); - other.setOwe(receivePay - pay); + other.setOwe(receivePay); other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); other.setStarttime(bill.getStarttime()); other.setEndtime(bill.getEndtime()); @@ -1316,7 +1316,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { otherDeposit.setCreatetime(date); otherDeposit.setUpdatetime(date); otherDeposit.setExpiredDay(0L); - otherDeposit.setOwe(0L); + otherDeposit.setOwe(receivePay); otherDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); otherDeposit.setStarttime(bill.getStarttime()); otherDeposit.setEndtime(bill.getEndtime()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java index 1688d1ef9..ac271cc96 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java @@ -58,6 +58,9 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { private WxMerchantSubsidyMapper wxMerchantSubsidyMapper; @Autowired private ExcelService excelService; + @Autowired + private WxBillActionMapper wxBillActionMapper; + @Override public PageInfo listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { @@ -136,6 +139,21 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { return billSettle; } + public void addBillAction(Long billId,Long money){ + final IdWorker idWorker = IdWorker.get(); + WxBillAction billAction = new WxBillAction(); + billAction.setId(idWorker.nextId()); + billAction.setCreatetime(new Date()); + billAction.setUserName("系统端"); + billAction.setAction(EnumBillAction.UPDATE_SETTLE_MONEY.getCode()); + billAction.setBillId(billId); + BigDecimal newmoney = new BigDecimal(money).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP); + billAction.setDetails("通过结算单清算"+newmoney.toString()+"元"); + billAction.setUpdatetime(new Date()); + billAction.setPayDate(new Date()); + wxBillActionMapper.insertSelective(billAction); + } + @Override public void updateFreezeOrStatus(List billList,Integer freezeStatus,Integer status){ //1租金2押金3物业4日常费用6其他8补贴 @@ -148,6 +166,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillRent dbBill = wxBillRentMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + wxBillRent.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); }else if(EnumBillType.DEPOSIT.getCode().equals(bill.getBillType())) { WxBillDeposit wxBillRent = new WxBillDeposit(); @@ -157,6 +183,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillDeposit dbBill = wxBillDepositMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + wxBillRent.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillDepositMapper.updateByPrimaryKeySelective(wxBillRent); WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); @@ -166,6 +200,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillOtherDeposit.setStatus(status); wxBillOtherDeposit.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + wxBillOtherDeposit.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); @@ -175,6 +217,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + propertyDeposit.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillPropertyDepositMapper.updateByPrimaryKeySelective(propertyDeposit); }else if(EnumBillType.PROPERTY.getCode().equals(bill.getBillType())) { @@ -185,6 +235,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillProperty dbBill = wxBillPropertyMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + wxBillRent.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillRent); WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); @@ -194,6 +252,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + propertyDeposit.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillPropertyDepositMapper.updateByPrimaryKeySelective(propertyDeposit); }else if(EnumBillType.ROUTINE.getCode().equals(bill.getBillType())) { WxBillOther wxBillRent = new WxBillOther(); @@ -203,6 +269,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillOther dbBill = wxBillOtherMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + wxBillRent.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillOtherMapper.updateByPrimaryKeySelective(wxBillRent); }else if(EnumBillType.OTHER_DEPOSIT.getCode().equals(bill.getBillType())) { WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); @@ -212,6 +286,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + wxBillRent.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillRent); WxMerchantSubsidy wxMerchantSubsidy = new WxMerchantSubsidy(); @@ -229,6 +311,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + wxBillRent.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillRent); }else{ WxBillDaily wxBillRent = new WxBillDaily(); @@ -238,6 +328,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setStatus(status); wxBillRent.setPayDate(new Date()); } + if(EnumBillRentStatus.PAID.getCode().equals(status)){ + WxBillDaily dbBill = wxBillDailyMapper.selectByPrimaryKey(wxBillRent.getId()); + if(dbBill!=null) { + wxBillRent.setPay(dbBill.getOwe()); + wxBillRent.setPayDate(new Date()); + addBillAction(bill.getBillId(), dbBill.getOwe()); + } + } wxBillDailyMapper.updateByPrimaryKeySelective(wxBillRent); } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java index dae9416d4..5e28d899e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java @@ -118,9 +118,13 @@ public class WxBusinessServiceImpl implements WxBusinessService { businessSumMoney = businessSumMoney.add(new BigDecimal(billRentList.get(0).getReceivePay())); } - BigDecimal area = new BigDecimal(e.get("area").toString()); - BigDecimal areaRatio = businessSumMoney.divide(area,2, BigDecimal.ROUND_HALF_UP).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP); - e.put("rent",areaRatio.toBigInteger()); + if(e.get("area") == null || "0".equals(e.get("area").toString())){ + e.put("rent",0); + }else { + BigDecimal area = new BigDecimal(e.get("area").toString()); + BigDecimal areaRatio = businessSumMoney.divide(area, 2, BigDecimal.ROUND_HALF_UP).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); + e.put("rent", areaRatio.toBigInteger()); + } }); return resultList; } 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 8a963e959..6fd63f643 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -292,6 +292,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { return wxCouponChannelMapper.findVoDetail(id); } + @Override + public WxCouponCVo findVoStatusDetail(Long id) { + return wxCouponChannelMapper.findVoStatusDetail(id); + } + @Override public List listVo(WxCouponChannel record) { return wxCouponChannelMapper.findVoList(record); 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 7ce5b17f4..a26b7c95e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -170,6 +170,12 @@ import java.util.stream.Collectors; return wxCouponCVo; } + @Override + public WxCouponCVo getVoStatusById(Long id) { + WxCouponCVo wxCouponCVo = wxCouponMapper.findVoStatusDetail(id); + return wxCouponCVo; + } + private Long parseMerchantId(JSONObject merchantParam){ return Long.valueOf(merchantParam.getString("id")); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index e0136d4c8..27284bbdc 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -199,10 +199,13 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { public WxCreditHistory saveOrUpdate(WxCreditHistory record) { WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId()); WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId()); - if (wxCUser == null && wxCUserBasicInfo == null) { + if (wxCUser == null) { //验证此用户是否存在 throw new MallinkException(ErrorCode.USER_IS_EMPTY); } + if(wxCUserBasicInfo == null) { + throw new MallinkException(ErrorCode.USER_NOT_AUTH_PHONE); + } if (StringUtils.isNotEmpty(record.getSpendStr())) { record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue()); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index 40a873e62..5accf75ef 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -221,6 +221,14 @@ public class WxFlowServiceImpl implements WxFlowService { wxBillAll.setNewPrice(newPrice); } wxBillAllService.updateReceivePay(wxBillAll, user); + + //账单修改金额,解冻 + List billList = new ArrayList<>(); + WxBillSettleBill settleBill = new WxBillSettleBill(); + settleBill.setBillType(billType); + settleBill.setBillId(businessId); + billList.add(settleBill); + wxBillSettleService.updateFreezeOrStatus(billList,EnumFreezeType.DEF.getCode(),null); }else if(EnumRentContractAppStatus.APPLYING.getCode().intValue() == applyStatus.intValue()) { //账单修改金额,冻结 List billList = new ArrayList<>(); diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index f81b49ec3..e39f08bc7 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -47,9 +47,7 @@ select bill.id,bill.tenant_id tenantId,bill.merchant_id merchantId,bill.shop_id shopId, bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, - bill.receive_pay receivePay,bill.pay, - case when bill.status=1 then bill.owe else 0 end owe - ,bill.receive_date receiveDate, + bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate, bill.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime, bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName, s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index 7959979ff..282ec1180 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -218,6 +218,10 @@ cc.qr_code + + cc.id,cc.coupon_id,c.remain_inventory,c.status + + @@ -273,6 +277,13 @@ where cc.id = #{id} + + + update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory= #{remainInventory}