| @@ -27,7 +27,20 @@ public class WxChartDataController extends BaseController { | |||
| @Autowired | |||
| private WxChartDataService wxChartDataService; | |||
| @ApiOperation("chart=49商铺出租数据:" + | |||
| @ApiOperation( | |||
| "chart=45 卡营销数据:" + | |||
| "saleHistory销售金额历史 paymentHistory核销历史 saleCardCount售出卡数量 tranCount转增数量 subsidyCount补贴金额"+ | |||
| "--------------------------------------" + | |||
| "chart=46 卷营销数据:" + | |||
| "orderCountList卷购买数量历史 paymentCountList卷核销数量 priceCouponSaleCountList有价卷销售数量历史 " + | |||
| "priceCouponPaymentCountList有价卷核销数量历史 sumPriceSaleMoney有价券销售总额 sumPricePayMent有价卷核销总额 " + | |||
| "sumSubsidyMoney商场补贴金额 priceCouponCancelCount有价卷退款数量 priceCouponSaleCountListTotal有价券售出数量"+ | |||
| "--------------------------------------" + | |||
| "chart=47 砍价营销数据:" + | |||
| "pressSendHistory砍价发起历史 pressSuccHistory砍价成功历史 pressPaymentHistory砍价核销历史 " + | |||
| "pressSendHistoryTotal发起总数 pressSuccHistoryCount成功总数 pressPaymentHistoryCount核销总数 pressSuccRate成功率 sumJoin参与人数"+ | |||
| "--------------------------------------"+ | |||
| "chart=49商铺出租数据:" + | |||
| "total商铺总数 totalShop店铺个数 totalPoint多径点位个数, rentTotal已出租总数 rentTotalShop已出租店铺 rentTotalPoint已出租点位" + | |||
| ",notRentTotal未出租总数 notRentTotalShop未出租店铺 notRentTotalPoint未出租点位" + | |||
| ","+ | |||
| @@ -36,15 +49,16 @@ public class WxChartDataController extends BaseController { | |||
| "ysje 应收金额 ssje 实收金额 zjsjl收缴率 rent*租赁收缴率 property*物业收缴率 deposit*押金收缴率 other*其他费用收缴率" + | |||
| "rentOwe 租赁总额 propertyOwe物业总额 otherOwe其他总额 depositOwe押金总额 totalOwe欠缴总额"+ | |||
| "--------------------------------------"+ | |||
| "chart=51首页场景发卷:" + | |||
| "carStopHistory停车发卷 couponVerifyHistory核销发卷 orderHistory交易发卷 micropayHistory收银台发卷"+ | |||
| "--------------------------------------"+ | |||
| "chart=52营销数据:" + | |||
| "当前”券交易数据“替换为”营销数据“:cardHistory卡营销历史 pressSendHistory砍价营销历史 groupHistory拼团营销历史 couponHistory卷营销历史," + | |||
| "卡、卷、砍价、拼团走势以及右边的数据总览,对应原来 营销系统->卡、卷、砍价、拼团营销数据" + | |||
| "--------------------------------------"+ | |||
| "chart=51首页场景发卷:" + | |||
| "carStopHistory停车发卷 couponVerifyHistory核销发卷 orderHistory交易发卷 micropayHistory收银台发卷"+ | |||
| "--------------------------------------" + | |||
| "触达用户=数据总览的活跃用户数据" | |||
| "触达用户=数据总览的活跃用户数据" + "------------------------------" + | |||
| "chart=48拼团营销数据:拼团成功次数successList verifyList核销量 拼团发起次数groupCount 拼团成功successCount 参与拼团人次peopleCount" + | |||
| "拼团成功人次successPeopleCount 拼团转化率transferRatio 核销数verifyCount" | |||
| ) | |||
| @GetMapping("/queryData") | |||
| @ApiImplicitParams({ | |||
| @@ -207,4 +207,12 @@ public class WxRentContractController extends BaseController { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getMerchants(wxRentContract)); | |||
| } | |||
| @GetMapping("/hasRentStatus") | |||
| @SystemControllerLog(description = "查询店铺租赁状态") | |||
| public ResultData hasRentStatus(@ModelAttribute WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::hasRentStatus"); | |||
| wxRentContract.setTenantId(getTenantId()); | |||
| return wxRentContractService.hasRentStatus(wxRentContract); | |||
| } | |||
| } | |||
| @@ -353,9 +353,15 @@ public class WxUserGrantController extends BaseController { | |||
| WxCUser user = getUser(); | |||
| if (user != null) { | |||
| logger.debug(user.toString()); | |||
| boolean bFirstNickName = false; | |||
| if(StringUtils.isBlank(user.getNickName())) { | |||
| bFirstNickName = true; | |||
| } | |||
| WxMaService wxMaService = getWeappService(user.getAppId()); | |||
| logger.debug(user.toString()); | |||
| String session_key = user.getSessionKey(); | |||
| try { | |||
| // 解密用户信息 | |||
| @@ -371,10 +377,13 @@ public class WxUserGrantController extends BaseController { | |||
| user.setLanguage(userInfo.getLanguage()); | |||
| wxCUserService.saveOrUpdate(user); | |||
| // 成长值 | |||
| wxScoreRulesService.addScore(EnumScoreType.WECHAT_PERSION, user); | |||
| //增加积分 | |||
| addCredit(user, EnumScoreType.WECHAT_PERSION); | |||
| if(bFirstNickName) { | |||
| // 首次获取昵称 | |||
| // 成长值 | |||
| wxScoreRulesService.addScore(EnumScoreType.WECHAT_PERSION, user); | |||
| //增加积分 | |||
| addCredit(user, EnumScoreType.WECHAT_PERSION); | |||
| } | |||
| resultMap.put("openId", user.getOpenId()); | |||
| resultMap.put("unionId", user.getUnionId()); | |||
| @@ -388,7 +397,7 @@ public class WxUserGrantController extends BaseController { | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解密并保存出错", resultMap); | |||
| } | |||
| } else { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| return new ResultData(ErrorCode.USER_LOGIN_FAILED); | |||
| } | |||
| } | |||
| @@ -416,6 +425,15 @@ public class WxUserGrantController extends BaseController { | |||
| WxCUser user = getUser(); | |||
| if (user == null) { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| boolean isFirstPhone = false; | |||
| if(StringUtils.isBlank(user.getPhone())) { | |||
| isFirstPhone = true; | |||
| } | |||
| WxMaService wxMaService = getWeappService(user.getAppId()); | |||
| String session_key = user.getSessionKey(); | |||
| @@ -429,10 +447,13 @@ public class WxUserGrantController extends BaseController { | |||
| user.setCountryCode(phoneNoInfo.getCountryCode()); | |||
| wxCUserService.saveOrUpdate(user); | |||
| // 成长值 | |||
| user.setScore(user.getScore() + wxScoreRulesService.addScore(EnumScoreType.WECHAT_PHONE, user)); | |||
| //增加积分 | |||
| addCredit(user, EnumScoreType.WECHAT_PHONE); | |||
| if(isFirstPhone) { | |||
| // 首次授权, 增加成长值及积分 | |||
| // 成长值 | |||
| user.setScore(wxScoreRulesService.addScore(EnumScoreType.WECHAT_PHONE, user)); | |||
| //增加积分 | |||
| addCredit(user, EnumScoreType.WECHAT_PHONE); | |||
| } | |||
| resultMap.put("msg", "授权手机成功!"); | |||
| resultMap.put("phone", phoneNoInfo.getPhoneNumber()); | |||
| @@ -190,6 +190,7 @@ public enum ErrorCode{ | |||
| WE_RUN_DATA_DECODE_ERR(11008, "运动信息解密失败"), | |||
| MP_TEMPLATE_SEND_FAILED(11009, "公众号模板消息发送失败"), | |||
| UNIFORM_SEND_FAILED(11010, "小程序统一消息发送失败"), | |||
| USER_LOGIN_FAILED(11011, "微信用户未登录或登录有问题"), | |||
| /** | |||
| @@ -198,7 +198,7 @@ public class WxRentContract implements Serializable { | |||
| private Integer payRatio; | |||
| @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") | |||
| private Integer revenue; | |||
| private Long revenue; | |||
| @io.swagger.annotations.ApiModelProperty(value = "起租开始时间", name = "rentalStartDate") | |||
| private Date startDate; | |||
| @@ -550,11 +550,11 @@ public class WxRentContract implements Serializable { | |||
| this.payRatio = payRatio; | |||
| } | |||
| public Integer getRevenue() { | |||
| public Long getRevenue() { | |||
| return revenue; | |||
| } | |||
| public void setRevenue(Integer revenue) { | |||
| public void setRevenue(Long revenue) { | |||
| this.revenue = revenue; | |||
| } | |||
| @@ -6,25 +6,25 @@ public class WxNotRentShopVo { | |||
| @Excel(name="商铺类型",width = 20,orderNum = "1", | |||
| replace = {"商铺_null", "固定点位_1", "临时促销点位_2", "宣传点位_3","ATM点位_4","仓库点位_5","其他点位_6"}) | |||
| private Integer pointType; | |||
| private String pointType; | |||
| @Excel(name="商铺号",width = 20,orderNum = "2") | |||
| private String shopNumber; | |||
| @Excel(name="楼座",width = 20,orderNum = "3") | |||
| private Long building; | |||
| private String building; | |||
| @Excel(name="楼层",width = 20,orderNum = "4") | |||
| private Long floor; | |||
| private String floor; | |||
| @Excel(name="建筑面积(㎡)",width = 20,orderNum = "5") | |||
| private String buildArea; | |||
| @Excel(name="计租面积(㎡)",width = 20,orderNum = "6") | |||
| private String operationArea; | |||
| @Excel(name="闲置时间(天)",width = 20,orderNum = "7") | |||
| private Integer freeDay; | |||
| private Long freeDay; | |||
| public Integer getPointType() { | |||
| public String getPointType() { | |||
| return pointType; | |||
| } | |||
| public void setPointType(Integer pointType) { | |||
| public void setPointType(String pointType) { | |||
| this.pointType = pointType; | |||
| } | |||
| @@ -36,19 +36,19 @@ public class WxNotRentShopVo { | |||
| this.shopNumber = shopNumber; | |||
| } | |||
| public Long getBuilding() { | |||
| public String getBuilding() { | |||
| return building; | |||
| } | |||
| public void setBuilding(Long building) { | |||
| public void setBuilding(String building) { | |||
| this.building = building; | |||
| } | |||
| public Long getFloor() { | |||
| public String getFloor() { | |||
| return floor; | |||
| } | |||
| public void setFloor(Long floor) { | |||
| public void setFloor(String floor) { | |||
| this.floor = floor; | |||
| } | |||
| @@ -68,11 +68,11 @@ public class WxNotRentShopVo { | |||
| this.operationArea = operationArea; | |||
| } | |||
| public Integer getFreeDay() { | |||
| public Long getFreeDay() { | |||
| return freeDay; | |||
| } | |||
| public void setFreeDay(Integer freeDay) { | |||
| public void setFreeDay(Long freeDay) { | |||
| this.freeDay = freeDay; | |||
| } | |||
| } | |||
| @@ -55,7 +55,6 @@ public enum EnumChart { | |||
| SALE_PRESS(47, "砍价营销数据"), | |||
| SALE_GROUP(48, "拼团营销数据"), | |||
| INDEX_SHOP_RENT(49, "商铺出租数据"), | |||
| INDEX_BILL_RECE_RATE(50, "费用收缴数据"), | |||
| INDEX_COUPON_SCENE(51, "场景发券"), | |||
| @@ -145,6 +145,11 @@ public interface WxCouponService { | |||
| */ | |||
| Long priceCouponCancelCount(WxCoupon wxCoupon); | |||
| /** | |||
| * 有价券销售总额 | |||
| * @param wxCoupon | |||
| * @return | |||
| */ | |||
| String findSumPriceSaleMoney(WxCoupon wxCoupon); | |||
| String findSumPricePayMent(WxCoupon wxCoupon); | |||
| String findSumSubsidyMoney(WxCoupon wxCoupon); | |||
| @@ -78,4 +78,6 @@ public interface WxRentContractService { | |||
| Object getMerchants(WxRentContract wxRentContract); | |||
| void updateInvalidContract(Long rentContractId); | |||
| ResultData hasRentStatus(WxRentContract wxRentContract); | |||
| } | |||
| @@ -1914,7 +1914,14 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| result.put("sumPriceSaleMoney",wxCouponService.findSumPriceSaleMoney(wxCoupon)); | |||
| result.put("sumPricePayMent",wxCouponService.findSumPricePayMent(wxCoupon)); | |||
| result.put("sumSubsidyMoney",wxCouponService.findSumSubsidyMoney(wxCoupon)); | |||
| result.put("priceCouponCancelCount",priceCouponCancelCount); | |||
| result.put("priceCouponCancelCount",priceCouponCancelCount);//有价卷退款数量 | |||
| //有价券售出数量 | |||
| int total = 0; | |||
| for (WxCouponStatisVo couponStatisVo:priceCouponSaleCountList) { | |||
| total += Integer.parseInt(couponStatisVo.getXcount()); | |||
| } | |||
| result.put("priceCouponSaleCountListTotal",total); | |||
| return new ResultData(result); | |||
| } | |||
| @@ -112,7 +112,7 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||
| @Override | |||
| public void receivemodel(String tenantId, Map<String, String> param) { | |||
| if(checksign(tenantId,param)){ | |||
| if (checksign(tenantId, param)) { | |||
| logger.info("短信营销模板回调SIGN校验成功"); | |||
| WxMsgModel wxMsgModel = new WxMsgModel(); | |||
| wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); | |||
| @@ -120,7 +120,7 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||
| wxMsgModel = wxMsgModelMapper.findList(wxMsgModel).get(0); | |||
| wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); | |||
| wxMsgModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| }else{ | |||
| } else { | |||
| logger.info("短信营销模板回调SIGN校验失败"); | |||
| } | |||
| @@ -74,6 +74,7 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| content, wxMsgConfig.getModelnotifyurl(),EnumVerifyCode.NO.getCode().toString()); | |||
| JSONObject jsonObjectResult = JSONObject.parseObject(result); | |||
| String ret = jsonObjectResult.get("ret").toString(); | |||
| logger.info("短信模板创建结果:" + result); | |||
| if (ret.equals(EnumMsgModelStatus.SUCCESS.getCode().toString())) { | |||
| if (wxMsgModel.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -432,7 +432,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| if (user.getCredit() == null || user.getCredit() < coupon.getSalePrice()) { | |||
| throw new MallinkException(ErrorCode.CREDIT_NOT_ENOUGH); | |||
| } | |||
| //扣减积分操作记录 | |||
| //-------此处为【积分支付】记录增加积分操作------- | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| //记录操作人类型 操作人id | |||
| if (user.getOperatorType() == EnumUserType.MALLUSER.getCode()) { | |||
| @@ -448,6 +448,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| creditHistory.setTenantId(user.getTenantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | |||
| creditHistory.setCouponId(couponId); | |||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | |||
| setMerchantId(coupon, creditHistory); | |||
| wxCreditHistoryService.saveOrUpdate(creditHistory); | |||
| record.setType(EnumOrderType.CREDIT.getCode()); | |||
| //积分支付时 变更订单状态为已支付 | |||
| @@ -957,7 +959,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| // 积分 计算 | |||
| try { | |||
| //扣减积分操作记录 | |||
| //-------此处为【现金支付】记录增加积分操作------- | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | |||
| creditHistory.setOperatorId(user.getId()); | |||
| @@ -969,18 +971,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| creditHistory.setBusinessId(Long.valueOf(coupon.getBusiness())); | |||
| creditHistory.setSpend(updateOrder.getPayment()); | |||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | |||
| WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | |||
| wxCouponMerchant.setProductId(coupon.getId()); | |||
| wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | |||
| List<WxCouponMerchant> list = wxCouponMerchantMapper.findList(wxCouponMerchant); | |||
| if (list != null && list.size() > 0) { | |||
| if (list.size() == 1) { | |||
| creditHistory.setMerchantId(list.get(0).getMerchantId()); | |||
| } | |||
| if (list.size() > 1) { | |||
| creditHistory.setMerchantId(Long.valueOf(EnumMerchantType.MERCHANT_MORE.getCode())); | |||
| } | |||
| } | |||
| setMerchantId(coupon, creditHistory); | |||
| wxCreditHistoryService.saveOrUpdate(creditHistory); | |||
| } catch (Exception e) { | |||
| logger.error("积分值:" + e.getMessage()); | |||
| @@ -988,6 +979,21 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| return ret; | |||
| } | |||
| private void setMerchantId(WxCoupon coupon, WxCreditHistory creditHistory) { | |||
| WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | |||
| wxCouponMerchant.setProductId(coupon.getId()); | |||
| wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | |||
| List<WxCouponMerchant> list = wxCouponMerchantMapper.findList(wxCouponMerchant); | |||
| if (list != null && list.size() > 0) { | |||
| if (list.size() == 1) { | |||
| creditHistory.setMerchantId(list.get(0).getMerchantId()); | |||
| } | |||
| if (list.size() > 1) { | |||
| creditHistory.setMerchantId(Long.valueOf(EnumMerchantType.MERCHANT_MORE.getCode())); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public int microPayOrderSuccess(WxOrder updateOrder) { | |||
| @@ -605,7 +605,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| Date receiveDate = DateUtils.getFirstDayOfNextMonth(startdate,receivePeriod * i); | |||
| wxBillProperty.setReceiveDate(receiveDate); | |||
| wxBillProperty.setStarttime(receiveDate); | |||
| wxBillProperty.setEndtime(DateUtils.getLastDayForMonth(receiveDate,receivePeriod * i)); | |||
| wxBillProperty.setEndtime(DateUtils.getLastDayForMonth(wxBillProperty.getStarttime(),receivePeriod * i)); | |||
| instance.clear(); | |||
| instance.setTime(receiveDate); | |||
| @@ -613,38 +613,37 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| wxBillProperty.setEndtime(instance.getTime()); | |||
| }else if(i == paycount - 1) {//最后周期 | |||
| //receivePeriod * i 得到开始日期 | |||
| Date receiveDate = DateUtils.getFirstDayOfNextMonth(startdate,receivePeriod * i); | |||
| wxBillProperty.setReceiveDate(receiveDate); | |||
| wxBillProperty.setStarttime(receiveDate); | |||
| //得到开始日期第一天 | |||
| Date firstDay = DateUtils.getFirstDayForCurrMonth(wxBillProperty.getStarttime()); | |||
| instance.clear(); | |||
| instance.setTime(firstDay); | |||
| //最后一期有余,加上残月,(不整除时,最后一个月有余,否则为0) | |||
| if(isFirstDay(wxPropertyContract.getRentalStartDate())){ | |||
| if(receivePeriod > 1) { | |||
| if(isLastYesr && extralease > 0) { | |||
| //若最后一期有余,带上残月,(不整除时,最后一个月有余,否则extralease=0) | |||
| if(isFirstDay(wxPropertyContract.getRentalStartDate())){ //月第一天起租 | |||
| if(receivePeriod > 1){ | |||
| if(isLastYesr && extralease > 0){ | |||
| instance.add(dayType, extralease); | |||
| }else{ | |||
| instance.add(dayType, receivePeriod); | |||
| } | |||
| }else { | |||
| }else{ | |||
| instance.add(dayType, receivePeriod); | |||
| } | |||
| }else{ | |||
| if(receivePeriod > 1) { | |||
| if(isLastYesr) { | |||
| instance.add(dayType, extralease); | |||
| }else{ | |||
| instance.add(dayType, receivePeriod); | |||
| } | |||
| } | |||
| if(isLastYesr) { | |||
| instance.add(dayType, extralease); | |||
| instance.add(Calendar.DAY_OF_MONTH, rentStartDateInt - 1); | |||
| }else{ | |||
| instance.add(dayType, receivePeriod); | |||
| } | |||
| } | |||
| //先减一个月 后加上残月 | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| wxBillProperty.setEndtime(instance.getTime()); | |||
| @@ -662,15 +661,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| needPayDouble += price * receivePeriod; | |||
| } | |||
| }else{ | |||
| if(receivePeriod > 1) { | |||
| if(isLastYesr) { | |||
| needPayDouble += price * extralease; | |||
| }else{ | |||
| needPayDouble += price * receivePeriod; | |||
| } | |||
| } | |||
| if(isLastYesr) { | |||
| needPayDouble += price * extralease; | |||
| needPayDouble += oneDayProce * endDateInt; | |||
| }else{ | |||
| needPayDouble += price * receivePeriod; | |||
| } | |||
| } | |||
| DecimalFormat format = new DecimalFormat("0"); | |||
| @@ -633,6 +633,33 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| updateInvalidStatus(wxRentContract); | |||
| } | |||
| @Override | |||
| public ResultData hasRentStatus(WxRentContract record) { | |||
| String rentInfo = record.getRentInfo(); | |||
| if (StringUtils.isEmpty(rentInfo)) { | |||
| return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | |||
| } | |||
| String[] split = rentInfo.split(","); | |||
| int size = split.length; | |||
| //查询rent_info 包括 shopId | |||
| for (int i = 0; i < size; i++) { | |||
| String shopId = split[i]; | |||
| WxShop wxShop = wxShopMapper.selectByPrimaryKey(shopId); | |||
| WxRentContract wxRentContractQuery = new WxRentContract(); | |||
| wxRentContractQuery.setTenantId(record.getTenantId()); | |||
| String shopNumber = wxShop.getShopNumber(); | |||
| if (shopId == null) { | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); | |||
| } | |||
| wxRentContractQuery.setShopId(Long.valueOf(shopId)); | |||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| } | |||
| public void updateInvalidStatus(WxRentContract wxRentContract) { | |||
| WxRentContract record = new WxRentContract(); | |||
| record.setTenantId(wxRentContract.getTenantId()); | |||
| @@ -778,10 +805,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| size = integers.size(); | |||
| priceArrs = new long[size]; | |||
| priceArrs[0] = price; | |||
| double priceD = price; | |||
| BigDecimal priceD = new BigDecimal(price); | |||
| for (int i = 1; i < size; i++) { | |||
| priceD = priceD + priceD * integers.get(i) / 10000.0; | |||
| priceArrs[i] = new BigDecimal(priceD).setScale(0, RoundingMode.HALF_EVEN).intValue(); | |||
| BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); | |||
| priceD = priceD.add(divide); | |||
| priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| } | |||
| } | |||
| @@ -970,51 +998,43 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillRent.setStarttime(receiveDate); | |||
| wxBillRent.setEndtime(DateUtils.getLastDayForMonth(wxBillRent.getStarttime(),receivePeriod * i)); | |||
| // instance.clear(); | |||
| // instance.setTime(receiveDate); | |||
| // instance.add(dayType, receivePeriod); | |||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| // wxBillRent.setEndtime(instance.getTime()); | |||
| instance.clear(); | |||
| instance.setTime(receiveDate); | |||
| instance.add(dayType, receivePeriod); | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| wxBillRent.setEndtime(instance.getTime()); | |||
| }else if(i == paycount - 1) {//最后周期 | |||
| //receivePeriod * i 得到开始日期 | |||
| Date receiveDate = DateUtils.getFirstDayOfNextMonth(startdate,receivePeriod * i); | |||
| wxBillRent.setReceiveDate(receiveDate); | |||
| wxBillRent.setStarttime(receiveDate); | |||
| //得到开始日期第一天 | |||
| Date firstDay = DateUtils.getFirstDayForCurrMonth(wxBillRent.getStarttime()); | |||
| instance.clear(); | |||
| instance.setTime(firstDay); | |||
| if(new SimpleDateFormat("yyyy-MM-dd").format(wxBillRent.getEndtime()).equals("2020-02-29")){ | |||
| System.out.println( "-----------"+receivePeriod * i); | |||
| System.out.println("-----------"+new SimpleDateFormat("yyyy-MM-dd").format(wxBillRent.getReceiveDate())); | |||
| System.out.println("-----------"+new SimpleDateFormat("yyyy-MM-dd").format(wxBillRent.getEndtime())); | |||
| System.out.println(); | |||
| } | |||
| //最后一期有余,加上残月,(不整除时,最后一个月有余,否则为0) | |||
| if(isFirstDay(wxRentContract.getRentalStartDate())){ | |||
| if(receivePeriod > 1) { | |||
| if(isLastYesr && extralease > 0) { | |||
| //若最后一期有余,带上残月,(不整除时,最后一个月有余,否则extralease=0) | |||
| if(isFirstDay(wxRentContract.getRentalStartDate())){ //月第一天起租 | |||
| if(receivePeriod > 1){ | |||
| if(isLastYesr && extralease > 0){ | |||
| instance.add(dayType, extralease); | |||
| }else{ | |||
| instance.add(dayType, receivePeriod); | |||
| } | |||
| }else { | |||
| }else{ | |||
| instance.add(dayType, receivePeriod); | |||
| } | |||
| }else{ | |||
| if(receivePeriod > 1) { | |||
| if(isLastYesr) { | |||
| instance.add(dayType, extralease); | |||
| }else{ | |||
| instance.add(dayType, receivePeriod); | |||
| } | |||
| } | |||
| if(isLastYesr) { | |||
| instance.add(dayType, extralease); | |||
| instance.add(Calendar.DAY_OF_MONTH, rentStartDateInt - 1); | |||
| }else{ | |||
| instance.add(dayType, receivePeriod); | |||
| } | |||
| } | |||
| //先减一个月 后加上残月 | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| wxBillRent.setEndtime(instance.getTime()); | |||
| @@ -1032,15 +1052,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| needPayDouble += price * receivePeriod; | |||
| } | |||
| }else{ | |||
| if(receivePeriod > 1) { | |||
| if(isLastYesr) { | |||
| needPayDouble += price * extralease; | |||
| }else{ | |||
| needPayDouble += price * receivePeriod; | |||
| } | |||
| } | |||
| if(isLastYesr) { | |||
| needPayDouble += price * extralease; | |||
| needPayDouble += oneDayProce * endDateInt; | |||
| }else{ | |||
| needPayDouble += price * receivePeriod; | |||
| } | |||
| } | |||
| DecimalFormat format = new DecimalFormat("0"); | |||
| @@ -1070,7 +1086,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillRent.setExpiredDay(0L); | |||
| } | |||
| } | |||
| wxBillRent.setRevenue(needpay); | |||
| wxBillRent.setTenantId(wxMerchant.getTenantId()); | |||
| wxBillRent.setIsDel(0); | |||
| wxBillRent.setMerchantId(wxMerchant.getId()); | |||
| @@ -2038,3 +2054,4 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| @@ -10,10 +10,7 @@ import com.iformall.domain.po.WxMerchantShop; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.vo.WxNotRentShopVo; | |||
| import com.iformall.domain.vo.WxShopVo; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import com.iformall.enums.EnumShopStatus; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.WxMerchantShopMapper; | |||
| import com.iformall.mapper.WxShopMapper; | |||
| import com.iformall.service.ExcelService; | |||
| @@ -171,11 +168,20 @@ public class WxShopServiceImpl implements WxShopService { | |||
| @Override | |||
| public void exportNotRentShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxShop> list = wxShopMapper.findList(wxShop); | |||
| List<Map<String,Object>> shops = wxShopMapper.notRentListMapAsPage(wxShop); | |||
| List<WxNotRentShopVo> notRentShopVoList = new ArrayList<>(); | |||
| for (WxShop ws:list) { | |||
| for (Map<String,Object> m:shops) { | |||
| WxNotRentShopVo notRentShopVo = new WxNotRentShopVo(); | |||
| BeanUtils.copyProperties(ws, notRentShopVo); | |||
| notRentShopVo.setBuildArea((String)m.get("buildArea")); | |||
| notRentShopVo.setBuilding((String)m.get("building")); | |||
| notRentShopVo.setFloor((String)m.get("floor")); | |||
| notRentShopVo.setFreeDay((Long) m.get("freeDay")); | |||
| notRentShopVo.setOperationArea((String) m.get("operationArea")); | |||
| Integer point = (Integer) m.get("pointType"); | |||
| if(point != null){ | |||
| notRentShopVo.setPointType(EnumPointType.getEnum(point).getMessage()); | |||
| } | |||
| notRentShopVo.setShopNumber((String) m.get("shopNumber")); | |||
| notRentShopVoList.add(notRentShopVo); | |||
| } | |||
| String name = "未出租商铺列表"; | |||
| @@ -543,8 +543,10 @@ | |||
| </select> | |||
| <select id="getCountByWxShop" parameterType="com.iformall.domain.po.WxShop" resultType="Long"> | |||
| select count(*) from wx_shop w left join wx_merchant_shop ms ON | |||
| ms.shop_id = w.id where w.tenant_id=#{tenantId} and w.is_del=0 | |||
| select count(*) from wx_shop w where w.is_del=0 | |||
| <if test=" null != tenantId "> | |||
| and w.`tenant_id`= #{tenantId} | |||
| </if> | |||
| <if test="null != startdate"> | |||
| and ms.`create_date` >= #{startdate} | |||
| </if> | |||