| @@ -13,13 +13,11 @@ import com.amazonaws.services.s3.model.ObjectMetadata; | |||
| import com.amazonaws.services.s3.model.PutObjectRequest; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.config.AwsProperty; | |||
| import com.iformall.utils.AwsClient; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestParam; | |||
| @@ -27,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.BufferedInputStream; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.io.IOException; | |||
| import java.net.URL; | |||
| @@ -45,6 +42,8 @@ public class UploadController extends BaseController { | |||
| @Autowired | |||
| private AwsProperty awsProperty; | |||
| private AmazonS3 s3 = null; | |||
| /* | |||
| @Value("${fileUpload.path}") | |||
| private String filePath; | |||
| @@ -108,7 +107,22 @@ public class UploadController extends BaseController { | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName) { | |||
| ResultData data = new ResultData(); | |||
| try { | |||
| AmazonS3 s3 = AwsClient.getInstance(); | |||
| if(s3 == null) { | |||
| s3 = AmazonS3ClientBuilder.standard() | |||
| .withRegion(awsProperty.getClientRegion()) | |||
| .withCredentials(new AWSCredentialsProvider() { | |||
| @Override | |||
| public AWSCredentials getCredentials() { | |||
| return new BasicAWSCredentials(awsProperty.getAccess(), awsProperty.getSecret()); | |||
| } | |||
| @Override | |||
| public void refresh() { | |||
| } | |||
| }) | |||
| .build(); | |||
| } | |||
| s3.putObject( | |||
| new PutObjectRequest(awsProperty.getBucketName(), fileName, multiReq.getInputStream(), metadata) | |||
| @@ -63,6 +63,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("wx_authorizer_info".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_user_channel".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @@ -15,7 +15,6 @@ import com.amazonaws.services.s3.model.PutObjectRequest; | |||
| import com.iformall.shiro.UserSession; | |||
| import com.iformall.ueditor.define.BaseState; | |||
| import com.iformall.ueditor.define.State; | |||
| import com.iformall.utils.AwsClient; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -1,41 +0,0 @@ | |||
| package com.iformall.utils; | |||
| import com.amazonaws.auth.AWSCredentials; | |||
| import com.amazonaws.auth.AWSCredentialsProvider; | |||
| import com.amazonaws.auth.BasicAWSCredentials; | |||
| import com.amazonaws.services.s3.AmazonS3; | |||
| import com.amazonaws.services.s3.AmazonS3ClientBuilder; | |||
| import com.iformall.config.AwsProperty; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| public class AwsClient { | |||
| @Autowired | |||
| private static AwsProperty awsProperty; | |||
| private static AmazonS3 s3 = null; | |||
| private AwsClient() { | |||
| } | |||
| public static AmazonS3 getInstance() { | |||
| if(s3 == null) { | |||
| s3 = AmazonS3ClientBuilder.standard() | |||
| .withRegion(awsProperty.getClientRegion()) | |||
| .withCredentials(new AWSCredentialsProvider() { | |||
| @Override | |||
| public AWSCredentials getCredentials() { | |||
| return new BasicAWSCredentials(awsProperty.getAccess(), awsProperty.getSecret()); | |||
| } | |||
| @Override | |||
| public void refresh() { | |||
| } | |||
| }) | |||
| .build(); | |||
| } | |||
| return s3; | |||
| } | |||
| } | |||
| @@ -5,14 +5,14 @@ package com.iformall.enums; | |||
| */ | |||
| public enum EnumCouponType { | |||
| // 1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,7.类储值卡 | |||
| // 1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.通用券,7.消费卡 | |||
| COUPON_MANJIAN(1, "满减券"), | |||
| COUPON_DAIJIN(2, "代金券"), | |||
| COUPON_TUANGOU(3, "团购券"), | |||
| COUPON_LIPIN(4, "礼品券"), | |||
| COUPON_TINGCHE(5, "停车券"), | |||
| COUPON_MULTIMCH(6, "多商户券"), | |||
| CARD_MULTIMCH(7, "类储值卡"), | |||
| COUPON_MULTIMCH(6, "通用券"), | |||
| CARD_MULTIMCH(7, "消费卡"), | |||
| ; | |||
| public static EnumCouponType getEnum(Integer code) { | |||
| @@ -285,7 +285,6 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void shareForCardPay(String tenantId, Long cardId, Long orderId, Long cardSpendId) { | |||
| @@ -300,6 +299,9 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| logger.error("微信分账已超过限制次数-20次"); | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT); | |||
| } | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| @@ -103,71 +103,39 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||
| Row rowtwo = sheetTwo.createRow(0); | |||
| Cell idCellTwo = rowtwo.createCell(0); | |||
| Cell merchantNameCellTwo = rowtwo.createCell(1); | |||
| Cell cardNameCellTwo = rowtwo.createCell(2); | |||
| Cell orderIdCellTwo = rowtwo.createCell(3); | |||
| Cell orderTypeCellTwo = rowtwo.createCell(4); | |||
| Cell orderPaymentCellTwo = rowtwo.createCell(5); | |||
| Cell receiverPaymentCellTwo = rowtwo.createCell(6); | |||
| Cell realPaymentCellTwo = rowtwo.createCell(7); | |||
| Cell realReceivePayCellTwo = rowtwo.createCell(8); | |||
| Cell subsidyCellTwo = rowtwo.createCell(9); | |||
| Cell realSubsidyCellTwo = rowtwo.createCell(10); | |||
| Cell createDateCellTwo = rowtwo.createCell(11); | |||
| Cell statusCellTwo = rowtwo.createCell(12); | |||
| idCellTwo.setCellValue("ID"); | |||
| merchantNameCellTwo.setCellValue("商户"); | |||
| cardNameCellTwo.setCellValue("卡券名"); | |||
| orderIdCellTwo.setCellValue("订单号"); | |||
| orderTypeCellTwo.setCellValue("支付类型"); | |||
| orderPaymentCellTwo.setCellValue("订单金额"); | |||
| receiverPaymentCellTwo.setCellValue("接收金额"); | |||
| realPaymentCellTwo.setCellValue("实收金额"); | |||
| realReceivePayCellTwo.setCellValue("实收金额"); | |||
| subsidyCellTwo.setCellValue("补贴金额(包含通道费)"); | |||
| realSubsidyCellTwo.setCellValue("补贴金额(不包含通道费)"); | |||
| createDateCellTwo.setCellValue("创建时间"); | |||
| statusCellTwo.setCellValue("状态"); | |||
| Cell createDateCellTwo = rowtwo.createCell(2); | |||
| Cell orderPaymentCellTwo = rowtwo.createCell(3); | |||
| Cell receiverPaymentCellTwo = rowtwo.createCell(4); | |||
| Cell subsidyCellTwo = rowtwo.createCell(5); | |||
| Cell statusCellTwo = rowtwo.createCell(6); | |||
| idCellTwo.setCellValue("交易单号"); | |||
| merchantNameCellTwo.setCellValue("消费商户"); | |||
| createDateCellTwo.setCellValue("交易时间"); | |||
| orderPaymentCellTwo.setCellValue("本次消费(元)"); | |||
| receiverPaymentCellTwo.setCellValue("商户应收(元)"); | |||
| subsidyCellTwo.setCellValue("补贴(元)"); | |||
| statusCellTwo.setCellValue("补贴状态"); | |||
| for (int i = 0; i < subsidyVoList.size(); i++) { | |||
| rowtwo = sheetTwo.createRow(i + 1); | |||
| idCellTwo = rowtwo.createCell(0); | |||
| merchantNameCellTwo = rowtwo.createCell(1); | |||
| cardNameCellTwo = rowtwo.createCell(2); | |||
| orderIdCellTwo = rowtwo.createCell(3); | |||
| orderTypeCellTwo = rowtwo.createCell(4); | |||
| orderPaymentCellTwo = rowtwo.createCell(5); | |||
| receiverPaymentCellTwo = rowtwo.createCell(6); | |||
| realPaymentCellTwo = rowtwo.createCell(7); | |||
| subsidyCellTwo = rowtwo.createCell(8); | |||
| realSubsidyCellTwo = rowtwo.createCell(9); | |||
| createDateCellTwo = rowtwo.createCell(10); | |||
| statusCellTwo = rowtwo.createCell(11); | |||
| createDateCellTwo = rowtwo.createCell(2); | |||
| orderPaymentCellTwo = rowtwo.createCell(3); | |||
| receiverPaymentCellTwo = rowtwo.createCell(4); | |||
| subsidyCellTwo = rowtwo.createCell(5); | |||
| statusCellTwo = rowtwo.createCell(6); | |||
| WxMerchantSubsidyVo entity = subsidyVoList.get(i); | |||
| idCellTwo.setCellValue(entity.getId()); | |||
| merchantNameCellTwo.setCellValue(entity.getMerchantName()); | |||
| cardNameCellTwo.setCellValue(entity.getTitle()); | |||
| orderIdCellTwo.setCellValue(entity.getOrderId()); | |||
| String str = "券"; // 0:券1:付款码支付,2:C扫码支付,3,储值卡 | |||
| if (entity.getOrderType().equals(EnumOrderType.COUPON.getCode())) { | |||
| str = "券"; | |||
| } else if (entity.getOrderType().equals(EnumOrderType.MICROPAY.getCode())) { | |||
| str = "付款码支付"; | |||
| } else if (entity.getOrderType().equals(EnumOrderType.NATIVEPAY.getCode())) { | |||
| str = "C扫码支付"; | |||
| } else if (entity.getOrderType().equals(EnumOrderType.PREPAIDCARD.getCode())) { | |||
| str = "储值卡"; | |||
| } | |||
| orderTypeCellTwo.setCellValue(str); | |||
| if (entity.getCreateDate() != null) | |||
| createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | |||
| orderPaymentCellTwo.setCellValue(entity.getOrderPayment()/ 100); | |||
| receiverPaymentCellTwo.setCellValue(entity.getReceiverPayment() / 100); | |||
| realPaymentCellTwo.setCellValue(entity.getRealPayment() / 100); | |||
| subsidyCellTwo.setCellValue(entity.getSubsidy() / 100); | |||
| realSubsidyCellTwo.setCellValue(entity.getRealSubsidy()); | |||
| if (entity.getCreateDate() != null) | |||
| createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | |||
| String statusStr = "未补贴"; | |||
| if (entity.getStatus().equals(EnumMerchantSubsidyStatus.NOT_SUBSIDY.getCode())) { | |||
| statusStr = "未补贴"; | |||