| @@ -6,9 +6,11 @@ import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.shiro.UserSession; | |||
| import com.iformall.utils.IPUtil; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.session.Session; | |||
| import org.springframework.web.bind.WebDataBinder; | |||
| import org.springframework.web.bind.annotation.InitBinder; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -51,11 +53,30 @@ public class BaseController { | |||
| return userId; | |||
| } | |||
| @Deprecated | |||
| public String getTenantId(){ | |||
| String tenantId = (String)SecurityUtils.getSubject().getSession().getAttribute(UserSession.tenantId); | |||
| return tenantId; | |||
| } | |||
| /** | |||
| * 返回租户信息 | |||
| * @return | |||
| */ | |||
| public TenantEntity getTenantInfo(){ | |||
| Session session = SecurityUtils.getSubject().getSession(); | |||
| String tenantId = (String)session.getAttribute(UserSession.tenantId); | |||
| TenantEntity tenantEntity = new TenantEntity(){{ | |||
| setTenantId(tenantId); | |||
| }}; | |||
| return tenantEntity; | |||
| } | |||
| public void setTenantInfo(TenantEntity dest, TenantEntity source) { | |||
| dest.setTenantId(source.getTenantId()); | |||
| } | |||
| public String getIpAddr() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String ipaddress = IPUtil.getIpAddr(request); | |||
| @@ -65,12 +65,12 @@ public class WxBrandController extends BaseController { | |||
| @SystemControllerLog(description = "品牌-更新") | |||
| public ResultData update(@RequestBody WxBrand wxBrand) { | |||
| logger.debug("[" + getIpAddr() + "] WxBrandController::update"); | |||
| wxBrand.setTenantId(getTenantId()); | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| if(EnumDelFlag.YES.getCode().equals(wxBrand.getIsDel())){ | |||
| //判断是否解绑商户 | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setTenantId(wxBrand.getTenantId()); | |||
| wxMerchant.updateTenantInfo(wxBrand); | |||
| wxMerchant.setIsDel(0); | |||
| wxMerchant.setBrand(wxBrand.getId()); | |||
| List<WxMerchant> merchantList = wxMerchantService.findList(wxMerchant); | |||
| @@ -392,6 +392,15 @@ public class WxRentContractController extends BaseController { | |||
| wxRentContractService.endContract(wxRentContract); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/getContractByContractNumber") | |||
| @SystemControllerLog(description = "租赁合同-通过合同编号查询信息") | |||
| public ResultData getContractByContractNumber(@ModelAttribute WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::getContractByContractNumber"); | |||
| wxRentContract.setTenantId(getTenantId()); | |||
| return wxRentContractService.getContractByContractNumber(wxRentContract); | |||
| } | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.controller; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxBuser; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| @@ -88,13 +89,26 @@ public class BaseController { | |||
| return user; | |||
| } | |||
| @Deprecated | |||
| public String getTenantId() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | |||
| return tenantId; | |||
| } | |||
| public TenantEntity getTenantInfo() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | |||
| TenantEntity tenantEntity = new TenantEntity() {{ | |||
| setTenantId(tenantId); | |||
| }}; | |||
| return tenantEntity; | |||
| } | |||
| public void setTenantInfo(TenantEntity dest, TenantEntity source) { | |||
| dest.setTenantId(source.getTenantId()); | |||
| } | |||
| public WxAppinfo getAppInfo(String appId) { | |||
| return wxAppinfoService.getByAppId(appId); | |||
| } | |||
| @@ -365,15 +365,17 @@ public class WxMicroPayController extends BaseController { | |||
| logger.error("orderId不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(authCode)) { | |||
| logger.error("authCode不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "authCode不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(payPriceStr)) { | |||
| logger.error("payPrice不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "payPrice不能为空"); | |||
| } | |||
| BigDecimal totalFee = new BigDecimal(payPriceStr); | |||
| totalFee.setScale(2, BigDecimal.ROUND_HALF_UP); // 第一个变量是小数位数,第二个变量是取舍方法(四舍五入) | |||
| Integer payPrice = totalFee.multiply(new BigDecimal(100)).intValue(); | |||
| String ipStr = IPUtil.getIpAddr(request); | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserService.getById(user.getId()); | |||
| @@ -384,9 +386,7 @@ public class WxMicroPayController extends BaseController { | |||
| wxMerchantBUser.setBuserId(getBuserId()); | |||
| Long couponOrderId = 0L, orderId = 0L; | |||
| BigDecimal totalFee = new BigDecimal(payPriceStr); | |||
| totalFee.setScale(2, BigDecimal.ROUND_HALF_UP); // 第一个变量是小数位数,第二个变量是取舍方法(四舍五入) | |||
| Integer payPrice = totalFee.multiply(new BigDecimal(100)).intValue(); | |||
| try { | |||
| orderId = Long.valueOf(orderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| @@ -424,22 +424,49 @@ public class WxMicroPayController extends BaseController { | |||
| } | |||
| } | |||
| WxPayOrder record = new WxPayOrder(); | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setOrderId(microOrder.getId()); | |||
| record.setCUserId(microOrder.getCUserId()); | |||
| record.setAuthCode(authCode); | |||
| record.setPayAmount(remainPrice); | |||
| record.setIp(ipStr); | |||
| if (remainPrice > 0) { | |||
| if (StringUtils.isBlank(authCode)) { | |||
| logger.error("authCode不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "authCode不能为空"); | |||
| } | |||
| try { | |||
| return wxPayOrderService.createMicroPayOrder(user, record, EnumPayWay.PAY_WAY_WECHAT); | |||
| } catch (MallinkException e) { | |||
| logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("payment wechat, order create error, req 3: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, e.getMessage()); | |||
| WxPayOrder record = new WxPayOrder(); | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setOrderId(microOrder.getId()); | |||
| record.setCUserId(microOrder.getCUserId()); | |||
| record.setAuthCode(authCode); | |||
| record.setPayAmount(remainPrice); | |||
| record.setIp(ipStr); | |||
| try { | |||
| return wxPayOrderService.createMicroPayOrder(user, record, EnumPayWay.PAY_WAY_WECHAT); | |||
| } catch (MallinkException e) { | |||
| logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("payment wechat, order create error, req 3: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, e.getMessage()); | |||
| } | |||
| } else { | |||
| // 支付完成 | |||
| WxPayOrder record = new WxPayOrder(); | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setOrderId(microOrder.getId()); | |||
| record.setCUserId(microOrder.getCUserId()); | |||
| record.setPayAmount(remainPrice); | |||
| record.setIp(ipStr); | |||
| try { | |||
| wxPayOrderService.handleMicroOrderPaySuccessForVerify(user, record); | |||
| Map map = new HashMap(); | |||
| map.put("end", "1"); | |||
| return new ResultData(map); | |||
| } catch (MallinkException e) { | |||
| logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("payment wechat, order create error, req 3: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.controller; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| @@ -68,12 +69,26 @@ public class BaseController { | |||
| }); | |||
| } | |||
| @Deprecated | |||
| public String getTenantId() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | |||
| return tenantId; | |||
| } | |||
| public TenantEntity getTenantInfo() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | |||
| TenantEntity tenantEntity = new TenantEntity() {{ | |||
| setTenantId(tenantId); | |||
| }}; | |||
| return tenantEntity; | |||
| } | |||
| public void setTenantInfo(TenantEntity dest, TenantEntity source) { | |||
| dest.setTenantId(source.getTenantId()); | |||
| } | |||
| public Long getUserId() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| Long cUserId = (Long) request.getAttribute(Constant.LOGIN_USER_KEY); | |||
| @@ -86,8 +101,10 @@ public class BaseController { | |||
| public WxCUser getUser() { | |||
| Long cUserId = getUserId(); | |||
| WxCUser user = wxCUserService.getById(cUserId); | |||
| if (user == null) | |||
| if (user == null) { | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| user.updateTenantInfo(getTenantInfo()); | |||
| return user; | |||
| } | |||
| @@ -12,7 +12,6 @@ import java.util.Date; | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxMallApply extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @@ -1,19 +1,17 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @TableName(value = "wx_question") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxQuestion extends BaseEntity { | |||
| public class WxQuestion extends BaseTenantEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="问题内容",name="content") | |||
| private String content; | |||
| @@ -2,7 +2,7 @@ package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -12,13 +12,10 @@ import java.util.List; | |||
| @TableName(value = "wx_question_config") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxQuestionConfig extends BaseEntity { | |||
| public class WxQuestionConfig extends BaseTenantEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="问题列表",name="questionList") | |||
| private String questionList; | |||
| @@ -1,7 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -11,12 +11,10 @@ import java.util.Date; | |||
| @TableName(value = "wx_question_log") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxQuestionLog extends BaseEntity { | |||
| public class WxQuestionLog extends BaseTenantEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="userId") | |||
| private Long userId; | |||
| @io.swagger.annotations.ApiModelProperty(value="问题ID",name="questionId") | |||
| @@ -3,7 +3,7 @@ package com.iformall.domain.po; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -25,7 +25,7 @@ import java.util.List; | |||
| @TableName(value = "wx_score_rules") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxScoreRules extends BaseEntity { | |||
| public class WxScoreRules extends BaseTenantEntity { | |||
| @TableField(exist = false) | |||
| public static final int DEFAULT_SCALE = 10; | |||
| @@ -89,10 +89,6 @@ public class WxScoreRules extends BaseEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="规则",name="rules") | |||
| private String rules; | |||
| @@ -1,7 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -10,7 +10,7 @@ import java.util.*; | |||
| @TableName(value = "wx_user_visit") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxUserVisit extends BaseEntity { | |||
| public class WxUserVisit extends BaseTenantEntity { | |||
| protected Long id; | |||
| @@ -1,7 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -10,15 +10,12 @@ import java.util.Date; | |||
| @TableName(value = "wx_weapp_audit_status") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappAuditStatus extends BaseEntity { | |||
| public class WxWeappAuditStatus extends BaseTenantEntity { | |||
| 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="小程序ID",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type") | |||
| @@ -1,7 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -10,14 +10,11 @@ import java.util.Date; | |||
| @TableName(value = "wx_weapp_code_status") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappCodeStatus extends BaseEntity { | |||
| public class WxWeappCodeStatus extends BaseTenantEntity { | |||
| 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="小程序ID",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端 3-公众服务号 4-公众订阅号)",name="type") | |||
| @@ -1,7 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -10,7 +10,7 @@ import java.util.Date; | |||
| @TableName(value = "wx_weapp_release_status") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappReleaseStatus extends BaseEntity { | |||
| public class WxWeappReleaseStatus extends BaseTenantEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @@ -12,4 +12,12 @@ import lombok.EqualsAndHashCode; | |||
| public class BaseTenantEntity extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| public void updateTenantInfo(TenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| } | |||
| public void updateTenantInfo(BaseTenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| } | |||
| } | |||
| @@ -12,4 +12,12 @@ import lombok.EqualsAndHashCode; | |||
| public class TenantEntity extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| public void updateTenantInfo(TenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| } | |||
| public void updateTenantInfo(BaseTenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| } | |||
| } | |||
| @@ -3,9 +3,10 @@ package com.iformall.domain.po.invest; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.fasterxml.jackson.annotation.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serializable; | |||
| import java.util.*; | |||
| /** | |||
| @@ -13,9 +14,8 @@ import java.util.*; | |||
| * @date 2019/4/24 14:32 | |||
| */ | |||
| @Data | |||
| public class InvestBaseEntity implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class InvestBaseEntity extends TenantEntity { | |||
| public static final String COLUMN_TYPE = "json"; | |||
| @@ -1,6 +1,6 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -8,14 +8,10 @@ import java.util.Date; | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxFloatingLayerVO extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| public class WxFloatingLayerVO extends BaseTenantEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "封面图", name = "coverImg") | |||
| private String coverImg; | |||
| @@ -75,6 +75,13 @@ public interface WxPayOrderService { | |||
| */ | |||
| void handleMicroOrderPaySuccess(WxMerchantBUser user, WxPayOrder record, String transactionId, String openId, String isSubscribe); | |||
| /** | |||
| * 券支付成功处理 | |||
| * @param user | |||
| * @param record | |||
| */ | |||
| void handleMicroOrderPaySuccessForVerify(WxMerchantBUser user, WxPayOrder record); | |||
| /** | |||
| * 支付状态处理 | |||
| * | |||
| @@ -97,4 +97,7 @@ public interface WxRentContractService { | |||
| Map<Long,WxRentContract> selectRentContractByShopIds(Collection<Long> shopIds, String shopIdsRegexp,String tenantId); | |||
| int selectContractCountByShopId(WxRentContract wxRentContract); | |||
| ResultData getContractByContractNumber(WxRentContract wxRentContract); | |||
| } | |||
| @@ -1440,6 +1440,58 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void handleMicroOrderPaySuccessForVerify(WxMerchantBUser user, WxPayOrder record) { | |||
| Date currentDate = new Date(); | |||
| WxOrder order = wxOrderMapper.selectById(record.getOrderId()); | |||
| if (order == null) { | |||
| logger.error("pay success handle, order " + record.getOrderId() + " not found , payOrderid : " + record.getPayOrderNo()); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | |||
| } | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(order.getTenantId()); | |||
| if (record.getPayAmount().equals(0)) { | |||
| // B端收银台核销券处理 | |||
| WxPayOrder payOrderQ = new WxPayOrder(); | |||
| payOrderQ.setOrderId(order.getId()); | |||
| payOrderQ.setPayFrom(EnumPayFrom.INSIDE_B.getCode()); | |||
| payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | |||
| try { | |||
| WxPayOrder unPayOrder = wxPayOrderMapper.selectOne(new QueryWrapper<>(payOrderQ)); | |||
| if (unPayOrder != null) { | |||
| if (unPayOrder.getPosPayOrderId() != null) { | |||
| try { | |||
| wxCouponOrderService.microPayVerify(user, unPayOrder.getPosPayOrderId()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| // 更新后处理 | |||
| wxCouponOrderService.sendInsideCouponVerifyMsg(unPayOrder.getTenantId(), unPayOrder.getPosPayOrderId(), user.getId()); | |||
| } | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } else { | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR); | |||
| } | |||
| // 修改订单状态 | |||
| try { | |||
| int _count = wxOrderService.microPayOrderSuccess(order); | |||
| if (_count > 1) { | |||
| logger.error("order micro pay count > 1"); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("order status : " + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "订单更新"); | |||
| } | |||
| } | |||
| public void createMerchantSubsidy(WxPayOrder record, WxOrder order, Date curDate) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | |||
| @@ -1042,7 +1042,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| for (int i = 0; i < arraySize; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| String priceStr = rentInfoObject.getString("price"); | |||
| if (priceStr.equalsIgnoreCase("NaN")) { | |||
| if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) { | |||
| priceStr = "0"; | |||
| } | |||
| priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(100)).longValue(); | |||
| @@ -2532,4 +2532,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| public int selectContractCountByShopId(WxRentContract wxRentContract) { | |||
| return wxRentContractMapper.selectContractCountByShopId(wxRentContract) ; | |||
| } | |||
| @Override | |||
| public ResultData getContractByContractNumber(WxRentContract rentContract) { | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectOne(new QueryWrapper<>(rentContract)); | |||
| return new ResultData(wxRentContract); | |||
| } | |||
| } | |||
| @@ -996,8 +996,21 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| tableTriple.setAfter(userAfter.getName()); | |||
| } | |||
| } else if (Objects.equals(column, "targetId")) { | |||
| WxShop shopBefore = shopMap.get(tableTriple.getBefore()); | |||
| WxShop shopAfter = shopMap.get(tableTriple.getAfter()); | |||
| Object beforeVal = tableTriple.getBefore(); | |||
| Object afterVal = tableTriple.getBefore(); | |||
| WxShop shopBefore; | |||
| WxShop shopAfter; | |||
| if (beforeVal instanceof Integer) { | |||
| shopBefore = shopMap.get(Long.valueOf((Integer) beforeVal)); | |||
| } else { | |||
| shopBefore = shopMap.get(beforeVal); | |||
| } | |||
| if (afterVal instanceof Integer) { | |||
| shopAfter = shopMap.get(Long.valueOf((Integer) afterVal)); | |||
| } else { | |||
| shopAfter = shopMap.get(afterVal); | |||
| } | |||
| if (Objects.nonNull(shopBefore)) { | |||
| tableTriple.setBefore(shopBefore.getShopNumber()); | |||
| } | |||
| @@ -183,7 +183,7 @@ public class SysMenuController extends BaseController { | |||
| // 3.1 添加到mall_role_permission | |||
| try { | |||
| mallRolePermissionService.saveOrUpdate(new MallRolePermission(){{ | |||
| setTenantId(mallRole.getTenantId()); | |||
| updateTenantInfo(mallRole); | |||
| setPermissionId(mp.getId()); | |||
| setRoleId(mallRole.getId()); | |||
| }}); | |||
| @@ -234,7 +234,7 @@ public class SysMenuController extends BaseController { | |||
| }}); | |||
| for(MallRolePermission mallRolePermission: mallRolePermissions) { | |||
| List<MallRolePermission> mallRolePermissionList = mallRolePermissionService.getList(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| setPermissionId(menuId_XiTong); | |||
| }}); | |||
| @@ -242,7 +242,7 @@ public class SysMenuController extends BaseController { | |||
| // update 7L->50L | |||
| try { | |||
| mallRolePermissionService.saveOrUpdate(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setId(mallRolePermission.getId()); | |||
| setPermissionId(menuId_XiTong); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| @@ -342,14 +342,14 @@ public class SysMenuController extends BaseController { | |||
| }}); | |||
| for(MallRolePermission mallRolePermission: mallRolePermissions) { | |||
| List<MallRolePermission> mallRolePermissionList = mallRolePermissionService.getList(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| setPermissionId(menuId_Shop); | |||
| }}); | |||
| if (mallRolePermissionList.size() <= 0) { | |||
| try { | |||
| mallRolePermissionService.saveOrUpdate(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setPermissionId(menuId_Shop); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| }}); | |||
| @@ -368,14 +368,14 @@ public class SysMenuController extends BaseController { | |||
| }}); | |||
| for(MallRolePermission mallRolePermission: mallRolePermissions) { | |||
| List<MallRolePermission> mallRolePermissionList = mallRolePermissionService.getList(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| setPermissionId(menuId_Duojing); | |||
| }}); | |||
| if (mallRolePermissionList.size() <= 0) { | |||
| try { | |||
| mallRolePermissionService.saveOrUpdate(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setPermissionId(menuId_Duojing); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| }}); | |||
| @@ -440,14 +440,14 @@ public class SysMenuController extends BaseController { | |||
| }}); | |||
| for(MallRolePermission mallRolePermission: mallRolePermissions) { | |||
| List<MallRolePermission> mallRolePermissionList = mallRolePermissionService.getList(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| setPermissionId(menuId_Zhangdanliebiao); | |||
| }}); | |||
| if (mallRolePermissionList.size() <= 0) { | |||
| try { | |||
| mallRolePermissionService.saveOrUpdate(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setPermissionId(menuId_Zhangdanliebiao); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| }}); | |||
| @@ -494,14 +494,14 @@ public class SysMenuController extends BaseController { | |||
| }}); | |||
| for(MallRolePermission mallRolePermission: mallRolePermissions) { | |||
| List<MallRolePermission> mallRolePermissionList = mallRolePermissionService.getList(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| setPermissionId(menuId_ZhangdanMan); | |||
| }}); | |||
| if (mallRolePermissionList.size() <= 0) { | |||
| try { | |||
| mallRolePermissionService.saveOrUpdate(new MallRolePermission(){{ | |||
| setTenantId(mallRolePermission.getTenantId()); | |||
| updateTenantInfo(mallRolePermission); | |||
| setPermissionId(menuId_ZhangdanMan); | |||
| setRoleId(mallRolePermission.getRoleId()); | |||
| }}); | |||