| @@ -0,0 +1,2 @@ | |||||
| ALTER TABLE `wx_coupon_channel` | |||||
| ADD INDEX `coupon_index` (`coupon_id`) comment ''; | |||||
| @@ -20,10 +20,12 @@ import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Objects; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/credit") | @RequestMapping("/api/credit") | ||||
| @@ -44,9 +46,9 @@ public class WxCreditHistoryController extends BaseController { | |||||
| @GetMapping("/findByMerchantIdAndSpend") | @GetMapping("/findByMerchantIdAndSpend") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name="merchantId",value="商户ID",dataType="long", paramType = "query",required=true), | @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)}) | @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"); | log.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend"); | ||||
| WxMerchant wxMerchant = new WxMerchant(); | WxMerchant wxMerchant = new WxMerchant(); | ||||
| wxMerchant.setStatus(EnumYesOrNo.YES.getCode()); | 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()) { | if (wxMerchant.getIsAdmin() != EnumYesOrNo.YES.getCode() && merchantId.longValue() != getUser().getMerchantId().longValue()) { | ||||
| return new ResultData(ErrorCode.USER_NO_PERMISSION); | 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())); | return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId,spendStr,userId,getTenantId())); | ||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.iformall.domain.po.PushLimit; | |||||
| import com.iformall.domain.po.WxCUser; | import com.iformall.domain.po.WxCUser; | ||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| import com.iformall.domain.po.WxScoreRules; | import com.iformall.domain.po.WxScoreRules; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.cache.CacheManager; | import org.springframework.cache.CacheManager; | ||||
| @@ -122,4 +123,21 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| return template; | return template; | ||||
| } | } | ||||
| @Bean("couponDetailRedisTemplate") | |||||
| public RedisTemplate<String, WxCouponCVo> getCouponDetailRedisTemplate(RedisConnectionFactory connectionFactory) { | |||||
| RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); | |||||
| Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); | |||||
| // value值的序列化 | |||||
| template.setValueSerializer(j); | |||||
| template.setHashKeySerializer(j); | |||||
| // key的序列化 | |||||
| template.setKeySerializer(new StringRedisSerializer()); | |||||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||||
| template.setConnectionFactory(connectionFactory); | |||||
| return template; | |||||
| } | |||||
| } | } | ||||
| @@ -17,9 +17,13 @@ import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | 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 org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.concurrent.TimeUnit; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/wxCoupon") | @RequestMapping("/api/wxCoupon") | ||||
| @@ -29,31 +33,80 @@ public class WxCouponController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponChannelService wxCouponChannelService; | private WxCouponChannelService wxCouponChannelService; | ||||
| @Autowired | |||||
| private WxCouponService couponService; | |||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | |||||
| @Qualifier("couponDetailRedisTemplate") | |||||
| RedisTemplate<String, WxCouponCVo> cdRedisTemplate; | |||||
| @ApiOperation("根据id(couponChannel)查询接口") | @ApiOperation("根据id(couponChannel)查询接口") | ||||
| @GetMapping("/detail") | @GetMapping("/detail") | ||||
| @ApiImplicitParams({ | @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)) { | 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 { | try { | ||||
| couponChannelIdL = Long.valueOf(couponChannelId); | couponChannelIdL = Long.valueOf(couponChannelId); | ||||
| if (StringUtils.isNotBlank(couponId) && !couponId.equalsIgnoreCase(Constant.UNDEFINED)) { | |||||
| couponIdL = Long.valueOf(couponId); | |||||
| } | |||||
| } catch (NumberFormatException e) { | } catch (NumberFormatException e) { | ||||
| logger.error("id转换失败" + couponChannelId); | logger.error("id转换失败" + couponChannelId); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponChannelId); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponChannelId); | ||||
| } | } | ||||
| String key = "cc:" + couponChannelId; | |||||
| ValueOperations<String, WxCouponCVo> 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); | WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(couponChannelIdL); | ||||
| if (wxCouponCVo == null) | |||||
| if (wxCouponCVo == null) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | 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())) { | wxCouponCVo.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) { | ||||
| Date now = new Date(); | Date now = new Date(); | ||||
| @@ -65,8 +118,6 @@ public class WxCouponController extends BaseController { | |||||
| wxCouponCVo.setActivityStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); | wxCouponCVo.setActivityStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); | ||||
| } | } | ||||
| } | } | ||||
| return new ResultData(wxCouponCVo); | |||||
| } | } | ||||
| } | } | ||||
| @@ -48,9 +48,9 @@ public class HttpServletRequestWrapperFilter implements Filter { | |||||
| //sql,xss过滤 | //sql,xss过滤 | ||||
| XssHttpServletRequestWrapper xssHttpServletRequestWrapper = new XssHttpServletRequestWrapper((HttpServletRequest)request); | XssHttpServletRequestWrapper xssHttpServletRequestWrapper = new XssHttpServletRequestWrapper((HttpServletRequest)request); | ||||
| String url = ""; | |||||
| if (request instanceof HttpServletRequest) { | if (request instanceof HttpServletRequest) { | ||||
| String url = ((HttpServletRequest) request).getRequestURI(); | |||||
| url = ((HttpServletRequest) request).getRequestURI(); | |||||
| if (!UrlCheck.checkUrl(url)) { | if (!UrlCheck.checkUrl(url)) { | ||||
| requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request); | requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request); | ||||
| } | } | ||||
| @@ -60,7 +60,7 @@ public class HttpServletRequestWrapperFilter implements Filter { | |||||
| } else { | } else { | ||||
| chain.doFilter(requestWrapper, response); | chain.doFilter(requestWrapper, response); | ||||
| } | } | ||||
| logger.debug("doFilter end: " + (System.currentTimeMillis()- start) + "ms"); | |||||
| logger.debug("doFilter end: " + url + " "+ (System.currentTimeMillis()- start) + "ms"); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -13,7 +13,8 @@ public enum EnumBillAction { | |||||
| DEPOSIT_RETURN(5, "押金退款"), | DEPOSIT_RETURN(5, "押金退款"), | ||||
| DEPOSIT_MODIFY(6, "押金变更"), | DEPOSIT_MODIFY(6, "押金变更"), | ||||
| IMPORT_PAY(6, "导入缴费"), | IMPORT_PAY(6, "导入缴费"), | ||||
| UPDATE_LATE_PAY_MONEY(7, "滞纳金变更"); | |||||
| UPDATE_LATE_PAY_MONEY(7, "滞纳金变更"), | |||||
| UPDATE_SETTLE_MONEY(8, "结算单清算"); | |||||
| public static EnumBillAction getEnum(Integer code) { | public static EnumBillAction getEnum(Integer code) { | ||||
| for (EnumBillAction value : values()) { | for (EnumBillAction value : values()) { | ||||
| @@ -23,6 +23,8 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||||
| WxCouponCVo findVoDetail(@Param("id")Long id); | WxCouponCVo findVoDetail(@Param("id")Long id); | ||||
| WxCouponCVo findVoStatusDetail(@Param("id")Long id); | |||||
| void updateStatusByCouponId(WxCouponChannel wxCouponChannel); | void updateStatusByCouponId(WxCouponChannel wxCouponChannel); | ||||
| int updateEndTimeByCouponId(WxCouponChannel wxCouponChannel); | int updateEndTimeByCouponId(WxCouponChannel wxCouponChannel); | ||||
| @@ -18,6 +18,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| WxCouponCVo findVoDetail(@Param("id")Long id); | 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); | Integer reduceInventory(@Param("id")Long id,@Param("number")Integer number,@Param("remainInventory")Integer remainInventory); | ||||
| @@ -43,6 +43,8 @@ public interface WxCouponChannelService { | |||||
| WxCouponCVo findDetailVo(Long id); | WxCouponCVo findDetailVo(Long id); | ||||
| WxCouponCVo findVoStatusDetail(Long id); | |||||
| /** | /** | ||||
| * 根据实体查询Vo分页列表 | * 根据实体查询Vo分页列表 | ||||
| * | * | ||||
| @@ -56,6 +56,8 @@ public interface WxCouponService { | |||||
| WxCouponCVo getVoById(Long id); | WxCouponCVo getVoById(Long id); | ||||
| WxCouponCVo getVoStatusById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| @@ -1184,7 +1184,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| Date date = new Date(); | Date date = new Date(); | ||||
| daily.setCreatetime(date); | daily.setCreatetime(date); | ||||
| daily.setUpdatetime(date); | daily.setUpdatetime(date); | ||||
| daily.setOwe(receivePay - pay); | |||||
| daily.setOwe(receivePay); | |||||
| daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | ||||
| daily.setStarttime(bill.getStarttime()); | daily.setStarttime(bill.getStarttime()); | ||||
| daily.setEndtime(bill.getEndtime()); | daily.setEndtime(bill.getEndtime()); | ||||
| @@ -1249,7 +1249,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| Date date = new Date(); | Date date = new Date(); | ||||
| other.setCreatetime(date); | other.setCreatetime(date); | ||||
| other.setUpdatetime(date); | other.setUpdatetime(date); | ||||
| other.setOwe(receivePay - pay); | |||||
| other.setOwe(receivePay); | |||||
| other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | ||||
| other.setStarttime(bill.getStarttime()); | other.setStarttime(bill.getStarttime()); | ||||
| other.setEndtime(bill.getEndtime()); | other.setEndtime(bill.getEndtime()); | ||||
| @@ -1316,7 +1316,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| otherDeposit.setCreatetime(date); | otherDeposit.setCreatetime(date); | ||||
| otherDeposit.setUpdatetime(date); | otherDeposit.setUpdatetime(date); | ||||
| otherDeposit.setExpiredDay(0L); | otherDeposit.setExpiredDay(0L); | ||||
| otherDeposit.setOwe(0L); | |||||
| otherDeposit.setOwe(receivePay); | |||||
| otherDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | otherDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | ||||
| otherDeposit.setStarttime(bill.getStarttime()); | otherDeposit.setStarttime(bill.getStarttime()); | ||||
| otherDeposit.setEndtime(bill.getEndtime()); | otherDeposit.setEndtime(bill.getEndtime()); | ||||
| @@ -58,6 +58,9 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| private WxMerchantSubsidyMapper wxMerchantSubsidyMapper; | private WxMerchantSubsidyMapper wxMerchantSubsidyMapper; | ||||
| @Autowired | @Autowired | ||||
| private ExcelService excelService; | private ExcelService excelService; | ||||
| @Autowired | |||||
| private WxBillActionMapper wxBillActionMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -136,6 +139,21 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| return billSettle; | 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 | @Override | ||||
| public void updateFreezeOrStatus(List<WxBillSettleBill> billList,Integer freezeStatus,Integer status){ | public void updateFreezeOrStatus(List<WxBillSettleBill> billList,Integer freezeStatus,Integer status){ | ||||
| //1租金2押金3物业4日常费用6其他8补贴 | //1租金2押金3物业4日常费用6其他8补贴 | ||||
| @@ -148,6 +166,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | ||||
| }else if(EnumBillType.DEPOSIT.getCode().equals(bill.getBillType())) { | }else if(EnumBillType.DEPOSIT.getCode().equals(bill.getBillType())) { | ||||
| WxBillDeposit wxBillRent = new WxBillDeposit(); | WxBillDeposit wxBillRent = new WxBillDeposit(); | ||||
| @@ -157,6 +183,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillDepositMapper.updateByPrimaryKeySelective(wxBillRent); | ||||
| WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); | WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); | ||||
| @@ -166,6 +200,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillOtherDeposit.setStatus(status); | wxBillOtherDeposit.setStatus(status); | ||||
| wxBillOtherDeposit.setPayDate(new Date()); | 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); | wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); | ||||
| WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); | WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); | ||||
| @@ -175,6 +217,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillPropertyDepositMapper.updateByPrimaryKeySelective(propertyDeposit); | ||||
| }else if(EnumBillType.PROPERTY.getCode().equals(bill.getBillType())) { | }else if(EnumBillType.PROPERTY.getCode().equals(bill.getBillType())) { | ||||
| @@ -185,6 +235,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillRent); | ||||
| WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); | WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); | ||||
| @@ -194,6 +252,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillPropertyDepositMapper.updateByPrimaryKeySelective(propertyDeposit); | ||||
| }else if(EnumBillType.ROUTINE.getCode().equals(bill.getBillType())) { | }else if(EnumBillType.ROUTINE.getCode().equals(bill.getBillType())) { | ||||
| WxBillOther wxBillRent = new WxBillOther(); | WxBillOther wxBillRent = new WxBillOther(); | ||||
| @@ -203,6 +269,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillOtherMapper.updateByPrimaryKeySelective(wxBillRent); | ||||
| }else if(EnumBillType.OTHER_DEPOSIT.getCode().equals(bill.getBillType())) { | }else if(EnumBillType.OTHER_DEPOSIT.getCode().equals(bill.getBillType())) { | ||||
| WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); | WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); | ||||
| @@ -212,6 +286,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillRent); | ||||
| WxMerchantSubsidy wxMerchantSubsidy = new WxMerchantSubsidy(); | WxMerchantSubsidy wxMerchantSubsidy = new WxMerchantSubsidy(); | ||||
| @@ -229,6 +311,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillRent); | ||||
| }else{ | }else{ | ||||
| WxBillDaily wxBillRent = new WxBillDaily(); | WxBillDaily wxBillRent = new WxBillDaily(); | ||||
| @@ -238,6 +328,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| wxBillRent.setStatus(status); | wxBillRent.setStatus(status); | ||||
| wxBillRent.setPayDate(new Date()); | 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); | wxBillDailyMapper.updateByPrimaryKeySelective(wxBillRent); | ||||
| } | } | ||||
| } | } | ||||
| @@ -118,9 +118,13 @@ public class WxBusinessServiceImpl implements WxBusinessService { | |||||
| businessSumMoney = businessSumMoney.add(new BigDecimal(billRentList.get(0).getReceivePay())); | 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; | return resultList; | ||||
| } | } | ||||
| @@ -292,6 +292,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| return wxCouponChannelMapper.findVoDetail(id); | return wxCouponChannelMapper.findVoDetail(id); | ||||
| } | } | ||||
| @Override | |||||
| public WxCouponCVo findVoStatusDetail(Long id) { | |||||
| return wxCouponChannelMapper.findVoStatusDetail(id); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<WxCouponChannelVo> listVo(WxCouponChannel record) { | public List<WxCouponChannelVo> listVo(WxCouponChannel record) { | ||||
| return wxCouponChannelMapper.findVoList(record); | return wxCouponChannelMapper.findVoList(record); | ||||
| @@ -170,6 +170,12 @@ import java.util.stream.Collectors; | |||||
| return wxCouponCVo; | return wxCouponCVo; | ||||
| } | } | ||||
| @Override | |||||
| public WxCouponCVo getVoStatusById(Long id) { | |||||
| WxCouponCVo wxCouponCVo = wxCouponMapper.findVoStatusDetail(id); | |||||
| return wxCouponCVo; | |||||
| } | |||||
| private Long parseMerchantId(JSONObject merchantParam){ | private Long parseMerchantId(JSONObject merchantParam){ | ||||
| return Long.valueOf(merchantParam.getString("id")); | return Long.valueOf(merchantParam.getString("id")); | ||||
| @@ -199,10 +199,13 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| public WxCreditHistory saveOrUpdate(WxCreditHistory record) { | public WxCreditHistory saveOrUpdate(WxCreditHistory record) { | ||||
| WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId()); | WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId()); | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId()); | WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId()); | ||||
| if (wxCUser == null && wxCUserBasicInfo == null) { | |||||
| if (wxCUser == null) { | |||||
| //验证此用户是否存在 | //验证此用户是否存在 | ||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | throw new MallinkException(ErrorCode.USER_IS_EMPTY); | ||||
| } | } | ||||
| if(wxCUserBasicInfo == null) { | |||||
| throw new MallinkException(ErrorCode.USER_NOT_AUTH_PHONE); | |||||
| } | |||||
| if (StringUtils.isNotEmpty(record.getSpendStr())) { | if (StringUtils.isNotEmpty(record.getSpendStr())) { | ||||
| record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue()); | record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue()); | ||||
| } | } | ||||
| @@ -221,6 +221,14 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| wxBillAll.setNewPrice(newPrice); | wxBillAll.setNewPrice(newPrice); | ||||
| } | } | ||||
| wxBillAllService.updateReceivePay(wxBillAll, user); | wxBillAllService.updateReceivePay(wxBillAll, user); | ||||
| //账单修改金额,解冻 | |||||
| List<WxBillSettleBill> 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()) { | }else if(EnumRentContractAppStatus.APPLYING.getCode().intValue() == applyStatus.intValue()) { | ||||
| //账单修改金额,冻结 | //账单修改金额,冻结 | ||||
| List<WxBillSettleBill> billList = new ArrayList<>(); | List<WxBillSettleBill> billList = new ArrayList<>(); | ||||
| @@ -47,9 +47,7 @@ | |||||
| select | select | ||||
| bill.id,bill.tenant_id tenantId,bill.merchant_id merchantId,bill.shop_id shopId, | 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.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.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime, | ||||
| bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName, | 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 | s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info | ||||
| @@ -218,6 +218,10 @@ | |||||
| cc.qr_code | cc.qr_code | ||||
| </sql> | </sql> | ||||
| <sql id="CVoStatusColumn"> | |||||
| cc.id,cc.coupon_id,c.remain_inventory,c.status | |||||
| </sql> | |||||
| <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo"> | <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo"> | ||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | ||||
| @@ -273,6 +277,13 @@ | |||||
| where cc.id = #{id} | where cc.id = #{id} | ||||
| </select> | </select> | ||||
| <select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | |||||
| select | |||||
| <include refid="CVoStatusColumn"/> | |||||
| from wx_coupon c, wx_coupon_channel cc | |||||
| where cc.coupon_id = c.id and cc.id = #{id} | |||||
| </select> | |||||
| <select id="countCoupon" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer"> | <select id="countCoupon" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer"> | ||||
| select count(distinct coupon_id) from wx_coupon_channel cc | select count(distinct coupon_id) from wx_coupon_channel cc | ||||
| @@ -98,6 +98,10 @@ | |||||
| `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`put_apply_status`,`stock_apply_status`,`cancle_apply_status`,`conditions`,approval_type | `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`put_apply_status`,`stock_apply_status`,`cancle_apply_status`,`conditions`,approval_type | ||||
| </sql> | </sql> | ||||
| <sql id="statusColumns"> | |||||
| `id`,`remain_inventory`,`status` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | where 1 = 1 | ||||
| @@ -510,6 +514,12 @@ | |||||
| where id = #{id} | where id = #{id} | ||||
| </select> | </select> | ||||
| <select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_coupon | |||||
| where id = #{id} | |||||
| </select> | |||||
| <update id="reduceInventory"> | <update id="reduceInventory"> | ||||
| update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory= #{remainInventory} | update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory= #{remainInventory} | ||||