| | |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.FtpUtil; |
| | | import com.doumee.core.utils.ImageWatermarkUtil; |
| | | import com.doumee.core.utils.aliyun.ALiYunUtil; |
| | | import com.doumee.core.utils.geocode.MapUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ OBS", notes = "ä¸ä¼ OBS", httpMethod = "POST", position = 6) |
| | | @ApiOperation(value = "ä¸ä¼ OSS", notes = "ä¸ä¼ OSSï¼å¯ä¼ å
¥ç»çº¬åº¦èªå¨æ·»å æ¶é´+å°åæ°´å°", httpMethod = "POST", position = 6) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "folder", value = "æä»¶å¤¹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "file", value = "æä»¶å¤¹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "file", value = "æä»¶", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "latitude", value = "纬度ï¼éå¿
å¡«ï¼ä¼ å
¥æ¶æ·»å æ°´å°ï¼", paramType = "query", dataType = "Double"), |
| | | @ApiImplicitParam(name = "longitude", value = "ç»åº¦ï¼éå¿
å¡«ï¼ä¼ å
¥æ¶æ·»å æ°´å°ï¼", paramType = "query", dataType = "Double"), |
| | | }) |
| | | @PostMapping(value = "/upload", headers = "content-type=multipart/form-data") |
| | | @ResponseBody |
| | | public void upload(HttpServletRequest request, HttpServletResponse response, String folder,String flag) throws Exception { |
| | | public void upload(HttpServletRequest request, HttpServletResponse response, String folder, String flag, |
| | | @RequestParam(required = false) Double latitude, |
| | | @RequestParam(required = false) Double longitude) throws Exception { |
| | | Date d1 = new Date(); |
| | | log.error("æ»å¾ä¸ä¼ æä»¶æå=============å¼å§========="+DateUtil.getPlusTime2(d1)); |
| | | if(Objects.isNull(folder)){ |
| | |
| | | System.out.println(file.getSize()); |
| | | String originname = file.getOriginalFilename(); |
| | | is = file.getInputStream(); |
| | | |
| | | // ç»çº¬åº¦æ°´å°å¤ç |
| | | InputStream uploadStream = is; |
| | | if (latitude != null && longitude != null) { |
| | | try { |
| | | JSONObject geoResult = MapUtil.reverseGeocode(latitude, longitude); |
| | | String address = geoResult != null ? geoResult.getString("formatted_addresses") : ""; |
| | | String timeText = DateUtil.getPlusTime2(new Date()); |
| | | uploadStream = ImageWatermarkUtil.addWatermark(is, timeText, address, latitude, longitude); |
| | | log.info("å¾çæ°´å°æ·»å æå: time={}, address={}", timeText, address); |
| | | } catch (Exception e) { |
| | | log.warn("æ°´å°å¤ç失败ï¼ä½¿ç¨åå¾ä¸ä¼ : {}", e.getMessage()); |
| | | try { is.reset(); } catch (Exception ignored) {} |
| | | uploadStream = is; |
| | | } |
| | | } |
| | | |
| | | String endType = ".jpg"; |
| | | if(originname.indexOf(".")>0){ |
| | | endType=originname.substring(originname.lastIndexOf("."),originname.length()); |
| | |
| | | ALiYunUtil obs = new ALiYunUtil(systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode(),systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode()); |
| | | |
| | | r = obs.uploadOnlineObject(file.getInputStream(),systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), fileName,null); |
| | | r = obs.uploadOnlineObject(uploadStream,systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), fileName,null); |
| | | if(r){ |
| | | context.put("success", true); |
| | | context.put("code", 200); |
| | | context.put("errno",0); |
| | | JSONObject fileJSON = new JSONObject(); |
| | | // fileJSON.put("prefixPath", prefixPath); |
| | | // fileJSON.put("folder", folder); |
| | | fileJSON.put("url", prefixPath+fileName); |
| | | fileJSON.put("imgaddr", fName); |
| | | fileJSON.put("imgname", fileName); |
| | |
| | | import com.alipay.v3.Configuration; |
| | | import com.alipay.v3.api.AlipayFundTransUniApi; |
| | | import com.alipay.v3.model.*; |
| | | import com.doumee.config.mybatis.SpringUtils; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.dao.dto.AlipayTransferDTO; |
| | | import com.wechat.pay.java.core.RSAAutoCertificateConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import okhttp3.OkHttpClient; |
| | | import com.wechat.pay.java.core.http.*; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @org.springframework.context.annotation.Configuration |
| | | public class AlipayFundTransUniTransfer { |
| | | |
| | | @Autowired |
| | | private AlipayProperties alipayProperties; |
| | | |
| | | private static AlipayConfig alipayConfig; |
| | | |
| | | public static AlipayFundTransUniTransfer me() { |
| | | return SpringUtils.get().getBean(AlipayFundTransUniTransfer.class); |
| | | } |
| | | |
| | | @PostConstruct |
| | | void init() { |
| | | this.loadAlipayConfig(); |
| | | } |
| | | |
| | | public void loadAlipayConfig() { |
| | | try { |
| | | AlipayConfig config = new AlipayConfig(); |
| | | config.setServerUrl("https://openapi.alipay.com"); |
| | | config.setAppId("2021006147660139"); |
| | | String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDEeqqkZztBHfK+vpyBi6ejgDTHZuZ3yiuXds+lRBbMo/g24F5trH+oLHW0gMhSxihFfQBBIpVBXDsPQK4ZkhDWTaOBktnU1UMRoOEiaaZU6EiWy10ePFUmpdXpk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WLgGymUzct2UHSVAoGBAMb+7Cs+Ub0pMrmFBY6r52pbey1Uq0pglvRgMmhQU7sjx50r2GaA81zPer15WVM5/nNPYaoALYqg7jrPe/PjOT/fvpR+7SNg7DZ8QftANfYiY7jKifst/gDt9ePLPS6FedZ4XcJQgOVu34jicAFx64vPbS/zrddm4iEScSVijRBBAoGAXCheERsx8+n16Us/DttXFUa1nc7+D8WR6buM1QMZgQCVF2qp3XtM+FusCKL4+q1+dtag8svLjJFp9QbaAXqX8Zk7rn8wUHbDloPTPy9XWgrPowyL9MPU+e/Rq8Hr6TWPDBd4TU64YzIEfBQYpJXfZbXhVYmK3o7xHXKB1x4vvEM="; |
| | | config.setPrivateKey(privateKey); |
| | | config.setAppCertPath("pay/pro/appCertPublicKey.crt"); |
| | | config.setAlipayPublicCertPath("pay/pro/alipayCertPublicKey_RSA2.crt"); |
| | | config.setRootCertPath("pay/pro/alipayRootCert.crt"); |
| | | alipayConfig = config; |
| | | log.info("æ¯ä»å®é
ç½®åå§åæå, appId={}", config.getAppId()); |
| | | } catch (Exception e) { |
| | | log.error("æ¯ä»å®é
ç½®åå§å失败: {}", e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws ApiException { |
| | | downLoadCertificates(); |
| | |
| | | } |
| | | } |
| | | |
| | | public static void testTransger( ) throws ApiException { |
| | | // public static void testTransger( ) throws ApiException { |
| | | // |
| | | // // åå§åSDK |
| | | // ApiClient defaultClient = Configuration.getDefaultApiClient(); |
| | | // // åå§åalipayåæ°ï¼å
¨å±è®¾ç½®ä¸æ¬¡ï¼ |
| | | // defaultClient.setAlipayConfig(getAlipayConfig()); |
| | | // // æé 请æ±åæ°ä»¥è°ç¨æ¥å£ |
| | | // AlipayFundTransUniApi api = new AlipayFundTransUniApi(); |
| | | // AlipayFundTransUniTransferModel data = new AlipayFundTransUniTransferModel(); |
| | | // // 设置åå®¶ä¾§å¯ä¸è®¢åå· |
| | | // data.setOutBizNo("202606300001"); |
| | | // // è®¾ç½®è®¢åæ»éé¢ |
| | | // data.setTransAmount("1"); |
| | | // // 设置æè¿°ç¹å®çä¸å¡åºæ¯ |
| | | // data.setBizScene("DIRECT_TRANSFER"); |
| | | // // 设置ä¸å¡äº§åç |
| | | // data.setProductCode("TRANS_ACCOUNT_NO_PWD"); |
| | | // // 设置转账ä¸å¡çæ é¢ |
| | | // data.setOrderTitle("201905代å"); |
| | | // // è®¾ç½®åæ¯ä»å®ä¸å¡åå· |
| | | // data.setOriginalOrderId("20190620110075000006640000063056"); |
| | | // // è®¾ç½®æ¶æ¬¾æ¹ä¿¡æ¯ |
| | | // Participant payeeInfo = new Participant(); |
| | | // payeeInfo.setIdentity("15345690849"); |
| | | // payeeInfo.setName("æ±è"); |
| | | // payeeInfo.setIdentityType("ALIPAY_LOGON_ID"); |
| | | // data.setPayeeInfo(payeeInfo); |
| | | // // 设置ä¸å¡å¤æ³¨ |
| | | // data.setRemark("201905代å"); |
| | | // // è®¾ç½®è½¬è´¦åºæ¯åç§° |
| | | // data.setTransferSceneName("佣鿥é
¬"); |
| | | // |
| | | // // è®¾ç½®è½¬è´¦åºæ¯ä¸æ¥ä¿¡æ¯ |
| | | // List<TransferSceneReportInfo> transferSceneReportInfos = new ArrayList<TransferSceneReportInfo>(); |
| | | // TransferSceneReportInfo transferSceneReportInfos0 = new TransferSceneReportInfo(); |
| | | // transferSceneReportInfos0.setInfoType("佣鿥é
¬è¯´æ"); |
| | | // transferSceneReportInfos0.setInfoContent("3æå®¶æ¿æå¡æ¥é
¬"); |
| | | // transferSceneReportInfos.add(transferSceneReportInfos0); |
| | | // data.setTransferSceneReportInfos(transferSceneReportInfos); |
| | | // |
| | | // // 设置转账ä¸å¡è¯·æ±çæ©å±åæ° |
| | | // data.setBusinessParams("{\"payer_show_name_use_alias\":\"true\"}"); |
| | | // |
| | | // /* // 设置ç¾åä¿¡æ¯ |
| | | // SignData signData = new SignData(); |
| | | // signData.setOriSign("EqHFP0z4a9iaQ1ep=="); |
| | | // signData.setPartnerId("ç¾åè¢«æææ¹æ¯ä»å®è´¦å·ID"); |
| | | // signData.setOriAppId("2021000185629012"); |
| | | // signData.setOriOutBizNo("åæ·è®¢åå·"); |
| | | // signData.setOriSignType("RSA2"); |
| | | // signData.setOriCharSet("UTF-8"); |
| | | // data.setSignData(signData); |
| | | //*/ |
| | | // try { |
| | | // AlipayFundTransUniTransferResponseModel response = api.transfer(data); |
| | | // } catch (ApiException e) { |
| | | // AlipayFundTransUniTransferDefaultResponse errorObject = (AlipayFundTransUniTransferDefaultResponse) e.getErrorObject(); |
| | | // System.out.println("è°ç¨å¤±è´¥:" + errorObject); |
| | | // } |
| | | // } |
| | | |
| | | // åå§åSDK |
| | | /** |
| | | * åç¬è½¬è´¦å°æ¯ä»å®è´¦æ· |
| | | * |
| | | * @param dto è½¬è´¦åæ° |
| | | * @return æ¯ä»å®è½¬è´¦åå· |
| | | */ |
| | | public static String transfer(AlipayTransferDTO dto) throws ApiException { |
| | | ApiClient defaultClient = Configuration.getDefaultApiClient(); |
| | | // åå§åalipayåæ°ï¼å
¨å±è®¾ç½®ä¸æ¬¡ï¼ |
| | | defaultClient.setAlipayConfig(getAlipayConfig()); |
| | | // æé 请æ±åæ°ä»¥è°ç¨æ¥å£ |
| | | defaultClient.setAlipayConfig(alipayConfig); |
| | | AlipayFundTransUniApi api = new AlipayFundTransUniApi(); |
| | | AlipayFundTransUniTransferModel data = new AlipayFundTransUniTransferModel(); |
| | | // 设置åå®¶ä¾§å¯ä¸è®¢åå· |
| | | data.setOutBizNo("202606300001"); |
| | | data.setOutBizNo(dto.getOutBizNo()); |
| | | // è®¾ç½®è®¢åæ»éé¢ |
| | | data.setTransAmount("1"); |
| | | // 设置æè¿°ç¹å®çä¸å¡åºæ¯ |
| | | data.setOutBizNo(dto.getOutBizNo()); |
| | | data.setTransAmount(dto.getTransAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString()); |
| | | data.setBizScene("DIRECT_TRANSFER"); |
| | | // 设置ä¸å¡äº§åç |
| | | data.setProductCode("TRANS_ACCOUNT_NO_PWD"); |
| | | // 设置转账ä¸å¡çæ é¢ |
| | | data.setOrderTitle("201905代å"); |
| | | data.setOrderTitle("佣鿥é
¬"); |
| | | // è®¾ç½®åæ¯ä»å®ä¸å¡åå· |
| | | data.setOriginalOrderId("20190620110075000006640000063056"); |
| | | // è®¾ç½®æ¶æ¬¾æ¹ä¿¡æ¯ |
| | | data.setOrderTitle("佣鿥é
¬"); |
| | | Participant payeeInfo = new Participant(); |
| | | payeeInfo.setIdentity("15345690849"); |
| | | payeeInfo.setName("æ±è"); |
| | | payeeInfo.setIdentity(dto.getPayeeAccount()); |
| | | payeeInfo.setName(dto.getPayeeName()); |
| | | payeeInfo.setIdentity(dto.getPayeeAccount()); |
| | | payeeInfo.setName(dto.getPayeeName()); |
| | | payeeInfo.setIdentityType("ALIPAY_LOGON_ID"); |
| | | data.setPayeeInfo(payeeInfo); |
| | | // 设置ä¸å¡å¤æ³¨ |
| | | data.setRemark("201905代å"); |
| | | data.setRemark("佣鿥é
¬"); |
| | | // è®¾ç½®è½¬è´¦åºæ¯åç§° |
| | | data.setRemark(dto.getRemark()); |
| | | data.setTransferSceneName("佣鿥é
¬"); |
| | | |
| | | // è®¾ç½®è½¬è´¦åºæ¯ä¸æ¥ä¿¡æ¯ |
| | | List<TransferSceneReportInfo> transferSceneReportInfos = new ArrayList<TransferSceneReportInfo>(); |
| | | TransferSceneReportInfo transferSceneReportInfos0 = new TransferSceneReportInfo(); |
| | | transferSceneReportInfos0.setInfoType("佣鿥é
¬è¯´æ"); |
| | | transferSceneReportInfos0.setInfoContent("3æå®¶æ¿æå¡æ¥é
¬"); |
| | | transferSceneReportInfos0.setInfoContent("佣鿥é
¬"); |
| | | transferSceneReportInfos.add(transferSceneReportInfos0); |
| | | data.setTransferSceneReportInfos(transferSceneReportInfos); |
| | | List<TransferSceneReportInfo> reportInfos = new ArrayList<>(); |
| | | TransferSceneReportInfo reportInfo = new TransferSceneReportInfo(); |
| | | reportInfo.setInfoType("佣鿥é
¬è¯´æ"); |
| | | reportInfo.setInfoContent("佣鿥é
¬"); |
| | | reportInfos.add(reportInfo); |
| | | data.setTransferSceneReportInfos(reportInfos); |
| | | |
| | | // 设置转账ä¸å¡è¯·æ±çæ©å±åæ° |
| | | data.setBusinessParams("{\"payer_show_name_use_alias\":\"true\"}"); |
| | |
| | | */ |
| | | try { |
| | | AlipayFundTransUniTransferResponseModel response = api.transfer(data); |
| | | log.info("æ¯ä»å®è½¬è´¦æå, outBizNo={}, orderId={}", dto.getOutBizNo(), response.getOrderId()); |
| | | return response.getOrderId(); |
| | | } catch (ApiException e) { |
| | | AlipayFundTransUniTransferDefaultResponse errorObject = (AlipayFundTransUniTransferDefaultResponse) e.getErrorObject(); |
| | | System.out.println("è°ç¨å¤±è´¥:" + errorObject); |
| | | log.error("æ¯ä»å®è½¬è´¦å¤±è´¥, outBizNo={}, error={}", dto.getOutBizNo(), errorObject); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), |
| | | "转账失败ï¼" + (errorObject != null ? errorObject.toString() : e.getMessage())); |
| | | } |
| | | } |
| | | |
| | | private static AlipayConfig getAlipayConfig() { |
| | | AlipayConfig alipayConfig = new AlipayConfig(); |
| | | alipayConfig.setServerUrl("https://openapi.alipay.com"); |
| | | alipayConfig.setAppId("2021006147660139"); |
| | | String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDEeqqkZztBHfK+vpyBi6ejgDTHZuZ3yiuXds+lRBbMo/g24F5trH+oLHW0gMhSxihFfQBBIpVBXDsPQK4ZkhDWTaOBktnU1UMRoOEiaaZU6EiWy10ePFUmpdXpkCQEp7rc88OwI90p58S3+L+Ckak60WqNwJBdB5YGBaUunryBA78U4zW1KNY7JvoRnZDcFMQiczikwUzhO7EAi0yVrVpsVsc9s87mcS4uOJKx4qb2E83r9RJ1z30db+cIIZRiLP2oNZBLYzgKpOouE+uI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Z4XcJQgOVu34jicAFx64vPbS/zrddm4iEScSVijRBBAoGAXCheERsx8+n16Us/DttXFUa1nc7+D8WR6buM1QMZgQCVF2qp3XtM+FusCKL4+q1+dtag8svLjJFp9QbaAXqX8Zk7rn8wUHbDloPTPy9XWgrPowyL9MPU+e/Rq8Hr6TWPDBd4TU64YzIEfBQYpJXfZbXhVYmK3o7xHXKB1x4vvEM="; |
| | | alipayConfig.setPrivateKey(privateKey); |
| | | alipayConfig.setAppCertPath("pay/pro/appCertPublicKey.crt"); |
| | | alipayConfig.setAlipayPublicCertPath("pay/pro/alipayCertPublicKey_RSA2.crt"); |
| | | alipayConfig.setRootCertPath("pay/pro/alipayRootCert.crt"); |
| | | |
| | | return alipayConfig; |
| | | } |
| | | // private static AlipayConfig getAlipayConfig() { |
| | | // AlipayConfig alipayConfig = new AlipayConfig(); |
| | | // alipayConfig.setServerUrl("https://openapi.alipay.com"); |
| | | // alipayConfig.setAppId("2021006147660139"); |
| | | // String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDEeqqkZztBHfK+vpyBi6ejgDTHZuZ3yiuXds+lRBbMo/g24F5trH+oLHW0gMhSxihFfQBBIpVBXDsPQK4ZkhDWTaOBktnU1UMRoOEiaaZU6EiWy10ePFUmpdXpkCQEp7rc88OwI90p58S3+L+Ckak60WqNwJBdB5YGBaUunryBA78U4zW1KNY7JvoRnZDcFMQiczikwUzhO7EAi0yVrVpsVsc9s87mcS4uOJKx4qb2E83r9RJ1z30db+cIIZRiLP2oNZBLYzgKpOouE+uIgxhQzlh6cOASNZQulXuUjoT/+Y9w4njfl4TmKIXWcJFKIMc6kMiux9tTncpp0TqRwk1tAgMBAAECggEALkSYtJheusnbpRFr95G0i2sggqh3s1PXihZ/dXKgT9Z5GCsj8X3Cng7CNRxykBN73kk+axhCv56Bhej8Vqcv8ddcnqG/TEBgR+Fzws/QTIRau6/uILWic7RvuE2qPbJl7aw1s9/uL/UVPSGFr7Cv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alipayConfig.setPrivateKey(privateKey); |
| | | // alipayConfig.setAppCertPath("pay/pro/appCertPublicKey.crt"); |
| | | // alipayConfig.setAlipayPublicCertPath("pay/pro/alipayCertPublicKey_RSA2.crt"); |
| | | // alipayConfig.setRootCertPath("pay/pro/alipayRootCert.crt"); |
| | | // |
| | | // return alipayConfig; |
| | | // } |
| | | } |
| | |
| | | waitDeliver(2, "å¾
é
é", new int[]{OrderStatus.accepted.status}), |
| | | waitReceive(3, "å¾
æ¶è´§", new int[]{ OrderStatus.delivering.status, OrderStatus.arrived.status}), |
| | | finished(4, "已宿", new int[]{OrderStatus.finished.status}), |
| | | refund(5, "鿬¾", new int[]{OrderStatus.closed.status, OrderStatus.cancelling.status}) |
| | | refund(5, "鿬¾", new int[]{OrderStatus.closed.status, OrderStatus.cancelling.status}), |
| | | home(6, "é¦é¡µæ¥è¯¢", new int[]{OrderStatus.waitPay.status, OrderStatus.waitDeposit.status, OrderStatus.deposited.status |
| | | , OrderStatus.accepted.status, OrderStatus.delivering.status, OrderStatus.arrived.status}) |
| | | ; |
| | | private final int key; |
| | | private final String desc; |
| | |
| | | } |
| | | |
| | | /** |
| | | * é¦é¡µè®¢åç¶ææç¤ºæä¸¾ |
| | | * status: 订åç¶æå¼ |
| | | * desc: ç¶ææè¿° |
| | | * tipTemplate: æç¤ºææ¡æ¨¡æ¿ï¼å ä½ç¬¦ç¨ {xxx} 表示 |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum OrderStatusTip { |
| | | waitPay(0, "å¾
æ¯ä»", "请å¨{timeout}åéå
宿æ¯ä»ï¼è¶
æ¶è®¢åå°èªå¨åæ¶"), |
| | | waitDeposit(1, "å¾
å¯å", "订åå·²æ¯ä»ï¼è¯·åå¾é¨åºå¯å"), |
| | | deposited(2, "å·²å¯å", null), // å°±å°/å¼å°ææ¡ä¸åï¼å¨æå¤ç |
| | | accepted(3, "å·²æ¥å", "å·²æå¸æºæ¢åï¼æ£åå¾åä»¶å°ç¹"), |
| | | delivering(4, "æ´¾éä¸", "叿ºå·²åä»¶ï¼æ£è¿å¾ç®çå°"), |
| | | arrived(5, "å¾
åä»¶", null), // å°±å°/å¼å°/ææ åä»¶é¨åºææ¡ä¸åï¼å¨æå¤ç |
| | | ; |
| | | |
| | | private final int status; |
| | | private final String desc; |
| | | private final String tipTemplate; |
| | | |
| | | public static OrderStatusTip getByStatus(int status) { |
| | | for (OrderStatusTip t : OrderStatusTip.values()) { |
| | | if (t.status == status) { |
| | | return t; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 订åç«å
ä¿¡éç¥æä¸¾ |
| | | * title: éç¥æ é¢ |
| | | * content: éç¥ææ¡æ¨¡æ¿ï¼å ä½ç¬¦ç¨ {xxx} 表示 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.core.utils; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.InputStream; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * å¾çæ°´å°å·¥å
·ç±» |
| | | * å¨å¾çå·¦ä¸è§å å æ¶é´ + å°åæ°´å° |
| | | * |
| | | * @author rk |
| | | * @date 2026/04/21 |
| | | */ |
| | | @Slf4j |
| | | public class ImageWatermarkUtil { |
| | | |
| | | /** |
| | | * 为å¾çæ·»å æ°´å°ï¼æ¶é´ + å°å + ç»çº¬åº¦ï¼ |
| | | * |
| | | * @param imageInput åå¾è¾å
¥æµ |
| | | * @param timeText æ¶é´ææ¡ï¼å¦ "2026-04-21 14:30:00"ï¼ |
| | | * @param addressText å°åææ¡ï¼å¦ "åäº¬å¸æµ·æ·åºxxxè·¯"ï¼ |
| | | * @param latitude 纬度 |
| | | * @param longitude ç»åº¦ |
| | | * @return æ·»å æ°´å°åçè¾å
¥æµï¼æ°´å°å¤±è´¥æ¶è¿ååå¾ |
| | | */ |
| | | public static InputStream addWatermark(InputStream imageInput, String timeText, String addressText, |
| | | Double latitude, Double longitude) { |
| | | try { |
| | | BufferedImage srcImage = ImageIO.read(imageInput); |
| | | if (srcImage == null) { |
| | | log.warn("æ°´å°: æ æ³è¯»åå¾çï¼è·³è¿æ°´å°å¤ç"); |
| | | imageInput.reset(); |
| | | return imageInput; |
| | | } |
| | | |
| | | int srcWidth = srcImage.getWidth(); |
| | | int srcHeight = srcImage.getHeight(); |
| | | |
| | | // åä½å¤§å°æå¾ç宽度èªéåºï¼çº¦3%ï¼ï¼æå°16px |
| | | int fontSize = Math.max(16, srcWidth * 3 / 100); |
| | | int padding = fontSize; |
| | | int lineHeight = fontSize + fontSize / 3; |
| | | |
| | | // ç»çº¬åº¦è¡ |
| | | String locationText = ""; |
| | | if (latitude != null && longitude != null) { |
| | | locationText = String.format("ç»åº¦:%.6f 纬度:%.6f", longitude, latitude); |
| | | } |
| | | int lineCount = 2 + (locationText.isEmpty() ? 0 : 1); |
| | | |
| | | // è®¡ç®æ°´å°åºåèæ¯é«åº¦ |
| | | int bgHeight = lineHeight * lineCount + padding; |
| | | |
| | | // å建å¾ç |
| | | BufferedImage destImage = new BufferedImage(srcWidth, srcHeight, BufferedImage.TYPE_INT_RGB); |
| | | Graphics2D g2d = destImage.createGraphics(); |
| | | |
| | | // ç»å¶åå¾ |
| | | g2d.drawImage(srcImage, 0, 0, null); |
| | | |
| | | // ç»å¶åéæèæ¯ï¼å·¦ä¸è§ï¼ |
| | | g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); |
| | | g2d.setColor(Color.BLACK); |
| | | g2d.fillRect(0, srcHeight - bgHeight, srcWidth, bgHeight); |
| | | |
| | | // ç»å¶æ°´å°æå |
| | | g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f)); |
| | | g2d.setColor(Color.WHITE); |
| | | Font font = new Font(Font.SANS_SERIF, Font.PLAIN, fontSize); |
| | | g2d.setFont(font); |
| | | |
| | | // å¼å¯æé¯é½¿ |
| | | g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); |
| | | |
| | | int textX = padding; |
| | | int textY = srcHeight - bgHeight + padding + fontSize; |
| | | FontMetrics fm = g2d.getFontMetrics(); |
| | | int maxTextWidth = srcWidth - padding * 2; |
| | | |
| | | // 第ä¸è¡ï¼æ¶é´ |
| | | g2d.drawString(timeText, textX, textY); |
| | | |
| | | // 第äºè¡ï¼å°åï¼å°åè¿é¿æ¶æªæï¼ |
| | | String displayAddr = addressText; |
| | | while (fm.stringWidth(displayAddr) > maxTextWidth && displayAddr.length() > 0) { |
| | | displayAddr = displayAddr.substring(0, displayAddr.length() - 1); |
| | | } |
| | | g2d.drawString(displayAddr, textX, textY + lineHeight); |
| | | |
| | | // 第ä¸è¡ï¼ç»çº¬åº¦ |
| | | if (!locationText.isEmpty()) { |
| | | g2d.drawString(locationText, textX, textY + lineHeight * 2); |
| | | } |
| | | |
| | | g2d.dispose(); |
| | | |
| | | // è¾åºä¸ºåèæµ |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | ImageIO.write(destImage, "jpg", baos); |
| | | return new ByteArrayInputStream(baos.toByteArray()); |
| | | } catch (Exception e) { |
| | | log.error("æ·»å æ°´å°å¤±è´¥ï¼è¿ååå¾", e); |
| | | try { |
| | | imageInput.reset(); |
| | | } catch (Exception ignored) {} |
| | | return imageInput; |
| | | } |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "åæ°2ï¼type ï¼0ï¼= æ¶è´¹åä»· ;type ï¼1ï¼= é
éèµ·æ¥éç¨å
¬éæ° ï¼type ï¼2ï¼= èµ·ééç¨ km ï¼ type (3) = æ¼éï¼type (4) = å°ç¹ç±»åï¼å¯ä»¶ç¹/åä»¶ç¹/åææ¯ä¾ï¼") |
| | | private String fieldB; |
| | | |
| | | @ApiModelProperty(value = "åæ°3ï¼type ï¼1ï¼= é
éèµ·æ¥éç¨æ¯å
¬éåä»· ï¼type (2) = èµ·éæ¶é¿ï¼ type (3) = æ¼éï¼type (4) = åææ¯ä¾") |
| | | @ApiModelProperty(value = "åæ°3ï¼type ï¼1ï¼= é
éèµ·æ¥éç¨æ¯å
¬éåä»· ï¼type (2) = èµ·éæ¶é¿ï¼") |
| | | private String fieldC; |
| | | |
| | | @ApiModelProperty(value = "åæ°4ï¼type=1 è¶
åºé¦åéç¨å
¬éæ° ï¼ type =2 ç»ééç¨ kmï¼") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * é¦é¡µè¿è¡ä¸ææ°è®¢åæç¤ºVO |
| | | * @author rk |
| | | * @date 2026/04/21 |
| | | */ |
| | | @Data |
| | | @ApiModel("é¦é¡µè¿è¡ä¸ææ°è®¢åæç¤º") |
| | | public class ActiveOrderTipVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "订å主é®") |
| | | private Integer orderId; |
| | | |
| | | @ApiModelProperty(value = "订åç¶æ") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "ç¶ææç¤ºææ¡") |
| | | private String tip; |
| | | |
| | | @ApiModelProperty(value = "æ¯ä»åè®¡æ¶æ¯«ç§ï¼ä»
status=0æ¶è¿åï¼-1表示已è¶
æ¶ï¼") |
| | | private Long payCountdown; |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¼åå°åå表ï¼å«çå¸åºä¿¡æ¯ï¼ |
| | | * @param memberId ä¼åä¸»é® |
| | | * @param keyword æ¨¡ç³æç´¢å
³é®è¯ï¼å¹é
å°å/åç§°/ææºå·ï¼ï¼å¯ä¸ºnull |
| | | */ |
| | | List<Addr> findListWithArea(Integer memberId); |
| | | List<Addr> findListWithArea(Integer memberId, String keyword); |
| | | |
| | | /** |
| | | * æ ¹æ®IDæ¥è¯¢å°åï¼å«çå¸åºä¿¡æ¯ï¼ |
| | |
| | | PageData<Notice> findPage(PageWrap<Notice> pageWrap); |
| | | |
| | | long count(Notice notice); |
| | | |
| | | /** |
| | | * æ è®°éç¥ä¸ºå·²è¯» |
| | | * @param id éç¥ä¸»é® |
| | | * @param userId ç¨æ·ä¸»é®ï¼æ ¡éªå½å±ï¼ |
| | | */ |
| | | void readNotice(Integer id, Integer userId); |
| | | |
| | | /** |
| | | * æ è®°è¯¥ç¨æ·ææéç¥ä¸ºå·²è¯» |
| | | * @param userType ç¨æ·ç±»å |
| | | * @param userId ç¨æ·ä¸»é® |
| | | */ |
| | | void readAllNotice(Integer userType, Integer userId); |
| | | |
| | | } |
| | |
| | | import com.doumee.dao.dto.DispatchDTO; |
| | | import com.doumee.dao.dto.CommentOrderDTO; |
| | | import com.doumee.dao.dto.MyOrderDTO; |
| | | import com.doumee.dao.vo.MyOrderDetailVO; |
| | | import com.doumee.dao.vo.MyOrderVO; |
| | | import com.doumee.dao.vo.OrderDetailVO; |
| | | import com.doumee.dao.vo.OrderDispatchVO; |
| | | import com.doumee.dao.vo.OrderSummaryVO; |
| | | import com.doumee.dao.vo.OverdueFeeVO; |
| | | import com.doumee.dao.vo.PayResponse; |
| | | import com.doumee.dao.vo.PriceCalculateVO; |
| | | import com.doumee.dao.vo.EstimatedDeliveryResultVO; |
| | | import com.doumee.dao.vo.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | |
| | | Double fromLat, Double fromLng, |
| | | Double toLat, Double toLng); |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¼åé¦é¡µè¿è¡ä¸ææ°è®¢åæç¤º |
| | | * æ¥è¯¢status in (0,1,2,3,4,5)ç订åï¼æå建æ¶é´ååºåç¬¬ä¸æ¡ |
| | | * |
| | | * @param memberId ä¼åä¸»é® |
| | | * @return ææ°è¿è¡ä¸è®¢åæç¤ºï¼æ 订åè¿ånull |
| | | */ |
| | | ActiveOrderTipVO getActiveOrderTip(Integer memberId); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Addr> findListWithArea(Integer memberId) { |
| | | public List<Addr> findListWithArea(Integer memberId, String keyword) { |
| | | MPJLambdaWrapper<Addr> wrapper = new MPJLambdaWrapper<Addr>() |
| | | .selectAll(Addr.class) |
| | | .select("a3.name", Addr::getDistrictName) |
| | |
| | | .leftJoin("areas a2 on a2.id = a3.PARENT_ID") |
| | | .leftJoin("areas a1 on a1.id = a2.PARENT_ID") |
| | | .eq(Addr::getDeleted, Constants.ZERO) |
| | | .eq(Addr::getMemberId, memberId) |
| | | .orderByDesc(Addr::getIsDefault) |
| | | .eq(Addr::getMemberId, memberId); |
| | | if (StringUtils.isNotBlank(keyword)) { |
| | | wrapper.and(w -> w |
| | | .like(Addr::getAddr, keyword) |
| | | .or().like(Addr::getName, keyword) |
| | | .or().like(Addr::getPhone, keyword)); |
| | | } |
| | | wrapper.orderByDesc(Addr::getIsDefault) |
| | | .orderByDesc(Addr::getCreateTime); |
| | | return addrMapper.selectJoinList(Addr.class, wrapper); |
| | | } |
| | |
| | | member.setReceiveNum(Constants.ZERO.longValue()); |
| | | member.setPublishNum(Constants.ZERO.longValue()); |
| | | member.setAutoReceiveStatus(Constants.ONE); |
| | | member.setUseIdentity(Constants.ZERO); |
| | | member.setUserType(Constants.ZERO); |
| | | memberMapper.insert(member); |
| | | } |
| | | String token = JwtTokenUtil.generateTokenForRedis(member.getId(), Constants.ZERO, JSONObject.toJSONString(member), redisTemplate); |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.NoticeMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * æ¶æ¯éç¥ä¿¡æ¯Serviceå®ç° |
| | |
| | | IPage<Notice> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<Notice> queryWrapper = new QueryWrapper<>(); |
| | | if (pageWrap.getModel() != null) { |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(Notice::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getUserType() != null) { |
| | | queryWrapper.lambda().eq(Notice::getUserType, pageWrap.getModel().getUserType()); |
| | | } |
| | | if (pageWrap.getModel().getUserId() != null) { |
| | | queryWrapper.lambda().eq(Notice::getUserId, pageWrap.getModel().getUserId()); |
| | | } |
| | | if (pageWrap.getModel().getObjType() != null) { |
| | | queryWrapper.lambda().eq(Notice::getObjType, pageWrap.getModel().getObjType()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(Notice::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getTitle() != null) { |
| | | queryWrapper.lambda().like(Notice::getTitle, pageWrap.getModel().getTitle()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(Notice::getCreateDate, pageWrap.getModel().getCreateDate()); |
| | | } |
| | | Notice model = pageWrap.getModel(); |
| | | queryWrapper.lambda().eq(Notice::getIsdeleted,Constants.ZERO); |
| | | queryWrapper.lambda().eq(Objects.nonNull(model.getUserId()),Notice::getUserId,model.getUserId()); |
| | | queryWrapper.lambda().eq(Objects.nonNull(model.getUserType()),Notice::getUserType,model.getUserType()); |
| | | } |
| | | for (PageWrap.SortData sortData : pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | queryWrapper.lambda().orderByAsc(Notice::getStatus).orderByDesc(Notice::getCreateDate); |
| | | return PageData.from(noticeMapper.selectPage(page, queryWrapper)); |
| | | } |
| | | |
| | |
| | | QueryWrapper<Notice> wrapper = new QueryWrapper<>(notice); |
| | | return noticeMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void readNotice(Integer id, Integer userId) { |
| | | Notice notice = noticeMapper.selectById(id); |
| | | if (notice != null && notice.getUserId().equals(userId)) { |
| | | notice.setStatus(Constants.ONE); |
| | | notice.setEditDate(new java.util.Date()); |
| | | noticeMapper.updateById(notice); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void readAllNotice(Integer userType, Integer userId) { |
| | | noticeMapper.update(new UpdateWrapper<Notice>().lambda() |
| | | .set(Notice::getStatus, Constants.ONE) |
| | | .set(Notice::getEditDate, new java.util.Date()) |
| | | .eq(Notice::getUserType, userType) |
| | | .eq(Notice::getUserId, userId) |
| | | .eq(Notice::getStatus, Constants.ZERO) |
| | | .eq(Notice::getIsdeleted, Constants.ZERO)); |
| | | } |
| | | |
| | | } |
| | |
| | | String to = dto.getToLat() + "," + dto.getToLgt(); |
| | | JSONObject distanceResult = MapUtil.direction("driving", from, to); |
| | | BigDecimal distance = distanceResult.getBigDecimal("distance"); |
| | | // distance åä½ä¸ºç±³ï¼è½¬ä¸ºå
Ž |
| | | // distance åä½ä¸ºç±³ï¼è½¬ä¸ºå
¬éï¼ä¸è¶³1å
¬éæ1å
¬é计ç®ï¼ |
| | | BigDecimal distanceKm = distance.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP); |
| | | if (distanceKm.compareTo(BigDecimal.ONE) < 0) { |
| | | distanceKm = BigDecimal.ONE; |
| | | } |
| | | |
| | | // æ¶éææç©åç±»åID |
| | | List<Integer> categoryIds = new ArrayList<>(); |
| | |
| | | |
| | | // ========== 3. æ¥è¯¢å¯ä»¶åºéºä¿¡æ¯ ========== |
| | | ShopInfo depositShop = shopInfoMapper.selectById(dto.getDepositShopId()); |
| | | if (depositShop == null) { |
| | | if (depositShop == null || Constants.equalsInteger(depositShop.getDeleted(), Constants.ONE)) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "å¯ä»¶åºéºä¸åå¨"); |
| | | } |
| | | if (depositShop.getStatus() == null || !Constants.equalsInteger(depositShop.getStatus(), Constants.ZERO)) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "å¯ä»¶åºéºå·²åä¸ï¼è¯·éæ©å
¶ä»é¨åº"); |
| | | } |
| | | |
| | | // ========== 4. 计ç®è´¹ç¨ ========== |
| | |
| | | } |
| | | // åä»¶ç¹ï¼åºéº or èªéç¹ï¼è³å°æä¾ä¸ç» |
| | | if (dto.getTakeShopId() != null) { |
| | | if (dto.getTakeShopId().equals(dto.getDepositShopId())) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "å¼å°å¯å订ååä»¶é¨åºååä»¶é¨åºä¸è½ç¸å"); |
| | | } |
| | | takeShop = shopInfoMapper.selectById(dto.getTakeShopId()); |
| | | if (takeShop == null) { |
| | | if (takeShop == null || Constants.equalsInteger(takeShop.getDeleted(), Constants.ONE)) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "åä»¶åºéºä¸åå¨"); |
| | | } |
| | | if (takeShop.getStatus() == null || !Constants.equalsInteger(takeShop.getStatus(), Constants.ONE)) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "åä»¶åºéºå·²åä¸ï¼è¯·éæ©å
¶ä»é¨åº"); |
| | | } |
| | | takeLat = BigDecimal.valueOf(takeShop.getLatitude()); |
| | | takeLgt = BigDecimal.valueOf(takeShop.getLongitude()); |
| | |
| | | orders.setTakeLat(takeLat); |
| | | orders.setTakeLgt(takeLgt); |
| | | orders.setIsUrgent(dto.getIsUrgent()); |
| | | orders.setDistance(priceResult.getDistance()); |
| | | } else { |
| | | // å°±å°ï¼åä»¶ç¹åå¯ä»¶åºéº |
| | | orders.setTakeShopId(dto.getDepositShopId()); |
| | |
| | | |
| | | // ç©åä¿¡æ¯ |
| | | orders.setGoodType(dto.getGoodType()); |
| | | orders.setGoodLevel(goodTypeCategory.getRelationId()); |
| | | // æ¥è¯¢ç©åçº§å« type = 3 |
| | | Category levelCategory = categoryMapper.selectById(goodTypeCategory.getRelationId()); |
| | | if(Objects.isNull(levelCategory)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°ç©åç级信æ¯ï¼{}"+goodTypeCategory.getName()); |
| | | } |
| | | orders.setGoodLevel(Integer.valueOf(levelCategory.getDetail())); |
| | | // æ¼æ¥ç©åä¿¡æ¯ï¼ç©åç±»ååç§°ã尺寸åç§°*æ°éï¼æ°ç»åç¬¦ä¸²ï¼ |
| | | List<String> goodsParts = new ArrayList<>(); |
| | | for (ItemPriceVO itemVO : priceResult.getItemList()) { |
| | |
| | | } |
| | | orders.setDeclaredFee(priceResult.getInsuranceFee()); |
| | | orders.setPrice(priceResult.getItemPrice()); |
| | | |
| | | // èªé
¬è®¡ç®ä¸å æ¯åå¨ |
| | | calculateAndSetFeeAllocation(orders, depositShop, takeShop); |
| | | |
| | |
| | | .eq(PricingRule::getCityId, cityId) |
| | | .eq(PricingRule::getFieldA, String.valueOf(fieldA)) |
| | | .last("limit 1")); |
| | | if (rule != null && StringUtils.isNotBlank(rule.getFieldC())) { |
| | | return new BigDecimal(rule.getFieldC()); |
| | | if (rule != null && StringUtils.isNotBlank(rule.getFieldB())) { |
| | | // fieldB åå¨çæ¯ç¾åæ¯æ´æ°ï¼å¦15表示15%ï¼ï¼è½¬æ¢ä¸ºå°æ°æ¯ä¾ï¼0.15ï¼ |
| | | return new BigDecimal(rule.getFieldB()).divide(new BigDecimal("100"), 4, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | return BigDecimal.ZERO; |
| | | } |
| | |
| | | order.setPayStatus(Constants.ONE); // å·²æ¯ä» |
| | | order.setPayTime(now); |
| | | order.setWxExternalNo(wxTradeNo); |
| | | order.setPayAmount(order.getTotalAmount()); |
| | | order.setUpdateTime(now); |
| | | // çæä¼åæ ¸éç |
| | | order.setMemberVerifyCode(generateVerifyCode()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ActiveOrderTipVO getActiveOrderTip(Integer memberId) { |
| | | // æ¥è¯¢ç¶æä¸º 0~5 çææ°ä¸æ¡è®¢å |
| | | QueryWrapper<Orders> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("MEMBER_ID", memberId) |
| | | .in("STATUS", 0, 1, 2, 3, 4, 5) |
| | | .orderByDesc("CREATE_TIME") |
| | | .last("LIMIT 1"); |
| | | Orders order = ordersMapper.selectOne(wrapper); |
| | | if (order == null) { |
| | | return null; |
| | | } |
| | | |
| | | ActiveOrderTipVO vo = new ActiveOrderTipVO(); |
| | | vo.setOrderId(order.getId()); |
| | | vo.setStatus(order.getStatus()); |
| | | |
| | | // æå»ºæç¤ºææ¡ |
| | | boolean isLocal = Constants.equalsInteger(order.getType(), Constants.ZERO); |
| | | Integer status = order.getStatus(); |
| | | String tip = null; |
| | | |
| | | if (Constants.equalsInteger(status, Constants.OrderStatus.waitPay.getStatus())) { |
| | | // å¾
æ¯ä»ï¼æç¤ºæ¯ä»åè®¡æ¶ |
| | | String minutes = ""; |
| | | try { |
| | | minutes = operationConfigBiz.getConfig().getAutoCancelTime(); |
| | | } catch (Exception ignored) {} |
| | | tip = "请å¨" + (StringUtils.isNotBlank(minutes) ? minutes : "") + "åéå
宿æ¯ä»ï¼è¶
æ¶è®¢åå°èªå¨åæ¶"; |
| | | |
| | | // è®¡ç®æ¯ä»åè®¡æ¶ |
| | | if (StringUtils.isNotBlank(minutes) && order.getCreateTime() != null) { |
| | | long timeoutMs = Long.parseLong(minutes) * 60 * 1000; |
| | | long deadline = order.getCreateTime().getTime() + timeoutMs; |
| | | long remain = deadline - System.currentTimeMillis(); |
| | | vo.setPayCountdown(remain > 0 ? remain : -1L); |
| | | } else { |
| | | vo.setPayCountdown(-1L); |
| | | } |
| | | } else if (Constants.equalsInteger(status, Constants.OrderStatus.waitDeposit.getStatus())) { |
| | | tip = "订åå·²æ¯ä»ï¼è¯·åå¾é¨åºå¯å"; |
| | | } else if (Constants.equalsInteger(status, Constants.OrderStatus.deposited.getStatus())) { |
| | | tip = isLocal ? "è¡æå·²å¯åï¼è¯·ååä»¶ç å徿å®é¨åºåä»¶" : "é¨åºå·²æ¥åï¼æ£å¨ä¸ºæ¨å®æå件叿º"; |
| | | } else if (Constants.equalsInteger(status, Constants.OrderStatus.accepted.getStatus())) { |
| | | tip = isLocal ? "è¡æå·²å¯åï¼è¯·ååä»¶ç å徿å®é¨åºåä»¶" : "å·²æå¸æºæ¢åï¼æ£åå¾åä»¶å°ç¹"; |
| | | } else if (Constants.equalsInteger(status, Constants.OrderStatus.delivering.getStatus())) { |
| | | tip = "叿ºå·²åä»¶ï¼æ£è¿å¾ç®çå°"; |
| | | } else if (Constants.equalsInteger(status, Constants.OrderStatus.arrived.getStatus())) { |
| | | tip = "è¡æå·²éè¾¾æå¡ç¹ï¼è¯·åæ¶åå¾åä»¶"; |
| | | } |
| | | |
| | | vo.setTip(tip); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public EstimatedDeliveryResultVO calculateEstimatedDelivery(Integer cityId, |
| | | Double fromLat, Double fromLng, |
| | | Double toLat, Double toLng) { |
| | |
| | | |
| | | Date now = new Date(); |
| | | for (StoreDepositItemDTO item : request.getItems()) { |
| | | // å
转å |
| | | String depositFen = String.valueOf(new BigDecimal(item.getDepositAmount()) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(0, BigDecimal.ROUND_HALF_UP) |
| | | .longValue()); |
| | | QueryWrapper<PricingRule> qw = new QueryWrapper<>(); |
| | | qw.lambda() |
| | | .eq(PricingRule::getType, Constants.THREE) |
| | |
| | | PricingRule existing = pricingRuleMapper.selectOne(qw); |
| | | |
| | | if (existing != null) { |
| | | existing.setFieldB(item.getDepositAmount()); |
| | | existing.setFieldB(depositFen); |
| | | existing.setUpdateTime(now); |
| | | pricingRuleMapper.updateById(existing); |
| | | } else { |
| | | PricingRule rule = new PricingRule(); |
| | | rule.setType(Constants.THREE); |
| | | rule.setFieldA(String.valueOf(item.getFieldType())); |
| | | rule.setFieldB(item.getDepositAmount()); |
| | | rule.setFieldB(depositFen); |
| | | rule.setCityId(request.getCityId()); |
| | | rule.setDeleted(Constants.ZERO); |
| | | rule.setCreateTime(now); |
| | |
| | | tencent_key: WE3BZ-HN6WS-ONDOH-62QCV-MNL6F-5NFNE |
| | | |
| | | # é«å¾·å°å¾apikey |
| | | geocode_map_key: 9a62636d82d6c7c2372e57d80f99287c |
| | | geocode_map_key: 9a6c1f0eff2e5aa91989ca9d4c21e262 |
| | | |
| | | |
| | | |
| | |
| | | private AddrService addrService; |
| | | |
| | | @LoginRequired |
| | | @ApiOperation(value = "æ¥è¯¢æçå°åå表", notes = "å°ç¨åºç«¯") |
| | | @ApiOperation(value = "æ¥è¯¢æçå°åå表", notes = "å°ç¨åºç«¯ï¼æ¯ææå°å/åç§°/ææºå·æ¨¡ç³æç´¢") |
| | | @GetMapping("/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "ç¨æ·tokenå¼", required = true), |
| | | @ApiImplicitParam(paramType = "query", dataType = "String", name = "keyword", value = "æç´¢å
³é®è¯ï¼å°å/åç§°/ææºå·ï¼"), |
| | | }) |
| | | public ApiResponse<List<Addr>> list() { |
| | | return ApiResponse.success("æ¥è¯¢æå", addrService.findListWithArea(getMemberId())); |
| | | public ApiResponse<List<Addr>> list(@RequestParam(required = false) String keyword) { |
| | | return ApiResponse.success("æ¥è¯¢æå", addrService.findListWithArea(getMemberId(), keyword)); |
| | | } |
| | | |
| | | @LoginRequired |
| | |
| | | |
| | | import com.doumee.core.annotation.LoginRequired; |
| | | import com.doumee.core.annotation.trace.Trace; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.geocode.MapUtil; |
| | | import com.doumee.dao.business.model.Areas; |
| | | import com.doumee.dao.business.model.Banner; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.Notice; |
| | | import com.doumee.dao.dto.AreasDto; |
| | | import com.doumee.dao.dto.CalculateLocalPriceDTO; |
| | | import com.doumee.dao.dto.CalculateRemotePriceDTO; |
| | | import com.doumee.dao.dto.SameCityCheckDTO; |
| | | import com.doumee.dao.vo.PriceCalculateVO; |
| | | import com.doumee.dao.vo.ActiveOrderTipVO; |
| | | import com.doumee.dao.vo.PlatformAboutVO; |
| | | import com.doumee.service.business.*; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Autowired |
| | | private MemberService memberService; |
| | | |
| | | @Autowired |
| | | private NoticeService noticeService; |
| | | |
| | | @ApiOperation("å
¨é¨åºåæ å½¢æ¥è¯¢") |
| | | @PostMapping("/treeList") |
| | |
| | | return ApiResponse.success("æ¥è¯¢æå", areasService.getOpenedCityByName(cityName)); |
| | | } |
| | | |
| | | @LoginRequired |
| | | @ApiOperation(value = "ä¼åéç¥æ¶æ¯å页", notes = "æªè¯»ä¼å
ï¼æ¶é´ååº") |
| | | @PostMapping("/memberNoticePage") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "ç¨æ·tokenå¼", required = true) |
| | | }) |
| | | public ApiResponse<PageData<Notice>> memberNoticePage(@RequestBody PageWrap<Notice> pageWrap) { |
| | | if (pageWrap.getModel() == null) { |
| | | pageWrap.setModel(new Notice()); |
| | | } |
| | | pageWrap.getModel().setUserId(this.getMemberId()); |
| | | pageWrap.getModel().setUserType(Constants.ZERO); |
| | | return ApiResponse.success("æ¥è¯¢æå", noticeService.findPage(pageWrap)); |
| | | } |
| | | |
| | | |
| | | @LoginRequired |
| | | @ApiOperation(value = "é¦é¡µè¿è¡ä¸è®¢åæç¤º", notes = "è¿åææ°ä¸æ¡è¿è¡ä¸è®¢åçç¶æåæç¤ºææ¡ï¼æ 订åè¿ånull") |
| | | @GetMapping("/getActiveOrderTip") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "ç¨æ·tokenå¼", required = true) |
| | | }) |
| | | public ApiResponse<ActiveOrderTipVO> getActiveOrderTip() { |
| | | return ApiResponse.success("æ¥è¯¢æå", ordersService.getActiveOrderTip(this.getMemberId())); |
| | | } |
| | | |
| | | |
| | | @LoginRequired |
| | | @ApiOperation(value = "ä¼åæ è®°å
¨é¨å·²è¯»", notes = "æ è®°å½åç¨æ·æææªè¯»éç¥ä¸ºå·²è¯»") |
| | | @PostMapping("/memberReadAllNotice") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "ç¨æ·tokenå¼", required = true) |
| | | }) |
| | | public ApiResponse readAllNotice() { |
| | | noticeService.readAllNotice(0, this.getMemberId()); |
| | | return ApiResponse.success("æä½æå"); |
| | | } |
| | | |
| | | |
| | | } |