| | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.nio.charset.Charset; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | @Autowired |
| | | private MallMemberWithdrawMapper mallMemberWithdrawMapper; |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | private final ClothesTypeMapper clothesTypeMapper; |
| | | private final ClothesOrderMapper clothesOrderMapper; |
| | | @Autowired |
| | | RedisUtils redisUtils; |
| | | |
| | |
| | | } |
| | | mallOrderInfo.setWxOrderNo(payData.getPrepay_id()); |
| | | mallOrderInfoMapper.updateById(mallOrderInfo); |
| | | return payData; |
| | | } |
| | | |
| | | @Override |
| | | public BrandWCPayRequestData startPayment(ClothesOrder orderInfo) throws Exception { |
| | | BigDecimal unit = new BigDecimal("100"); |
| | | BigDecimal money = new BigDecimal(orderInfo.getRealAmount().toString()); |
| | | BrandWCPayRequestData payData; |
| | | |
| | | ClothesType clothesType = clothesTypeMapper.selectById(orderInfo.getTypeId()); |
| | | String productNames = clothesType.getName(); |
| | | MallMember mallMember = mallMemberMapper.selectById(orderInfo.getMemberId()); |
| | | Boolean debug = xcxProperties.getDebug(); |
| | | if (debug) { |
| | | payData = weixinServiceUtil.createOrder("[测试]" + productNames, orderInfo.getOrderNo(), |
| | | 1, mallMember.getOpenId(), String.valueOf(orderInfo.getId())); |
| | | } else { |
| | | payData = weixinServiceUtil.createOrder(productNames, orderInfo.getOrderNo(), |
| | | unit.multiply(money).intValue(),mallMember.getOpenId(), String.valueOf(orderInfo.getId())); |
| | | } |
| | | orderInfo.setPayOrderNo(payData.getPrepay_id()); |
| | | |
| | | clothesOrderMapper.update(null, |
| | | Wrappers.lambdaUpdate(ClothesOrder.class) |
| | | .set(ClothesOrder::getPayOrderNo, payData.getPrepay_id()) |
| | | .set(ClothesOrder::getUpdatedTime, new Date()) |
| | | .eq(ClothesOrder::getId, orderInfo.getId()) |
| | | ); |
| | | return payData; |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | //图片上传路径 |
| | | // todo 上线修改图片上传路径 |
| | | public static final String IMG_UPLOAD_PATH="/home/javaweb/webresource/upload/wxcode"; |
| | | public String generateAcode(String scene,String path,String imgName,String width, Integer type){ |
| | | String urlPrefix="http://hcres.csxuncong.com/wxcode"; |
| | | // todo 上线修改图片上传路径 |
| | | String urlPrefix="https://hcres.csxuncong.com/wxcode"; |
| | | String imgPath=IMG_UPLOAD_PATH+imgName; |
| | | if(!FileUtil.exist(imgPath)){ |
| | | |