Commit be5ebbf9bb1442509b100557764099778ba354b6

Authored by 陈威
1 parent f6bc409b
Exists in dev

微信h5支付

backend/base/src/main/java/com/hotent/base/conf/WebSecurityConfig.java
@@ -39,239 +39,241 @@ import java.util.List; @@ -39,239 +39,241 @@ import java.util.List;
39 39
40 @EnableWebSecurity 40 @EnableWebSecurity
41 @Configuration 41 @Configuration
42 -public class WebSecurityConfig extends WebSecurityConfigurerAdapter{  
43 - private static final Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);  
44 - @Resource  
45 - UserDetailsService userDetailsService;  
46 - @Resource  
47 - JwtTokenHandler jwtTokenHandler;  
48 - @Resource  
49 - JwtConfig jwtConfig;  
50 - @Value("${feign.encry.key:feignCallEncry}") 42 +public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  43 + private static final Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
  44 + @Resource
  45 + UserDetailsService userDetailsService;
  46 + @Resource
  47 + JwtTokenHandler jwtTokenHandler;
  48 + @Resource
  49 + JwtConfig jwtConfig;
  50 + @Value("${feign.encry.key:feignCallEncry}")
51 private String encryKey; 51 private String encryKey;
52 - @Value("${hotent.security.ignore.httpUrls:''}")  
53 - String permitAll;  
54 - @Value("${hotent.security.deny.httpUrls:''}")  
55 - String denyAll;  
56 - @Value("${hotent.security.pswd.encoder:}")  
57 - String passwordEncoder; 52 + @Value("${hotent.security.ignore.httpUrls:''}")
  53 + String permitAll;
  54 + @Value("${hotent.security.deny.httpUrls:''}")
  55 + String denyAll;
  56 + @Value("${hotent.security.pswd.encoder:}")
  57 + String passwordEncoder;
58 @Value("${cors.enable:true}") 58 @Value("${cors.enable:true}")
59 Boolean corsEnable; 59 Boolean corsEnable;
60 - @Resource  
61 - JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;  
62 - @Resource  
63 - HtFilterSecurityInterceptor htFilterSecurityInterceptor;  
64 - @Resource  
65 - CustomAccessDeniedHandler customAccessDeniedHandler;  
66 - @Resource  
67 - EipYmlConfig eipYmlConfig;  
68 - @Value("${webjar.context:mvue,front,mobile}")  
69 - private List<String> resourceContext;  
70 - @Autowired  
71 - PortalFeignService portalFeignService;  
72 - @Value("${openApi.prefix:'openApi'}")  
73 - String openApiPre; 60 + @Resource
  61 + JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
  62 + @Resource
  63 + HtFilterSecurityInterceptor htFilterSecurityInterceptor;
  64 + @Resource
  65 + CustomAccessDeniedHandler customAccessDeniedHandler;
  66 + @Resource
  67 + EipYmlConfig eipYmlConfig;
  68 + @Value("${webjar.context:mvue,front,mobile}")
  69 + private List<String> resourceContext;
  70 + @Autowired
  71 + PortalFeignService portalFeignService;
  72 + @Value("${openApi.prefix:'openApi'}")
  73 + String openApiPre;
74 // @Resource 74 // @Resource
75 // List<WebSecurityExtend> webExtends; 75 // List<WebSecurityExtend> webExtends;
76 76
77 - @Override  
78 - protected void configure(AuthenticationManagerBuilder auth) throws Exception {  
79 - auth.userDetailsService(userDetailsService)  
80 - .passwordEncoder(getCustomPasswordEncoder());  
81 - } 77 + @Override
  78 + protected void configure(AuthenticationManagerBuilder auth) throws Exception {
  79 + auth.userDetailsService(userDetailsService)
  80 + .passwordEncoder(getCustomPasswordEncoder());
  81 + }
82 82
83 - /**  
84 - * 获取配置的自定义密码加密类  
85 - * @return  
86 - */  
87 - public PasswordEncoder getCustomPasswordEncoder() {  
88 - CustomPwdEncoder encoder = (CustomPwdEncoder) defaultPasswordEncoderBean();  
89 - if (StringUtil.isNotEmpty(passwordEncoder)) {  
90 - try {  
91 - logger.info("Use config password encoder : " + passwordEncoder);  
92 - PasswordEncoder delegate = (PasswordEncoder) Class.forName(passwordEncoder).newInstance();  
93 - encoder.setDelegateEncoder(delegate);  
94 - } catch (Exception e) {  
95 - logger.error("Create custom password encoder config class["+passwordEncoder+"] failed.");  
96 - }  
97 - }  
98 - return encoder;  
99 - } 83 + /**
  84 + * 获取配置的自定义密码加密类
  85 + *
  86 + * @return
  87 + */
  88 + public PasswordEncoder getCustomPasswordEncoder() {
  89 + CustomPwdEncoder encoder = (CustomPwdEncoder) defaultPasswordEncoderBean();
  90 + if (StringUtil.isNotEmpty(passwordEncoder)) {
  91 + try {
  92 + logger.info("Use config password encoder : " + passwordEncoder);
  93 + PasswordEncoder delegate = (PasswordEncoder) Class.forName(passwordEncoder).newInstance();
  94 + encoder.setDelegateEncoder(delegate);
  95 + } catch (Exception e) {
  96 + logger.error("Create custom password encoder config class[" + passwordEncoder + "] failed.");
  97 + }
  98 + }
  99 + return encoder;
  100 + }
100 101
101 - @Bean  
102 - public WebSecurityExtend emptyExtend() {  
103 - return new WebSecurityEmptyExtend();  
104 - } 102 + @Bean
  103 + public WebSecurityExtend emptyExtend() {
  104 + return new WebSecurityEmptyExtend();
  105 + }
105 106
106 - @Bean  
107 - public PasswordEncoder defaultPasswordEncoderBean() {  
108 - return new CustomPwdEncoder();  
109 - } 107 + @Bean
  108 + public PasswordEncoder defaultPasswordEncoderBean() {
  109 + return new CustomPwdEncoder();
  110 + }
110 111
111 - // 注册后台权限控制器  
112 - @Bean  
113 - public AccessDecisionManager accessDecisionManager() {  
114 - return new HtDecisionManager();  
115 - } 112 + // 注册后台权限控制器
  113 + @Bean
  114 + public AccessDecisionManager accessDecisionManager() {
  115 + return new HtDecisionManager();
  116 + }
116 117
117 - @Bean  
118 - @Override  
119 - public AuthenticationManager authenticationManagerBean() throws Exception {  
120 - return super.authenticationManagerBean();  
121 - } 118 + @Bean
  119 + @Override
  120 + public AuthenticationManager authenticationManagerBean() throws Exception {
  121 + return super.authenticationManagerBean();
  122 + }
122 123
123 - @Override  
124 - protected void configure(HttpSecurity httpSecurity) throws Exception {  
125 - String[] permitAlls = new String[]{};  
126 - String[] denyAlls = new String[]{};  
127 - if(StringUtil.isNotEmpty(permitAll)){  
128 - permitAlls = permitAll.split(",");  
129 - } 124 + @Override
  125 + protected void configure(HttpSecurity httpSecurity) throws Exception {
  126 + String[] permitAlls = new String[]{};
  127 + String[] denyAlls = new String[]{};
  128 + if (StringUtil.isNotEmpty(permitAll)) {
  129 + permitAlls = permitAll.split(",");
  130 + }
130 131
131 - // 将webjar中的resource资源添加到可匿名访问中  
132 - for(String rc : resourceContext) {  
133 - permitAlls = (String[]) ArrayUtils.add(permitAlls, String.format("/%s/**", rc));  
134 - } 132 + // 将webjar中的resource资源添加到可匿名访问中
  133 + for (String rc : resourceContext) {
  134 + permitAlls = (String[]) ArrayUtils.add(permitAlls, String.format("/%s/**", rc));
  135 + }
135 136
136 - if(StringUtil.isNotEmpty(denyAll)){  
137 - denyAlls = denyAll.split(",");  
138 - }  
139 - httpSecurity  
140 - // we don't need CSRF because our token is invulnerable  
141 - .csrf().disable()  
142 - .exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint).and()  
143 - .exceptionHandling().accessDeniedHandler(customAccessDeniedHandler).and()  
144 - // don't create session  
145 - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()  
146 - .authorizeRequests()  
147 - .antMatchers(permitAlls).permitAll()  
148 - .antMatchers(denyAlls).denyAll()  
149 - .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()  
150 - .antMatchers("/auth/**").permitAll()  
151 - .antMatchers("/lpg/auth/**").permitAll()  
152 - .antMatchers("/enterprise/largeScreen/v1/**").permitAll()//企业大屏接口  
153 - // 文件预览相关  
154 - .antMatchers("/index").permitAll()  
155 - .antMatchers("/mobile/v1/**").permitAll()  
156 - .antMatchers("/apiMobile/v1/**").permitAll()  
157 - .antMatchers("/images/**").permitAll()  
158 - .antMatchers("/listFiles").permitAll()  
159 - .antMatchers("/fileUpload").permitAll()  
160 - .antMatchers("/deleteFile").permitAll()  
161 - .antMatchers("/ueditor/**","/apiManager/getToken").permitAll()  
162 - .anyRequest().authenticated()  
163 - .accessDecisionManager(accessDecisionManager()); 137 + if (StringUtil.isNotEmpty(denyAll)) {
  138 + denyAlls = denyAll.split(",");
  139 + }
  140 + httpSecurity
  141 + // we don't need CSRF because our token is invulnerable
  142 + .csrf().disable()
  143 + .exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint).and()
  144 + .exceptionHandling().accessDeniedHandler(customAccessDeniedHandler).and()
  145 + // don't create session
  146 + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
  147 + .authorizeRequests()
  148 + .antMatchers(permitAlls).permitAll()
  149 + .antMatchers(denyAlls).denyAll()
  150 + .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
  151 + .antMatchers("/auth/**").permitAll()
  152 + .antMatchers("/lpg/auth/**").permitAll()
  153 + .antMatchers("/enterprise/largeScreen/v1/**").permitAll()//企业大屏接口
  154 + // 文件预览相关
  155 + .antMatchers("/index").permitAll()
  156 + .antMatchers("/mobile/v1/**").permitAll()
  157 + .antMatchers("/apiMobile/v1/**").permitAll()
  158 + .antMatchers("/images/**").permitAll()
  159 + .antMatchers("/listFiles").permitAll()
  160 + .antMatchers("/fileUpload").permitAll()
  161 + .antMatchers("/deleteFile").permitAll()
  162 + .antMatchers("/ueditor/**", "/apiManager/getToken").permitAll()
  163 + .antMatchers("/user/order/payment/notifyOrder").permitAll()
  164 + .anyRequest().authenticated()
  165 + .accessDecisionManager(accessDecisionManager());
164 166
165 - // Custom JWT based security filter  
166 - JwtAuthorizationTokenFilter authenticationTokenFilter = new JwtAuthorizationTokenFilter(userDetailsService(), jwtTokenHandler, jwtConfig.getHeader(),portalFeignService,openApiPre);  
167 - authenticationTokenFilter.setEncryKey(encryKey);  
168 - authenticationTokenFilter.setEipYmlConfig(eipYmlConfig);  
169 - httpSecurity  
170 - .addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);  
171 - httpSecurity  
172 - .addFilterBefore(htFilterSecurityInterceptor, FilterSecurityInterceptor.class);  
173 - httpSecurity  
174 - .addFilterBefore(corsFilter(), ChannelProcessingFilter.class); 167 + // Custom JWT based security filter
  168 + JwtAuthorizationTokenFilter authenticationTokenFilter = new JwtAuthorizationTokenFilter(userDetailsService(), jwtTokenHandler, jwtConfig.getHeader(), portalFeignService, openApiPre);
  169 + authenticationTokenFilter.setEncryKey(encryKey);
  170 + authenticationTokenFilter.setEipYmlConfig(eipYmlConfig);
  171 + httpSecurity
  172 + .addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
  173 + httpSecurity
  174 + .addFilterBefore(htFilterSecurityInterceptor, FilterSecurityInterceptor.class);
  175 + httpSecurity
  176 + .addFilterBefore(corsFilter(), ChannelProcessingFilter.class);
175 177
176 - // add custom filter 178 + // add custom filter
177 // for (WebSecurityExtend extend : webExtends) { 179 // for (WebSecurityExtend extend : webExtends) {
178 // for (Map.Entry<Class<? extends Filter>, Filter> entry : extend.getCustomBeforeFilter().entrySet()) { 180 // for (Map.Entry<Class<? extends Filter>, Filter> entry : extend.getCustomBeforeFilter().entrySet()) {
179 // httpSecurity.addFilterBefore(entry.getValue(), entry.getKey()); 181 // httpSecurity.addFilterBefore(entry.getValue(), entry.getKey());
180 // } 182 // }
181 // } 183 // }
182 184
183 - // disable page caching  
184 - httpSecurity  
185 - .headers()  
186 - .frameOptions().sameOrigin() // required to set for H2 else H2 Console will be blank.  
187 - .cacheControl();  
188 - } 185 + // disable page caching
  186 + httpSecurity
  187 + .headers()
  188 + .frameOptions().sameOrigin() // required to set for H2 else H2 Console will be blank.
  189 + .cacheControl();
  190 + }
189 191
190 - @Override  
191 - public void configure(WebSecurity web) throws Exception {  
192 - // AuthenticationTokenFilter will ignore the below paths  
193 - web  
194 - .ignoring()  
195 - .antMatchers(  
196 - HttpMethod.POST,  
197 - "/auth",  
198 - "/error",  
199 - "/sys/sysLogs/v1/loginLogs",  
200 - "/sys/sysLogs/v1/saveLogs",  
201 - "/api/user/v1/user/loadUserByUsername",  
202 - "/actuator/cert",  
203 - "/form/formServiceController/v1/getFormAndBoExportXml",  
204 - "/api/twoVerify/v1/twoStepVerify",  
205 - "/api/twoVerify/v1/twoStepVerifyAndBind",  
206 - "/i18n/custom/i18nMessageType/v1/all",  
207 - "/**/bpmRuntimeStartUp"  
208 - )  
209 - .antMatchers(  
210 - HttpMethod.GET,  
211 - "/sso/**",  
212 - "/sys/sysLogsSettings/v1/getSysLogsSettingStatusMap",  
213 - "/sys/sysRoleAuth/v1/getMethodRoleAuth",  
214 - "/system/file/v1/getLogoFile",  
215 - "/system/file/v1/getImage",  
216 - /*"/flow/bpmTaskReminder/v1/executeTaskReminderJob",*/  
217 - "/flow/def/v1/bpmnXml",  
218 - "/file/onlinePreviewController/v1/getFileByPathAndId**",  
219 - "/file/onlinePreviewController/v1/getFileById**",  
220 - "/portal/main/v1/appProperties",  
221 - "/uc/tenantManage/v1/getTenantByCode",  
222 - "/sys/sysProperties/v1/getDecryptBySysSetting",  
223 - "/portal/shorturlManage/v1/getLongUrlByShortUrl",  
224 - "/system/file/v1/downloadFile",  
225 - "/portal/sysExternalUnite/v1/getQrCodeInfo",  
226 - "/portal/sysExternalUnite/v1/getDingtalkIdFromScanCode",  
227 - "/portal/sysExternalUnite/v1/getWxWorkIdFromScanCode",  
228 - "/base/tools/v1/getPublicKey",  
229 - "/portalBizSystem/v1/checkSysCodeAndUri",  
230 - "/instance/client/v1/get",  
231 - "/i18n/custom/i18nMessage/v1/getLangPackage",  
232 - "/task/check",  
233 - "/base/tools/v1/getPinyin"  
234 - )  
235 - // allow anonymous resource requests  
236 - .and()  
237 - .ignoring()  
238 - .antMatchers(  
239 - HttpMethod.GET,  
240 - "/",  
241 - "/error",  
242 - "/*.html",  
243 - "/favicon.ico",  
244 - "/**/*.html",  
245 - "/getPreviewFile/*_*_*", // 附件预览 静态资源  
246 - "/**/*.css",  
247 - "/**/*.js",  
248 - "/**/*.css",  
249 - "/**/*.woff2",  
250 - "/**/*.woff",  
251 - "/**/*.ttf",  
252 - "/**/image"  
253 - )  
254 - .and()  
255 - .ignoring()  
256 - .antMatchers("/v2/api-docs",  
257 - "/swagger-resources/configuration/ui",  
258 - "/swagger-resources",  
259 - "/swagger-resources/configuration/security",  
260 - "/swagger-ui.html",  
261 - "/proxy.stream",  
262 - "/hystrix.stream",  
263 - "/druid/**",  
264 - "/hystrix/**",  
265 - "/actuator/**",  
266 - "/static/**",  
267 - "/public/**",  
268 - "/pdfjs/**",  
269 - "/css/**",  
270 - "/service/**")  
271 - .and().ignoring().antMatchers(eipYmlConfig.getAnonymousUrl().toArray(new String[eipYmlConfig.getAnonymousUrl().size()]));  
272 - ; 192 + @Override
  193 + public void configure(WebSecurity web) throws Exception {
  194 + // AuthenticationTokenFilter will ignore the below paths
  195 + web
  196 + .ignoring()
  197 + .antMatchers(
  198 + HttpMethod.POST,
  199 + "/auth",
  200 + "/error",
  201 + "/sys/sysLogs/v1/loginLogs",
  202 + "/sys/sysLogs/v1/saveLogs",
  203 + "/api/user/v1/user/loadUserByUsername",
  204 + "/actuator/cert",
  205 + "/form/formServiceController/v1/getFormAndBoExportXml",
  206 + "/api/twoVerify/v1/twoStepVerify",
  207 + "/api/twoVerify/v1/twoStepVerifyAndBind",
  208 + "/i18n/custom/i18nMessageType/v1/all",
  209 + "/**/bpmRuntimeStartUp"
  210 + )
  211 + .antMatchers(
  212 + HttpMethod.GET,
  213 + "/sso/**",
  214 + "/sys/sysLogsSettings/v1/getSysLogsSettingStatusMap",
  215 + "/sys/sysRoleAuth/v1/getMethodRoleAuth",
  216 + "/system/file/v1/getLogoFile",
  217 + "/system/file/v1/getImage",
  218 + /*"/flow/bpmTaskReminder/v1/executeTaskReminderJob",*/
  219 + "/flow/def/v1/bpmnXml",
  220 + "/file/onlinePreviewController/v1/getFileByPathAndId**",
  221 + "/file/onlinePreviewController/v1/getFileById**",
  222 + "/portal/main/v1/appProperties",
  223 + "/uc/tenantManage/v1/getTenantByCode",
  224 + "/sys/sysProperties/v1/getDecryptBySysSetting",
  225 + "/portal/shorturlManage/v1/getLongUrlByShortUrl",
  226 + "/system/file/v1/downloadFile",
  227 + "/portal/sysExternalUnite/v1/getQrCodeInfo",
  228 + "/portal/sysExternalUnite/v1/getDingtalkIdFromScanCode",
  229 + "/portal/sysExternalUnite/v1/getWxWorkIdFromScanCode",
  230 + "/base/tools/v1/getPublicKey",
  231 + "/portalBizSystem/v1/checkSysCodeAndUri",
  232 + "/instance/client/v1/get",
  233 + "/i18n/custom/i18nMessage/v1/getLangPackage",
  234 + "/task/check",
  235 + "/base/tools/v1/getPinyin"
  236 + )
  237 + // allow anonymous resource requests
  238 + .and()
  239 + .ignoring()
  240 + .antMatchers(
  241 + HttpMethod.GET,
  242 + "/",
  243 + "/error",
  244 + "/*.html",
  245 + "/favicon.ico",
  246 + "/**/*.html",
  247 + "/getPreviewFile/*_*_*", // 附件预览 静态资源
  248 + "/**/*.css",
  249 + "/**/*.js",
  250 + "/**/*.css",
  251 + "/**/*.woff2",
  252 + "/**/*.woff",
  253 + "/**/*.ttf",
  254 + "/**/image"
  255 + )
  256 + .and()
  257 + .ignoring()
  258 + .antMatchers("/v2/api-docs",
  259 + "/swagger-resources/configuration/ui",
  260 + "/swagger-resources",
  261 + "/swagger-resources/configuration/security",
  262 + "/swagger-ui.html",
  263 + "/proxy.stream",
  264 + "/hystrix.stream",
  265 + "/druid/**",
  266 + "/hystrix/**",
  267 + "/actuator/**",
  268 + "/static/**",
  269 + "/public/**",
  270 + "/pdfjs/**",
  271 + "/css/**",
  272 + "/service/**")
  273 + .and().ignoring().antMatchers(eipYmlConfig.getAnonymousUrl().toArray(new String[eipYmlConfig.getAnonymousUrl().size()]));
  274 + ;
273 275
274 - // 添加扩展的路径过滤 276 + // 添加扩展的路径过滤
275 // for (WebSecurityExtend extend : webExtends) { 277 // for (WebSecurityExtend extend : webExtends) {
276 // web 278 // web
277 // .ignoring() 279 // .ignoring()
@@ -283,29 +285,30 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter{ @@ -283,29 +285,30 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
283 // .ignoring() 285 // .ignoring()
284 // .antMatchers(extend.getIgnoringUrl()); 286 // .antMatchers(extend.getIgnoringUrl());
285 // } 287 // }
286 - } 288 + }
287 289
288 - /**  
289 - * 允许跨域访问的源  
290 - * @return  
291 - */  
292 - @Bean  
293 - public CorsFilter corsFilter() {  
294 - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();  
295 - if(corsEnable){ 290 + /**
  291 + * 允许跨域访问的源
  292 + *
  293 + * @return
  294 + */
  295 + @Bean
  296 + public CorsFilter corsFilter() {
  297 + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
  298 + if (corsEnable) {
296 CorsConfiguration corsConfiguration = new CorsConfiguration(); 299 CorsConfiguration corsConfiguration = new CorsConfiguration();
297 corsConfiguration.addAllowedOrigin("*"); 300 corsConfiguration.addAllowedOrigin("*");
298 corsConfiguration.addAllowedHeader("*"); 301 corsConfiguration.addAllowedHeader("*");
299 corsConfiguration.addAllowedMethod("*"); 302 corsConfiguration.addAllowedMethod("*");
300 source.registerCorsConfiguration("/**", corsConfiguration); 303 source.registerCorsConfiguration("/**", corsConfiguration);
301 } 304 }
302 - return new CorsFilter(source);  
303 - } 305 + return new CorsFilter(source);
  306 + }
304 307
305 - @Bean  
306 - public HtFilterSecurityInterceptor htFilterSecurityInterceptor(AccessDecisionManager accessDecisionManager) throws Exception{  
307 - HtFilterSecurityInterceptor htFilterSecurityInterceptor = new HtFilterSecurityInterceptor();  
308 - htFilterSecurityInterceptor.setAccessDecisionManager(accessDecisionManager);  
309 - return htFilterSecurityInterceptor;  
310 - } 308 + @Bean
  309 + public HtFilterSecurityInterceptor htFilterSecurityInterceptor(AccessDecisionManager accessDecisionManager) throws Exception {
  310 + HtFilterSecurityInterceptor htFilterSecurityInterceptor = new HtFilterSecurityInterceptor();
  311 + htFilterSecurityInterceptor.setAccessDecisionManager(accessDecisionManager);
  312 + return htFilterSecurityInterceptor;
  313 + }
311 } 314 }
backend/lpg-common/src/main/java/com/hotent/lpg/common/enums/DdztEnum.java
@@ -10,6 +10,12 @@ import lombok.Getter; @@ -10,6 +10,12 @@ import lombok.Getter;
10 @Getter 10 @Getter
11 public enum DdztEnum { 11 public enum DdztEnum {
12 12
  13 +
  14 + /**
  15 + * 待支付
  16 + */
  17 + dzf("dzf", "待支付"),
  18 +
13 /** 19 /**
14 * 待配送 20 * 待配送
15 */ 21 */
backend/lpg-common/src/main/java/com/hotent/lpg/common/model/WCzzfpz.java 0 → 100644
@@ -0,0 +1,203 @@ @@ -0,0 +1,203 @@
  1 +package com.hotent.lpg.common.model;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.hotent.base.entity.BaseModel;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableField;
  7 +import java.io.Serializable;
  8 +import io.swagger.annotations.ApiModel;
  9 +import io.swagger.annotations.ApiModelProperty;
  10 +import com.fasterxml.jackson.annotation.JsonProperty;
  11 +/**
  12 + * 厂站支付配置
  13 + *
  14 + * @author cw
  15 + * @since 2024-09-04
  16 + */
  17 +@ApiModel(value="WCzzfpz对象", description="厂站支付配置")
  18 +public class WCzzfpz extends BaseModel<WCzzfpz> {
  19 +
  20 + private static final long serialVersionUID = 1L;
  21 + @ApiModelProperty(value = "主键")
  22 + @TableId(value = "ID_", type = IdType.ASSIGN_ID)
  23 + @JsonProperty("id")
  24 + private String id;
  25 +
  26 + @ApiModelProperty(value = "外键")
  27 + @TableField("REF_ID_")
  28 + @JsonProperty("refId")
  29 + private String refId;
  30 +
  31 + @ApiModelProperty(value = "企业ID")
  32 + @TableField("F_qyID")
  33 + @JsonProperty("fQyid")
  34 + private String fQyid;
  35 +
  36 + @ApiModelProperty(value = "厂站ID")
  37 + @TableField("F_czID")
  38 + @JsonProperty("fCzid")
  39 + private String fCzid;
  40 +
  41 + @ApiModelProperty(value = "企业名称")
  42 + @TableField("F_qymc")
  43 + @JsonProperty("fQymc")
  44 + private String fQymc;
  45 +
  46 + @ApiModelProperty(value = "厂站名称")
  47 + @TableField("F_czmc")
  48 + @JsonProperty("fCzmc")
  49 + private String fCzmc;
  50 +
  51 + @ApiModelProperty(value = "支付类型")
  52 + @TableField("F_zflx")
  53 + @JsonProperty("fZflx")
  54 + private String fZflx;
  55 +
  56 + @ApiModelProperty(value = "应用id")
  57 + @TableField("F_appId")
  58 + @JsonProperty("fAppid")
  59 + private String fAppid;
  60 +
  61 + @ApiModelProperty(value = "商户id")
  62 + @TableField("F_mchId")
  63 + @JsonProperty("fMchid")
  64 + private String fMchid;
  65 +
  66 + @ApiModelProperty(value = "商户密钥")
  67 + @TableField("F_mchKey")
  68 + @JsonProperty("fMchkey")
  69 + private String fMchkey;
  70 +
  71 + @ApiModelProperty(value = "商户证书序列号")
  72 + @TableField("F_certSerialNo")
  73 + @JsonProperty("fCertserialno")
  74 + private String fCertserialno;
  75 +
  76 + @ApiModelProperty(value = "APIv3密钥")
  77 + @TableField("F_apiV3Key")
  78 + @JsonProperty("fApiv3key")
  79 + private String fApiv3key;
  80 +
  81 + @ApiModelProperty(value = "表单数据版本")
  82 + @TableField("F_form_data_rev_")
  83 + @JsonProperty("fFormDataRev")
  84 + private Long fFormDataRev;
  85 +
  86 +
  87 + public String getId() {
  88 + return id;
  89 + }
  90 +
  91 + public void setId(String id) {
  92 + this.id = id;
  93 + }
  94 + public String getRefId() {
  95 + return refId;
  96 + }
  97 +
  98 + public void setRefId(String refId) {
  99 + this.refId = refId;
  100 + }
  101 + public String getFQyid() {
  102 + return fQyid;
  103 + }
  104 +
  105 + public void setFQyid(String fQyid) {
  106 + this.fQyid = fQyid;
  107 + }
  108 + public String getFCzid() {
  109 + return fCzid;
  110 + }
  111 +
  112 + public void setFCzid(String fCzid) {
  113 + this.fCzid = fCzid;
  114 + }
  115 + public String getFQymc() {
  116 + return fQymc;
  117 + }
  118 +
  119 + public void setFQymc(String fQymc) {
  120 + this.fQymc = fQymc;
  121 + }
  122 + public String getFCzmc() {
  123 + return fCzmc;
  124 + }
  125 +
  126 + public void setFCzmc(String fCzmc) {
  127 + this.fCzmc = fCzmc;
  128 + }
  129 + public String getFZflx() {
  130 + return fZflx;
  131 + }
  132 +
  133 + public void setFZflx(String fZflx) {
  134 + this.fZflx = fZflx;
  135 + }
  136 + public String getFAppid() {
  137 + return fAppid;
  138 + }
  139 +
  140 + public void setFAppid(String fAppid) {
  141 + this.fAppid = fAppid;
  142 + }
  143 + public String getFMchid() {
  144 + return fMchid;
  145 + }
  146 +
  147 + public void setFMchid(String fMchid) {
  148 + this.fMchid = fMchid;
  149 + }
  150 + public String getFMchkey() {
  151 + return fMchkey;
  152 + }
  153 +
  154 + public void setFMchkey(String fMchkey) {
  155 + this.fMchkey = fMchkey;
  156 + }
  157 + public String getFCertserialno() {
  158 + return fCertserialno;
  159 + }
  160 +
  161 + public void setFCertserialno(String fCertserialno) {
  162 + this.fCertserialno = fCertserialno;
  163 + }
  164 + public String getFApiv3key() {
  165 + return fApiv3key;
  166 + }
  167 +
  168 + public void setFApiv3key(String fApiv3key) {
  169 + this.fApiv3key = fApiv3key;
  170 + }
  171 + public Long getFFormDataRev() {
  172 + return fFormDataRev;
  173 + }
  174 +
  175 + public void setFFormDataRev(Long fFormDataRev) {
  176 + this.fFormDataRev = fFormDataRev;
  177 + }
  178 +
  179 +
  180 + @Override
  181 + protected Serializable pkVal() {
  182 + return this.id;
  183 + }
  184 +
  185 + @Override
  186 + public String toString() {
  187 + return "WCzzfpz{" +
  188 + "id=" + id +
  189 + ", refId=" + refId +
  190 + ", fQyid=" + fQyid +
  191 + ", fCzid=" + fCzid +
  192 + ", fQymc=" + fQymc +
  193 + ", fCzmc=" + fCzmc +
  194 + ", fZflx=" + fZflx +
  195 + ", fAppid=" + fAppid +
  196 + ", fMchid=" + fMchid +
  197 + ", fMchkey=" + fMchkey +
  198 + ", fCertserialno=" + fCertserialno +
  199 + ", fApiv3key=" + fApiv3key +
  200 + ", fFormDataRev=" + fFormDataRev +
  201 + "}";
  202 + }
  203 +}
backend/lpg-common/src/main/java/com/hotent/lpg/common/model/WDd.java
@@ -53,11 +53,6 @@ public class WDd extends BaseModel&lt;WDd&gt; { @@ -53,11 +53,6 @@ public class WDd extends BaseModel&lt;WDd&gt; {
53 @JsonProperty("fDdly") 53 @JsonProperty("fDdly")
54 private String fDdly; 54 private String fDdly;
55 55
56 - @ApiModelProperty(value = "支付方式")  
57 - @TableField("F_zffs")  
58 - @JsonProperty("fZffs")  
59 - private String fZffs;  
60 -  
61 @ApiModelProperty(value = "配送方式") 56 @ApiModelProperty(value = "配送方式")
62 @TableField("F_psfs") 57 @TableField("F_psfs")
63 @JsonProperty("fPsfs") 58 @JsonProperty("fPsfs")
@@ -244,6 +239,36 @@ public class WDd extends BaseModel&lt;WDd&gt; { @@ -244,6 +239,36 @@ public class WDd extends BaseModel&lt;WDd&gt; {
244 @JsonProperty("fShdzwd") 239 @JsonProperty("fShdzwd")
245 private String fShdzwd; 240 private String fShdzwd;
246 241
  242 +// 微信,现金,支付宝
  243 + @ApiModelProperty(value = "支付方式")
  244 + @TableField("F_zffs")
  245 + @JsonProperty("fZffs")
  246 + private String fZffs;
  247 +
  248 +
  249 + // 是,否
  250 + @ApiModelProperty(value = "是否支付")
  251 + @TableField("F_sfzf")
  252 + @JsonProperty("fSfzf")
  253 + private String fSfzf;
  254 +
  255 + @ApiModelProperty(value = "付款时间")
  256 + @TableField("F_fksj")
  257 + @JsonProperty("fFksj")
  258 + private LocalDateTime fFksj;
  259 +
  260 +// APP,NATIVE,JSAPI,MWEB
  261 + @ApiModelProperty(value = "支付类型")
  262 + @TableField("F_zflx")
  263 + @JsonProperty("fZflx")
  264 + private String fZflx;
  265 +
  266 + @ApiModelProperty(value = "支付单号(微信返回)")
  267 + @TableField("F_zfdh")
  268 + @JsonProperty("fZfdh")
  269 + private String fZfdh;
  270 +
  271 +
247 /** 272 /**
248 * 订单详情 273 * 订单详情
249 */ 274 */
backend/lpg-user/src/main/java/com/hotent/lpg/user/controller/PaymentController.java
1 package com.hotent.lpg.user.controller; 1 package com.hotent.lpg.user.controller;
2 2
  3 +import cn.hutool.core.bean.BeanUtil;
  4 +import com.hotent.base.model.CommonResult;
  5 +import com.hotent.lpg.common.enums.DdlyEnum;
  6 +import com.hotent.lpg.common.enums.DdztEnum;
  7 +import com.hotent.lpg.common.enums.UserlxEnum;
  8 +import com.hotent.lpg.common.model.WDd;
  9 +import com.hotent.lpg.common.model.WHydz;
  10 +import com.hotent.lpg.common.model.WHyxx;
  11 +import com.hotent.lpg.user.dao.HydzDao;
  12 +import com.hotent.lpg.user.dto.DdDto;
3 import com.hotent.lpg.user.enums.PayTypeEnum; 13 import com.hotent.lpg.user.enums.PayTypeEnum;
  14 +import com.hotent.lpg.user.manager.DdManager;
  15 +import com.hotent.lpg.user.manager.HyxxManager;
4 import com.hotent.lpg.user.manager.PaymentManage; 16 import com.hotent.lpg.user.manager.PaymentManage;
5 import com.hotent.lpg.user.vo.ResultData; 17 import com.hotent.lpg.user.vo.ResultData;
  18 +import com.hotent.uc.util.ContextUtil;
  19 +import io.swagger.annotations.ApiOperation;
  20 +import io.swagger.annotations.ApiParam;
6 import lombok.AllArgsConstructor; 21 import lombok.AllArgsConstructor;
7 import lombok.extern.slf4j.Slf4j; 22 import lombok.extern.slf4j.Slf4j;
  23 +import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.validation.annotation.Validated; 24 import org.springframework.validation.annotation.Validated;
9 import org.springframework.web.bind.annotation.*; 25 import org.springframework.web.bind.annotation.*;
10 26
  27 +import javax.annotation.Resource;
  28 +import java.util.HashMap;
  29 +
11 @RestController 30 @RestController
12 -@RequestMapping("/payment/v1/") 31 +@RequestMapping("/user/order/payment/")
13 @AllArgsConstructor 32 @AllArgsConstructor
14 @Validated 33 @Validated
15 @Slf4j 34 @Slf4j
16 public class PaymentController { 35 public class PaymentController {
17 private final PaymentManage paymentManage; 36 private final PaymentManage paymentManage;
18 37
19 - /**  
20 - * 预支付  
21 - * @param ddid  
22 - * @return  
23 - */  
24 - @PostMapping("/{ddid}")  
25 - public ResultData pay(@PathVariable("ddid") String ddid) {  
26 - String payType = PayTypeEnum.WX.getName(); // 默认微信  
27 - return paymentManage.pay(ddid, payType); 38 + private final DdManager wDdManager;
  39 + private final HydzDao hydzDao;
  40 + private final HyxxManager wHyxxManager;
  41 +// /**
  42 +// * 预支付
  43 +// * @param ddid
  44 +// * @return
  45 +// */
  46 +// @PostMapping("/{ddid}")
  47 +// public ResultData pay(@PathVariable("ddid") String ddid) {
  48 +// String payType = PayTypeEnum.WX.getName(); // 默认微信
  49 +// return paymentManage.pay(ddid, payType);
  50 +// }
  51 +
  52 +
  53 + @PostMapping(value = "/add")
  54 + @ApiOperation(value = "创建订单", httpMethod = "POST", notes = "创建订单")
  55 + public CommonResult createOrder(@ApiParam(name = "CreateOrderRequest", value = "创建订单请求对象", required = true) @RequestBody DdDto ddDto) throws Exception {
  56 + log.warn("创建订单1:{}", ddDto);
  57 + WHydz hydz = hydzDao.selectOneByHyIdAndDzId(ContextUtil.getCurrentUserId(), ddDto.getHydzId());
  58 + if (BeanUtil.isEmpty(hydz)){
  59 + throw new RuntimeException("未查询到地址信息。");
  60 + }
  61 + WHyxx hyxx = wHyxxManager.getUseridByInfo(ContextUtil.getCurrentUserId());
  62 + if (BeanUtil.isEmpty(hyxx)){
  63 + throw new RuntimeException("未查询会员信息。");
  64 + }
  65 + ddDto.setShlxr(hydz.getFLxr());
  66 + ddDto.setShlxrdh(hydz.getFLxrdh());
  67 + ddDto.setShsf(hydz.getFLxrsf());
  68 + ddDto.setShs(hydz.getFLxrs());
  69 + ddDto.setShq(hydz.getFLxrq());
  70 + ddDto.setShjd(hydz.getFLxrjd());
  71 + ddDto.setShxxdz(hydz.getFLxrxxdz());
  72 + ddDto.setJd(hydz.getFJd());
  73 + ddDto.setWd(hydz.getFWd());
  74 +
  75 + ddDto.setSfhy("是");
  76 + ddDto.setHydh(hyxx.getFSjh()); //账号就是电话
  77 + ddDto.setHyid(hyxx.getFUserid());
  78 + ddDto.setHymc(hyxx.getFXm());
  79 + ddDto.setHylx(hyxx.getFHylx());
  80 + ddDto.setSfzh(hyxx.getFSfzh());
  81 + ddDto.setShtysbm(hyxx.getFShtysbm());
  82 +
  83 + ddDto.setXdrlx(UserlxEnum.hy.getInfo());
  84 + ddDto.setXdrid(ContextUtil.getCurrentUserId());
  85 + ddDto.setXdrmc(ContextUtil.getCurrentUser().getFullname());
  86 + ddDto.setDdly(DdlyEnum.xsxd.getInfo());
  87 + ddDto.setDdzt(DdztEnum.dzf.getInfo());
  88 + WDd order = wDdManager.addOrder(ddDto);
  89 + log.warn("创建订单2:{}", order);
  90 + HashMap<String,Object> resultData = paymentManage.wxPay(order);
  91 + log.warn("创建订单3:{}", resultData);
  92 + return CommonResult.ok().value(resultData);
28 } 93 }
29 94
  95 +
  96 +
  97 +
  98 +
30 /** 99 /**
31 * 支付回调 100 * 支付回调
32 * @return 101 * @return
33 */ 102 */
34 - @PostMapping("/notify-order") 103 + @PostMapping("/notifyOrder")
35 public String notifyOrder(@RequestBody String xmlData) { 104 public String notifyOrder(@RequestBody String xmlData) {
36 log.warn("支付回调:{}", xmlData); 105 log.warn("支付回调:{}", xmlData);
37 String res = paymentManage.notifyOrder(xmlData); 106 String res = paymentManage.notifyOrder(xmlData);
38 - log.warn("处理状态:{}", res);  
39 - return res; 107 + log.warn("处理状态:{}", xmlData);
  108 + return xmlData;
40 } 109 }
41 } 110 }
backend/lpg-user/src/main/java/com/hotent/lpg/user/dao/CzzfpzDao.java 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +package com.hotent.lpg.user.dao;
  2 +
  3 +import com.hotent.lpg.common.model.WCzzfpz;
  4 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +
  6 +/**
  7 + * 厂站支付配置 Mapper 接口
  8 + *
  9 + * @author cw
  10 + * @since 2024-09-04
  11 + */
  12 +public interface CzzfpzDao extends BaseMapper<WCzzfpz> {
  13 +
  14 +}
backend/lpg-user/src/main/java/com/hotent/lpg/user/dto/DdDto.java
@@ -124,6 +124,21 @@ public class DdDto { @@ -124,6 +124,21 @@ public class DdDto {
124 */ 124 */
125 private String wd; 125 private String wd;
126 126
  127 + /**
  128 + * 维度
  129 + */
  130 + private String ddzt;
  131 +
  132 +
  133 + /**
  134 + * 支付方式(微信,现金,支付宝)
  135 + */
  136 + private String zffs;
  137 +
  138 + /**
  139 + * 支付类型(APP,NATIVE,JSAPI,MWEB)
  140 + */
  141 + private String zflx;
127 142
128 143
129 /** 144 /**
@@ -146,5 +161,8 @@ public class DdDto { @@ -146,5 +161,8 @@ public class DdDto {
146 @NotNull(message = "数量不能为空") 161 @NotNull(message = "数量不能为空")
147 private Integer sl; 162 private Integer sl;
148 } 163 }
  164 +
  165 +
  166 +
149 } 167 }
150 168
backend/lpg-user/src/main/java/com/hotent/lpg/user/manager/CzzfpzManager.java 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +package com.hotent.lpg.user.manager;
  2 +
  3 +import com.hotent.lpg.common.model.WCzzfpz;
  4 +import com.hotent.base.manager.BaseManager;
  5 +
  6 +/**
  7 + * 厂站支付配置 服务类
  8 + *
  9 + * @author cw
  10 + * @since 2024-09-04
  11 + */
  12 +public interface CzzfpzManager extends BaseManager<WCzzfpz> {
  13 + /**
  14 + * 根据主键获取详情
  15 + * @param id
  16 + * @return
  17 + */
  18 + WCzzfpz getDetail(String id);
  19 + /**
  20 + * 新建、更新厂站支付配置
  21 + * @param wCzzfpz
  22 + * @return
  23 + */
  24 + void createOrUpdate(WCzzfpz wCzzfpz);
  25 +}
backend/lpg-user/src/main/java/com/hotent/lpg/user/manager/DdManager.java
@@ -52,4 +52,12 @@ public interface DdManager extends BaseManager&lt;WDd&gt; { @@ -52,4 +52,12 @@ public interface DdManager extends BaseManager&lt;WDd&gt; {
52 DdxxVo getOrderByid(String oracleId); 52 DdxxVo getOrderByid(String oracleId);
53 53
54 54
  55 + /**
  56 + * 创建订单
  57 + * @param ddDto
  58 + * @return
  59 + */
  60 + WDd addOrder(DdDto ddDto);
  61 +
  62 +
55 } 63 }
backend/lpg-user/src/main/java/com/hotent/lpg/user/manager/PaymentManage.java
1 package com.hotent.lpg.user.manager; 1 package com.hotent.lpg.user.manager;
2 2
3 3
  4 +import com.hotent.lpg.common.model.WDd;
4 import com.hotent.lpg.user.vo.ResultData; 5 import com.hotent.lpg.user.vo.ResultData;
5 6
  7 +import java.util.HashMap;
  8 +
6 public interface PaymentManage { 9 public interface PaymentManage {
7 - ResultData pay(String ddid, String payType); 10 +// ResultData pay(String ddid, String payType);
8 11
9 String notifyOrder(String xmlData); 12 String notifyOrder(String xmlData);
  13 +
  14 + HashMap<String,Object> wxPay(WDd order);
  15 +
10 } 16 }
backend/lpg-user/src/main/java/com/hotent/lpg/user/manager/impl/DdManagerImpl.java
@@ -196,4 +196,72 @@ public class DdManagerImpl extends BaseManagerImpl&lt;DdDao, WDd&gt; implements DdMana @@ -196,4 +196,72 @@ public class DdManagerImpl extends BaseManagerImpl&lt;DdDao, WDd&gt; implements DdMana
196 ddxxVo.setMcazsj(BeanUtil.isEmpty(wHyyqjl) ? null : wHyyqjl.getFCjsj()); 196 ddxxVo.setMcazsj(BeanUtil.isEmpty(wHyyqjl) ? null : wHyyqjl.getFCjsj());
197 return ddxxVo; 197 return ddxxVo;
198 } 198 }
  199 +
  200 + @Override
  201 + public WDd addOrder(DdDto ddDto) {
  202 + WQplx qplx = qplxDao.selectById(ddDto.getXqList().get(0).getQplxId());
  203 + WDd dd = new WDd();
  204 + dd.setId(idGenerator.getSuid());
  205 + dd.setFSfhy(ddDto.getSfhy());
  206 + dd.setFHyyhid(ddDto.getHyid());
  207 + dd.setFHymc(ddDto.getHymc());
  208 + dd.setFHylx(ddDto.getHylx());
  209 + dd.setFHydh(ddDto.getHydh());
  210 + dd.setFShtysbm(ddDto.getShtysbm());
  211 + dd.setFSfzh(ddDto.getSfzh());
  212 + dd.setFDdlx(null);
  213 + dd.setFDddh(idGenerator.getSuid());
  214 + dd.setFDdly(ddDto.getDdly());
  215 + dd.setFZffs(ddDto.getZffs());
  216 + dd.setFZflx(ddDto.getZflx());
  217 + dd.setFSfzf("否");
  218 + dd.setFPsfs(ddDto.getPsfs());
  219 + dd.setFDdzt(StringUtil.isEmail(ddDto.getDdzt())?DdztEnum.dps.getInfo():ddDto.getDdzt());
  220 + dd.setFMjly(ddDto.getMjly());
  221 + dd.setFBz(ddDto.getBz());
  222 + dd.setFCzid(qplx.getfSsczid());
  223 + dd.setFCzmc(qplx.getfSsczmc());
  224 + dd.setFQyid(qplx.getfSsqyid());
  225 + dd.setFXdrlx(ddDto.getXdrlx());
  226 + dd.setFXdrid(ddDto.getXdrid());
  227 + dd.setFXdrmc(ddDto.getXdrmc());
  228 + dd.setFShlxr(ddDto.getShlxr());
  229 + dd.setFShlxrdh(ddDto.getShlxrdh());
  230 + dd.setFShsf(ddDto.getShsf());
  231 + dd.setFShs(ddDto.getShs());
  232 + dd.setFShq(ddDto.getShq());
  233 + dd.setFShjd(ddDto.getShjd());
  234 + dd.setFShxxdz(ddDto.getShxxdz());
  235 + dd.setFCjr(ContextUtil.getCurrentUser().getFullname());
  236 + dd.setFCjsj(LocalDateTime.now());
  237 + dd.setFGxr(ContextUtil.getCurrentUser().getFullname());
  238 + dd.setFGxsj(LocalDateTime.now());
  239 + dd.setFShdzjd(ddDto.getJd());
  240 + dd.setFShdzwd(ddDto.getWd());
  241 + BigDecimal ddje = new BigDecimal(0);
  242 + List<WDdxq> ddxqList = new ArrayList<WDdxq>();
  243 + for (DdDto.XqVO xqVO : ddDto.getXqList()) {
  244 + WQplx wQplx = qplxDao.selectById(xqVO.getQplxId());
  245 + if (ObjectUtil.isNull(wQplx)) {
  246 + throw new RuntimeException("商品信息不存在");
  247 + }
  248 + ddje = NumberUtil.add(ddje, NumberUtil.mul(wQplx.getfJg(), xqVO.getSl()));
  249 + WDdxq ddxq = new WDdxq();
  250 + ddxq.setfDdid(dd.getId());
  251 + ddxq.setfQplxid(wQplx.getId());
  252 + ddxq.setfSpmc(wQplx.getfMc());
  253 + ddxq.setfTp(wQplx.getfTp());
  254 + ddxq.setfSl(BigDecimal.valueOf(xqVO.getSl()));
  255 + ddxq.setfDj(wQplx.getfJg());
  256 + ddxq.setfMs(wQplx.getfMs());
  257 + ddxqDao.insert(ddxq);
  258 + ddxqList.add(ddxq);
  259 + }
  260 + dd.setFDdje(ddje);
  261 + dd.setDdxqList(ddxqList);
  262 + baseMapper.insert(dd);
  263 + //添加服务日志
  264 + wDdfwrzManager.insertDdfwrz(DdfwlxEnum.cjdd.getCode(), dd.getId());
  265 + return dd;
  266 + }
199 } 267 }
backend/lpg-user/src/main/java/com/hotent/lpg/user/manager/impl/PaymentManageImpl.java
@@ -3,14 +3,20 @@ package com.hotent.lpg.user.manager.impl; @@ -3,14 +3,20 @@ package com.hotent.lpg.user.manager.impl;
3 import cn.hutool.core.util.RandomUtil; 3 import cn.hutool.core.util.RandomUtil;
4 import cn.hutool.core.util.StrUtil; 4 import cn.hutool.core.util.StrUtil;
5 import com.alibaba.fastjson.JSONObject; 5 import com.alibaba.fastjson.JSONObject;
  6 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  7 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse; 8 import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
7 import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; 9 import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
8 import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; 10 import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
  11 +import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult;
9 import com.github.binarywang.wxpay.exception.WxPayException; 12 import com.github.binarywang.wxpay.exception.WxPayException;
10 import com.github.binarywang.wxpay.service.WxPayService; 13 import com.github.binarywang.wxpay.service.WxPayService;
11 14
12 import com.hotent.base.util.BeanUtils; 15 import com.hotent.base.util.BeanUtils;
  16 +import com.hotent.lpg.common.model.WCzzfpz;
13 import com.hotent.lpg.common.model.WDd; 17 import com.hotent.lpg.common.model.WDd;
  18 +import com.hotent.lpg.common.model.WQpxx;
  19 +import com.hotent.lpg.user.dao.CzzfpzDao;
14 import com.hotent.lpg.user.dao.DdDao; 20 import com.hotent.lpg.user.dao.DdDao;
15 import com.hotent.lpg.user.enums.PayTypeEnum; 21 import com.hotent.lpg.user.enums.PayTypeEnum;
16 import com.hotent.lpg.user.manager.PaymentManage; 22 import com.hotent.lpg.user.manager.PaymentManage;
@@ -21,9 +27,23 @@ import lombok.AllArgsConstructor; @@ -21,9 +27,23 @@ import lombok.AllArgsConstructor;
21 import lombok.extern.slf4j.Slf4j; 27 import lombok.extern.slf4j.Slf4j;
22 import org.springframework.stereotype.Service; 28 import org.springframework.stereotype.Service;
23 import org.springframework.transaction.annotation.Transactional; 29 import org.springframework.transaction.annotation.Transactional;
  30 +import org.w3c.dom.Document;
  31 +import org.w3c.dom.Element;
  32 +import org.w3c.dom.Node;
  33 +import org.xml.sax.InputSource;
24 34
  35 +import javax.xml.parsers.DocumentBuilder;
  36 +import javax.xml.parsers.DocumentBuilderFactory;
  37 +import javax.xml.transform.Transformer;
  38 +import javax.xml.transform.TransformerFactory;
  39 +import javax.xml.transform.dom.DOMSource;
  40 +import javax.xml.transform.stream.StreamResult;
  41 +import java.io.StringReader;
  42 +import java.io.StringWriter;
25 import java.math.BigDecimal; 43 import java.math.BigDecimal;
  44 +import java.sql.Wrapper;
26 import java.time.LocalDateTime; 45 import java.time.LocalDateTime;
  46 +import java.util.HashMap;
27 47
28 @Service 48 @Service
29 @Transactional 49 @Transactional
@@ -31,110 +51,163 @@ import java.time.LocalDateTime; @@ -31,110 +51,163 @@ import java.time.LocalDateTime;
31 @Slf4j 51 @Slf4j
32 public class PaymentManageImpl implements PaymentManage { 52 public class PaymentManageImpl implements PaymentManage {
33 private final DdDao ddDao; 53 private final DdDao ddDao;
34 - 54 + private final CzzfpzDao czzfpzDao;
35 @Override 55 @Override
36 - public ResultData pay(String ddid, String payType) { 56 + public String notifyOrder(String xmlData) {
  57 + // 从 XML 数据中提取支付单号
  58 + String outTradeNo = extractValueFromXML(xmlData, "out_trade_no");
  59 + //先用订单号找到订单
  60 + WDd wDd = ddDao.selectOne(new LambdaQueryWrapper<WDd>().eq(WDd::getFDddh, outTradeNo));
  61 + //在用 场站信息 拿到场站对应得支付配置
  62 + WCzzfpz wCzzfpz = czzfpzDao.selectOne(Wrappers.<WCzzfpz>lambdaQuery().eq(WCzzfpz::getFCzid, wDd.getFCzid()).eq(WCzzfpz::getFZflx, wDd.getFZffs()));
  63 + WxPayService wxPayService = WxPayConfiguration.getPayService(wCzzfpz);
  64 + //下面依旧是走微信sdk,查询订单和验证订单,为了保证数据得安全性,还是重复验证一次
  65 + String dddh = null;
  66 + try {
  67 + WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);
  68 + // 获取订单编号
  69 + dddh = notifyResult.getOutTradeNo();
  70 + // 获取微信支付单号
  71 + String transactionId = notifyResult.getTransactionId();
  72 + wDd = ddDao.selectOne(new LambdaQueryWrapper<WDd>().eq(WDd::getFDddh, dddh));
  73 + if (wDd == null) {
  74 + log.warn("订单不存在: {}", dddh);
  75 + return generateXmlResponse("FAIL", "订单不存在", dddh);
  76 + }
  77 + // 检查订单状态是否已支付
  78 + if ("已支付".equals(wDd.getFDdzt())) {
  79 + log.warn("订单 {} 已经处理过,忽略本次通知", dddh);
  80 + return generateXmlResponse("SUCCESS", "已处理过", dddh);
  81 + }
  82 + BigDecimal payPrice = wDd.getFDdje();
  83 + if (payPrice.multiply(new BigDecimal(100)).intValue() != notifyResult.getTotalFee()) {
  84 + log.warn("付款金额与订单金额不等: {}", dddh);
  85 + return generateXmlResponse("FAIL", "付款金额与订单金额不等", dddh);
  86 + }
  87 +
  88 + String timeEnd = notifyResult.getTimeEnd();
  89 + LocalDateTime paymentTime = LocalDateTimeUtils.parse(timeEnd);
  90 + wDd.setFFksj(paymentTime);
  91 + wDd.setFSfzf("是");
  92 + wDd.setFDdzt("待配送");
  93 + wDd.setFZfdh(transactionId);
  94 + ddDao.updateById(wDd);
37 95
38 - WDd wDd = ddDao.selectById(ddid);  
39 - if (BeanUtils.isEmpty(wDd)) {  
40 - return ResultData.error("订单不存在"); 96 + log.info("订单支付成功: {}", dddh);
  97 + return generateXmlResponse("SUCCESS", "成功", dddh);
  98 + } catch (WxPayException e) {
  99 + log.error("支付回调处理失败: {}", e.getErrCodeDes(), e);
  100 + return generateXmlResponse("FAIL", e.getErrCodeDes(), dddh);
41 } 101 }
42 - if (payType.equals(PayTypeEnum.WX.getName())) {  
43 - wDd.setFZffs(PayTypeEnum.WX.getName());  
44 - return wxPay(wDd); 102 + }
  103 +
  104 +
  105 + private String extractValueFromXML(String xmlData, String paramName) {
  106 + // 解析 XML 数据以提取指定参数的值
  107 + try {
  108 + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
  109 + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
  110 + InputSource is = new InputSource(new StringReader(xmlData));
  111 + Document doc = dBuilder.parse(is);
  112 +
  113 + Element element = doc.getDocumentElement();
  114 + Node paramNode = element.getElementsByTagName(paramName).item(0).getFirstChild();
  115 + return paramNode != null ? paramNode.getNodeValue() : null;
  116 + } catch (Exception e) {
  117 + log.error("解析 XML 数据失败: {}", e.getMessage(), e);
  118 + return null;
45 } 119 }
46 - return ResultData.error("支付方式错误");  
47 } 120 }
48 121
49 122
50 - private ResultData wxPay(WDd wDd) { 123 + private String generateXmlResponse(String returnCode, String returnMsg, String outTradeNo) {
  124 + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
  125 + DocumentBuilder dBuilder;
51 try { 126 try {
52 - String tradeType = wDd.getFZffs();  
53 - if (StrUtil.isBlank(tradeType)) {  
54 - return ResultData.error("支付方式错误");  
55 - } 127 + dBuilder = dbFactory.newDocumentBuilder();
  128 + Document doc = dBuilder.newDocument();
  129 +
  130 + Element rootElement = doc.createElement("xml");
  131 + doc.appendChild(rootElement);
  132 +
  133 + Element returnCodeElement = doc.createElement("return_code");
  134 + returnCodeElement.appendChild(doc.createTextNode(returnCode));
  135 + rootElement.appendChild(returnCodeElement);
56 136
57 - // 防止重新启动支付时报“商户订单号重复”,前面增加8位随机数,product_id最大32位  
58 - String outTradeNo = RandomUtil.randomString(8) + "_" + wDd.getId();  
59 - String body = wDd.getFDddh();  
60 - body = body.length() > 40 ? body.substring(0,39) : body; 137 + Element returnMsgElement = doc.createElement("return_msg");
  138 + returnMsgElement.appendChild(doc.createTextNode(returnMsg));
  139 + rootElement.appendChild(returnMsgElement);
61 140
  141 + Element outTradeNoElement = doc.createElement("out_trade_no");
  142 + outTradeNoElement.appendChild(doc.createTextNode(outTradeNo));
  143 + rootElement.appendChild(outTradeNoElement);
  144 +
  145 + TransformerFactory transformerFactory = TransformerFactory.newInstance();
  146 + Transformer transformer = transformerFactory.newTransformer();
  147 + DOMSource source = new DOMSource(doc);
  148 + StringWriter writer = new StringWriter();
  149 + StreamResult result = new StreamResult(writer);
  150 + transformer.transform(source, result);
  151 + return writer.toString();
  152 + } catch (Exception e) {
  153 + log.error("构建 XML 响应失败", e);
  154 + return "<xml><return_code>FAIL</return_code><return_msg>处理失败</return_msg></xml>";
  155 + }
  156 + }
  157 +
  158 + @Override
  159 + public HashMap<String, Object> wxPay(WDd wDd) {
  160 + try {
  161 + WCzzfpz wCzzfpz = czzfpzDao.selectOne(Wrappers.<WCzzfpz>lambdaQuery().eq(WCzzfpz::getFCzid, wDd.getFCzid()).eq(WCzzfpz::getFZflx, wDd.getFZffs()));
  162 + if (BeanUtils.isEmpty(wCzzfpz) || wCzzfpz == null) {
  163 + throw new RuntimeException("支付配置不存在");
  164 + }
  165 + String tradeType = wDd.getFZflx();
  166 + if (StrUtil.isBlank(tradeType)) {
  167 + throw new RuntimeException("支付方式错误");
  168 + }
62 WxPayUnifiedOrderRequest wxPayUnifiedOrderRequest = new WxPayUnifiedOrderRequest(); 169 WxPayUnifiedOrderRequest wxPayUnifiedOrderRequest = new WxPayUnifiedOrderRequest();
63 - wxPayUnifiedOrderRequest.setAppid(WxPayConfiguration.appId); 170 + wxPayUnifiedOrderRequest.setAppid(wCzzfpz.getFAppid());
64 wxPayUnifiedOrderRequest.setOpenid(null); 171 wxPayUnifiedOrderRequest.setOpenid(null);
65 - wxPayUnifiedOrderRequest.setBody(body);  
66 - wxPayUnifiedOrderRequest.setOutTradeNo(outTradeNo); 172 + wxPayUnifiedOrderRequest.setBody(wDd.getFDddh());
  173 + wxPayUnifiedOrderRequest.setOutTradeNo(wDd.getFDddh());
67 wxPayUnifiedOrderRequest.setTotalFee(wDd.getFDdje().multiply(new BigDecimal(100)).intValue()); 174 wxPayUnifiedOrderRequest.setTotalFee(wDd.getFDdje().multiply(new BigDecimal(100)).intValue());
68 wxPayUnifiedOrderRequest.setTradeType(tradeType); 175 wxPayUnifiedOrderRequest.setTradeType(tradeType);
69 - 176 + log.warn("创建订单5:{}", wxPayUnifiedOrderRequest);
70 JSONObject scene_info = new JSONObject(); 177 JSONObject scene_info = new JSONObject();
71 scene_info.put("id", "LPG"); 178 scene_info.put("id", "LPG");
72 scene_info.put("name", "燃气"); 179 scene_info.put("name", "燃气");
73 wxPayUnifiedOrderRequest.setSceneInfo(scene_info.toString()); 180 wxPayUnifiedOrderRequest.setSceneInfo(scene_info.toString());
74 - wxPayUnifiedOrderRequest.setNotifyUrl("https://zaoyin.peony.cn/server/hzys/payment/v1/notify-order"); // 支付回调地址,开放不用登录 181 + wxPayUnifiedOrderRequest.setNotifyUrl("http://i42mtc.natappfree.cc/api/user/order/payment/notifyOrder"); // 支付回调地址,开放不用登录
75 wxPayUnifiedOrderRequest.setSpbillCreateIp("127.0.0.1"); 182 wxPayUnifiedOrderRequest.setSpbillCreateIp("127.0.0.1");
76 -  
77 // trade_type=APP时 移动应用内的支付场景 183 // trade_type=APP时 移动应用内的支付场景
78 - if("APP".equals(wxPayUnifiedOrderRequest.getTradeType())){  
79 - wxPayUnifiedOrderRequest.setAppid(WxPayConfiguration.appId); 184 + if ("APP".equals(wxPayUnifiedOrderRequest.getTradeType())) {
  185 + wxPayUnifiedOrderRequest.setAppid(wCzzfpz.getFAppid());
80 } 186 }
81 // trade_type=NATIVE时 线下消费场景 187 // trade_type=NATIVE时 线下消费场景
82 - if("NATIVE".equals(wxPayUnifiedOrderRequest.getTradeType())){ 188 + if ("NATIVE".equals(wxPayUnifiedOrderRequest.getTradeType())) {
83 wxPayUnifiedOrderRequest.setProductId(wxPayUnifiedOrderRequest.getOutTradeNo()); 189 wxPayUnifiedOrderRequest.setProductId(wxPayUnifiedOrderRequest.getOutTradeNo());
84 } 190 }
85 // 公众号内或者微信内的网页支付 191 // 公众号内或者微信内的网页支付
86 if ("JSAPI".equals(wxPayUnifiedOrderRequest.getTradeType())) { 192 if ("JSAPI".equals(wxPayUnifiedOrderRequest.getTradeType())) {
87 - wxPayUnifiedOrderRequest.setOpenid(null); 193 + wxPayUnifiedOrderRequest.setOpenid("oH7LG54_Y49mVunw2FLXzUCxHWlM");
88 } 194 }
89 // 手机浏览器中的支付场景 195 // 手机浏览器中的支付场景
90 if ("MWEB".equals(wxPayUnifiedOrderRequest.getTradeType())) { 196 if ("MWEB".equals(wxPayUnifiedOrderRequest.getTradeType())) {
91 wxPayUnifiedOrderRequest.setSceneInfo(null); 197 wxPayUnifiedOrderRequest.setSceneInfo(null);
92 } 198 }
93 - WxPayService wxPayService = WxPayConfiguration.getPayService();  
94 - ddDao.updateById(wDd);  
95 - return ResultData.success(wxPayService.createOrder(wxPayUnifiedOrderRequest)); 199 + WxPayService wxPayService = WxPayConfiguration.getPayService(wCzzfpz);
  200 + Object payment = wxPayService.createOrder(wxPayUnifiedOrderRequest);
  201 + HashMap<String, Object> resultData = new HashMap<String, Object>();
  202 + resultData.put("payment", payment);
  203 + resultData.put("ddid", wDd.getId());
  204 + resultData.put("dddh", wDd.getFDddh());
  205 + return resultData;
96 } catch (WxPayException e) { 206 } catch (WxPayException e) {
97 - if("INVALID_REQUEST".equals(e.getErrCode())){  
98 - return ResultData.error("订单号重复,请重新下单"); 207 + if ("INVALID_REQUEST".equals(e.getErrCode())) {
  208 + throw new RuntimeException("订单号重复,请重新下单");
99 } 209 }
100 - e.printStackTrace();  
101 - return ResultData.error(e.getReturnMsg() + "" + e.getCustomErrorMsg() + "" + e.getErrCodeDes());  
102 - }  
103 - }  
104 -  
105 -  
106 - @Override  
107 - public String notifyOrder(String xmlData) {  
108 - WxPayService wxPayService = WxPayConfiguration.getPayService();  
109 - try {  
110 - WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);  
111 - String ddid = notifyResult.getOutTradeNo().split("_")[1];  
112 - WDd wDd = ddDao.selectById(ddid);  
113 - if (null == wDd) {  
114 - return WxPayNotifyResponse.fail("订单不存在");  
115 - }  
116 - BigDecimal payPrice = wDd.getFDdje();  
117 - if (payPrice.multiply(new BigDecimal(100)).intValue() != notifyResult.getTotalFee()) {  
118 - return WxPayNotifyResponse.fail("付款金额与订单金额不等");  
119 - }  
120 -  
121 - String timeEnd = notifyResult.getTimeEnd();  
122 - LocalDateTime paymentTime = LocalDateTimeUtils.parse(timeEnd);  
123 -// wDdb.setfFksj(paymentTime);  
124 -// wDdb.setfZfdh(notifyResult.getTransactionId());  
125 -// wDdb.setfSffk("是");  
126 -// wDdb.setfDdzt("已付款");  
127 -// wDdb.setfPtddzt("待审批");  
128 -// wDdbDao.updateById(wDdb);  
129 -//  
130 -// if (StrUtil.isNotBlank(wDdb.getfZpid())) {  
131 -// WZp wZp = wZpDao.selectById(wDdb.getfZpid());  
132 -// wZp.setfZt("定制中");  
133 -// wZpDao.updateById(wZp);  
134 -// }  
135 - return WxPayNotifyResponse.success("成功");  
136 - } catch (WxPayException e) {  
137 - return WxPayNotifyResponse.fail(e.getErrCodeDes()); 210 + throw new RuntimeException(e.getMessage());
138 } 211 }
139 } 212 }
140 } 213 }
backend/lpg-user/src/main/java/com/hotent/lpg/user/manager/impl/WCzzfpzManagerImpl.java 0 → 100644
@@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
  1 +package com.hotent.lpg.user.manager.impl;
  2 +
  3 +import com.hotent.lpg.common.model.WCzzfpz;
  4 +import com.hotent.lpg.user.dao.CzzfpzDao;
  5 +import com.hotent.lpg.user.manager.CzzfpzManager;
  6 +import com.hotent.base.manager.impl.BaseManagerImpl;
  7 +import org.springframework.stereotype.Service;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +
  11 +/**
  12 + * 厂站支付配置 服务实现类
  13 + *
  14 + * @author cw
  15 + * @since 2024-09-04
  16 + */
  17 +@Service
  18 +public class WCzzfpzManagerImpl extends BaseManagerImpl<CzzfpzDao, WCzzfpz> implements CzzfpzManager {
  19 +
  20 + @Override
  21 + public WCzzfpz getDetail(String id) {
  22 + WCzzfpz wCzzfpz = this.get(id);
  23 +
  24 +
  25 + return wCzzfpz;
  26 + }
  27 + @Override
  28 + @Transactional
  29 + public void createOrUpdate(WCzzfpz wCzzfpz) {
  30 + //新建或更新
  31 + this.saveOrUpdate(wCzzfpz);
  32 + }
  33 +}
backend/lpg-user/src/main/java/com/hotent/lpg/user/util/WxPayConfiguration.java
@@ -3,57 +3,17 @@ package com.hotent.lpg.user.util; @@ -3,57 +3,17 @@ package com.hotent.lpg.user.util;
3 import com.github.binarywang.wxpay.config.WxPayConfig; 3 import com.github.binarywang.wxpay.config.WxPayConfig;
4 import com.github.binarywang.wxpay.service.WxPayService; 4 import com.github.binarywang.wxpay.service.WxPayService;
5 import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; 5 import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
  6 +import com.hotent.lpg.common.model.WCzzfpz;
6 7
7 public class WxPayConfiguration { 8 public class WxPayConfiguration {
8 -// public static final String appId = "wxf41ff374261f39cc"; // 该配置用的是景易游的微信支付信息  
9 - public static final String appId = "wxde6f31c15afb357d";  
10 -  
11 - public static WxPayService getPayService() {  
12 - // 该配置用的是景易游的微信支付信息  
13 -// WxPayConfig wxPayConfig = new WxPayConfig();  
14 -// wxPayConfig.setAppId("wxf41ff374261f39cc");  
15 -// wxPayConfig.setMchId("1634368190");  
16 -// wxPayConfig.setMchKey("Peony8228Peony8228Peony8228Peony");  
17 -//// wxPayConfig.setKeyPath("/mnt/install/joolun-file/cert/1/apiclient_cert8e55f27b-6d67-4b91-a16e-e9f6ef96ca5b11027923844080776299.p12");  
18 -//// wxPayConfig.setPrivateKeyPath("/mnt/install/joolun-file/cert/1/apiclient_key571e2a52-a9f8-46c5-9d4d-ed4b08d0749c4331609001879503591.pem");  
19 -//// wxPayConfig.setPrivateCertPath("/mnt/install/joolun-file/cert/1/apiclient_cert13b610c6-4005-4189-8a61-85fab73fa42017841178972810569411.pem");  
20 -// wxPayConfig.setCertSerialNo("55ED43DE3CC79DD045B92577A8FB2E95AACE8BEF");  
21 -// wxPayConfig.setApiV3Key("Peony8228Peony8228Peony8228Peony");  
22 -// // 可以指定是否使用沙箱环境  
23 -// wxPayConfig.setUseSandboxEnv(false);  
24 -  
25 -  
26 - /**  
27 - * 商户简称:  
28 - * 牡丹集团宁安智慧工程中心  
29 - * 企业名称:  
30 - * 北京牡丹电子集团有限责任公司宁安智慧工程中心  
31 - * 登录账号  
32 - * 1556251121 (本账号)  
33 - *  
34 - * 账号角色  
35 - * Administrator  
36 - * 创建时间  
37 - * 2019年9月19日 09:29:32  
38 - * 绑定微信号  
39 - * c*****21更换绑定  
40 - * 姓 名  
41 - * *际  
42 - * 联系手机  
43 - * 158******80  
44 - * 联系邮箱  
45 - * b*********n  
46 - */ 9 + public static WxPayService getPayService(WCzzfpz wCzzfpz) {
47 WxPayConfig wxPayConfig = new WxPayConfig(); 10 WxPayConfig wxPayConfig = new WxPayConfig();
48 - wxPayConfig.setAppId("wxde6f31c15afb357d"); // appId(应用id)(微信支付商户平台获取)  
49 - wxPayConfig.setMchId("1556251121"); // 商户号(微信支付商户平台获取) 11 + wxPayConfig.setAppId(wCzzfpz.getFAppid()); // appId(应用id)(微信支付商户平台获取)
  12 + wxPayConfig.setMchId(wCzzfpz.getFMchid()); // 商户号(微信支付商户平台获取)
50 // 这里的密钥应该使用APIv2密码,v3密钥此jar包不支持签名方式 13 // 这里的密钥应该使用APIv2密码,v3密钥此jar包不支持签名方式
51 - wxPayConfig.setMchKey("Peony8228Peony8228Peony8228Peony"); // 商户密钥(APIv2密钥)(微信支付商户平台-》账户中心-》API安全中获取APIv3密钥)  
52 -// wxPayConfig.setKeyPath("/mnt/install/joolun-file/cert/1/apiclient_cert8e55f27b-6d67-4b91-a16e-e9f6ef96ca5b11027923844080776299.p12");  
53 -// wxPayConfig.setPrivateKeyPath("/mnt/install/joolun-file/cert/1/apiclient_key571e2a52-a9f8-46c5-9d4d-ed4b08d0749c4331609001879503591.pem");  
54 -// wxPayConfig.setPrivateCertPath("/mnt/install/joolun-file/cert/1/apiclient_cert13b610c6-4005-4189-8a61-85fab73fa42017841178972810569411.pem");  
55 - wxPayConfig.setCertSerialNo("736846A3CE4CBAC36DD5E81EB08F89240E4A05E1"); // 商户证书序列号(微信支付商户平台-》账户中心-》API安全中申请API证书)  
56 - wxPayConfig.setApiV3Key("Peony8228Peony8228Peony8228Peony"); // 商户密钥(APIv2密钥)(微信支付商户平台-》账户中心-》API安全中获取APIv3密钥) 14 + wxPayConfig.setMchKey(wCzzfpz.getFMchkey()); // 商户密钥(APIv2密钥)(微信支付商户平台-》账户中心-》API安全中获取APIv3密钥)
  15 + wxPayConfig.setCertSerialNo(wCzzfpz.getFCertserialno()); // 商户证书序列号(微信支付商户平台-》账户中心-》API安全中申请API证书)
  16 + wxPayConfig.setApiV3Key(wCzzfpz.getFApiv3key()); // 商户密钥(APIv2密钥)(微信支付商户平台-》账户中心-》API安全中获取APIv3密钥)
57 // 可以指定是否使用沙箱环境 17 // 可以指定是否使用沙箱环境
58 wxPayConfig.setUseSandboxEnv(false); 18 wxPayConfig.setUseSandboxEnv(false);
59 WxPayService wxPayService = new WxPayServiceImpl(); 19 WxPayService wxPayService = new WxPayServiceImpl();