From 91f1c973ae463e3994c8e9bb62ce1545b04642f2 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 14 六月 2024 11:07:01 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java | 21 -- pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml | 1 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java | 14 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java | 9 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java | 9 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java | 2 /dev/null | 91 --------- pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoDivide.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java | 139 +++++++------ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/NotifyResource.java | 40 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java | 60 +++--- pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoToDividePojo.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java | 190 +++++++----------- pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java | 5 pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml | 4 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java | 6 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java | 5 18 files changed, 261 insertions(+), 339 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWebchatLogonStateMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWebchatLogonStateMapper.java deleted file mode 100644 index 4837b8f..0000000 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWebchatLogonStateMapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.dy.pipIrrGlobal.daoSe; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; -import org.apache.ibatis.annotations.Mapper; - -/** - * @author ZhuBaoMin - * @date 2024-02-22 17:31 - * @LastEditTime 2024-02-22 17:31 - * @Description - */ - -@Mapper -public interface SeWebchatLogonStateMapper extends BaseMapper<SeWebchatLogonState> { - int deleteByPrimaryKey(Long id); - - int insert(SeWebchatLogonState record); - - int insertSelective(SeWebchatLogonState record); - - SeWebchatLogonState selectByPrimaryKey(Long id); - - int updateByPrimaryKeySelective(SeWebchatLogonState record); - - int updateByPrimaryKey(SeWebchatLogonState record); -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWebchatLogonState.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWebchatLogonState.java deleted file mode 100644 index b8c01be..0000000 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWebchatLogonState.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.dy.pipIrrGlobal.pojoSe; - -import com.alibaba.fastjson2.annotation.JSONField; -import com.alibaba.fastjson2.writer.ObjectWriterImplToString; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.dy.common.po.BaseEntity; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; -import lombok.*; - -import java.util.Date; - -/** - * @author ZhuBaoMin - * @date 2024-02-22 17:31 - * @LastEditTime 2024-02-22 17:31 - * @Description - */ - -@TableName(value="se_webchat_logon_state", autoResultMap = true) -@Data -@Builder -@ToString -@NoArgsConstructor -@AllArgsConstructor -@Schema(name = "鐧诲綍鎬佽褰曞疄浣�") -public class SeWebchatLogonState implements BaseEntity { - public static final long serialVersionUID = 202402221735001L; - - /** - * 涓婚敭 - */ - @JSONField(serializeUsing= ObjectWriterImplToString.class) - @TableId(type = IdType.INPUT) - @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - private Long id; - - /** - * 鐢ㄦ埛鍞竴鏍囪瘑 - */ - @Schema(description = "鐢ㄦ埛鍞竴鏍囪瘑", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @NotBlank(message = "鐢ㄦ埛鍞竴鏍囪瘑涓嶈兘涓虹┖") - private String openId; - - /** - * 浼氳瘽瀵嗛挜 - */ - @Schema(description = "浼氳瘽瀵嗛挜", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @NotBlank(message = "浼氳瘽瀵嗛挜涓嶈兘涓虹┖") - private String sessionKey; - - /** - * 鍒涘缓鏃堕棿 - */ - @Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @NotBlank(message = "鍒涘缓鏃堕棿涓嶈兘涓虹┖") - private Date createTime; -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java index 4e210ff..8e49596 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java @@ -15,6 +15,7 @@ */ public enum DistrictLevel implements IEnum { + Province((byte)0, "鐪�"), City((byte)1, "甯�"), County((byte)2, "鍘�"), Town((byte)3, "闀�"), @@ -52,7 +53,9 @@ } public static DistrictLevel get(Byte code){ - if(code.byteValue() == City.code.byteValue()){ + if(code.byteValue() == Province.code.byteValue()) { + return Province; + }else if(code.byteValue() == City.code.byteValue()){ return City ; }else if(code.byteValue() == County.code.byteValue()){ return County ; diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml index 6d047e9..29fac5c 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml @@ -5,8 +5,8 @@ #name: ym type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://192.168.91.73:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull - url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +# url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull + url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml index def611f..e6d2506 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml @@ -99,4 +99,5 @@ create_time = #{createTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> + </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWebchatLogonStateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWebchatLogonStateMapper.xml deleted file mode 100644 index 973ab13..0000000 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWebchatLogonStateMapper.xml +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> - <!--@mbg.generated--> - <!--@Table se_webchat_logon_state--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="open_id" jdbcType="VARCHAR" property="openId" /> - <result column="session_key" jdbcType="VARCHAR" property="sessionKey" /> - <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, open_id, session_key, create_time - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from se_webchat_logon_state - where id = #{id,jdbcType=BIGINT} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from se_webchat_logon_state - where id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> - <!--@mbg.generated--> - insert into se_webchat_logon_state (id, open_id, session_key, - create_time) - values (#{id,jdbcType=BIGINT}, #{openId,jdbcType=VARCHAR}, #{sessionKey,jdbcType=VARCHAR}, - #{createTime,jdbcType=TIMESTAMP}) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> - <!--@mbg.generated--> - insert into se_webchat_logon_state - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> - id, - </if> - <if test="openId != null"> - open_id, - </if> - <if test="sessionKey != null"> - session_key, - </if> - <if test="createTime != null"> - create_time, - </if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null"> - #{id,jdbcType=BIGINT}, - </if> - <if test="openId != null"> - #{openId,jdbcType=VARCHAR}, - </if> - <if test="sessionKey != null"> - #{sessionKey,jdbcType=VARCHAR}, - </if> - <if test="createTime != null"> - #{createTime,jdbcType=TIMESTAMP}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> - <!--@mbg.generated--> - update se_webchat_logon_state - <set> - <if test="openId != null"> - open_id = #{openId,jdbcType=VARCHAR}, - </if> - <if test="sessionKey != null"> - session_key = #{sessionKey,jdbcType=VARCHAR}, - </if> - <if test="createTime != null"> - create_time = #{createTime,jdbcType=TIMESTAMP}, - </if> - </set> - where id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> - <!--@mbg.generated--> - update se_webchat_logon_state - set open_id = #{openId,jdbcType=VARCHAR}, - session_key = #{sessionKey,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - </update> -</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java index 8a41586..de48d21 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java @@ -30,19 +30,20 @@ @Slf4j @Tag(name = "琛屾斂鍖哄垝绠$悊", description = "琛屾斂鍖哄垝澧炲垹鏀规煡绛夋搷浣�") @RestController -@RequestMapping(path="district") +@RequestMapping(path = "district") @SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked") public class DistrictCtrl { - private DistrictSv sv ; + private DistrictSv sv; @Autowired - private void setSv(DistrictSv sv){ - this.sv = sv ; + private void setSv(DistrictSv sv) { + this.sv = sv; } /** * 瀹㈡埛绔姹傚緱鍒版墍鏈夎鏀垮尯鍒掔骇鍒暟鎹� + * * @return 鎵�鏈夎鏀垮尯鍒掔骇鍒暟鎹� */ @Operation(summary = "琛屾斂鍖哄垝绾у埆", description = "杩斿洖鎵�鏈夎鏀垮尯鍒掔骇鍒暟鎹�") @@ -55,13 +56,14 @@ ) }) @GetMapping(path = "allLevel") - public BaseResponse<List<DistrictLevel>> allDistrictLevels(){ + public BaseResponse<List<DistrictLevel>> allDistrictLevels() { //List<DistrictLevel> list = Arrays.asList(DistrictLevel.City, DistrictLevel.County, DistrictLevel.Town, DistrictLevel.Village) ; return BaseResponseUtils.buildSuccess(DistrictLevel.LevelList); } /** * 瀹㈡埛绔姹傚緱鍒版墍鏈夎鏀垮尯鏁版嵁 + * * @return 鎵�鏈夎鏀垮尯鏁版嵁 */ @Operation(summary = "鑾峰緱鎵�鏈夎鏀垮尯", description = "杩斿洖鎵�鏈夎鏀垮尯鏁版嵁") @@ -75,13 +77,14 @@ }) @GetMapping(path = "all") @SsoAop() - public BaseResponse<List<BaDistrict>> all(){ - List<BaDistrict> list = this.sv.selectAllByLevel(DistrictLevel.City.code) ; + public BaseResponse<List<BaDistrict>> all() { + List<BaDistrict> list = this.sv.selectAllByLevel(DistrictLevel.City.code); return BaseResponseUtils.buildSuccess(list); } /** * 寰楀埌涓�涓鏀垮尯鏁版嵁 + * * @return 涓�涓鏀垮尯鏁版嵁 */ @Operation(summary = "涓�涓鏀垮尯", description = "寰楀埌涓�涓鏀垮尯鏁版嵁") @@ -95,12 +98,13 @@ }) @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) @SsoAop() - public BaseResponse<BaDistrict> one(Long id){ + public BaseResponse<BaDistrict> one(Long id) { return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); } /** * 淇濆瓨琛屾斂鍖� + * * @param vo 淇濆瓨琛屾斂鍖篺orm琛ㄥ崟瀵硅薄 * @return 鏄惁鎴愬姛 */ @@ -115,34 +119,35 @@ }) @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop() - public BaseResponse<Boolean> save(@RequestBody @Valid DistrictVo vo, BindingResult bindingResult){ - if(bindingResult != null && bindingResult.hasErrors()){ + public BaseResponse<Boolean> save(@RequestBody @Valid DistrictVo vo, BindingResult bindingResult) { + if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } BaDistrict po = DistrictVoMapper.INSTANCT.convert(vo); int count; try { - BaDistrict supperPo = this.sv.selectById(po.supperId) ; - if(supperPo == null){ - return BaseResponseUtils.buildFail("鍑洪敊锛屾湭寰楀埌涓婄骇琛屾斂鍖�") ; - }else{ + BaDistrict supperPo = this.sv.selectById(po.supperId); + if (supperPo == null) { + return BaseResponseUtils.buildFail("鍑洪敊锛屾湭寰楀埌涓婄骇琛屾斂鍖�"); + } else { po.level = DistrictLevel.get((byte)(supperPo.level.code + 1)) ; } - po.deleted = Deleted.NO ; + po.deleted = Deleted.NO; count = this.sv.save(po); } catch (Exception e) { log.error("淇濆瓨琛屾斂鍖哄紓甯�", e); - return BaseResponseUtils.buildException(e.getMessage()) ; + return BaseResponseUtils.buildException(e.getMessage()); } - if(count <= 0){ - return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; - }else{ - return BaseResponseUtils.buildSuccess(true) ; + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } /** * 缂栬緫淇敼琛屾斂鍖� + * * @param vo 淇濆瓨琛屾斂鍖篺orm琛ㄥ崟瀵硅薄 * @return 鏄惁鎴愬姛 */ @@ -157,8 +162,8 @@ }) @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop() - public BaseResponse<Boolean> update(@RequestBody @Valid DistrictVo vo, BindingResult bindingResult){ - if(bindingResult != null && bindingResult.hasErrors()){ + public BaseResponse<Boolean> update(@RequestBody @Valid DistrictVo vo, BindingResult bindingResult) { + if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } BaDistrict po = DistrictVoMapper.INSTANCT.convert(vo); @@ -167,18 +172,19 @@ count = this.sv.update(po); } catch (Exception e) { log.error("淇濆瓨琛屾斂鍖哄紓甯�", e); - return BaseResponseUtils.buildException(e.getMessage()) ; + return BaseResponseUtils.buildException(e.getMessage()); } - if(count <= 0){ - return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; - }else{ - return BaseResponseUtils.buildSuccess(true) ; + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } /** * 鍒犻櫎琛屾斂鍖� + * * @param id 琛屾斂鍖篒D * @return 鏄惁鎴愬姛 */ @@ -191,28 +197,29 @@ schema = @Schema(implementation = Boolean.class))} ) }) - @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) + @GetMapping(path = "delete") @SsoAop() - public BaseResponse<Boolean> delete(Long id){ - if(id == null){ - return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ; + public BaseResponse<Boolean> delete(Long id) { + if (id == null) { + return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖"); } int count; try { count = this.sv.delete(id); } catch (Exception e) { log.error("淇濆瓨琛屾斂鍖哄紓甯�", e); - return BaseResponseUtils.buildException(e.getMessage()) ; + return BaseResponseUtils.buildException(e.getMessage()); } - if(count <= 0){ - return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; - }else{ - return BaseResponseUtils.buildSuccess(true) ; + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } /** * 鏍规嵁绾у埆鑾峰彇琛屾斂鍖哄垝鍒楄〃 + * * @param id * @return */ @@ -227,20 +234,21 @@ }) @GetMapping(path = "/level/{id}") @SsoAop() - public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getDistrictgsByLevel(@PathVariable("id") Integer id){ - if(id == null || id <= 0){ - return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ; + public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getDistrictgsByLevel(@PathVariable("id") Integer id) { + if (id == null || id <= 0) { + return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖"); } List<Map<String, Object>> map_Districts = Optional.ofNullable(sv.getDistrictgsByLevel(id)).orElse(new ArrayList<>()); - if(map_Districts == null || map_Districts.size() == 0) { - return BaseResponseUtils.buildFail("鎮ㄨ緭鍏ョ殑灞傜骇鏈夎") ; + if (map_Districts == null || map_Districts.size() == 0) { + return BaseResponseUtils.buildFail("鎮ㄨ緭鍏ョ殑灞傜骇鏈夎"); } return BaseResponseUtils.buildSuccess(map_Districts); } /** * 鏍规嵁鐖禝D鑾峰彇琛屾斂鍖哄垝鍒楄〃 + * * @param supperId * @return */ @@ -255,20 +263,21 @@ }) @GetMapping(path = "/supperid/{supperId}") @SsoAop() - public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getDistrictsBySupperId(@PathVariable("supperId") Long supperId){ - if(supperId == null || supperId <= 0){ - return BaseResponseUtils.buildFail("鐖禝D涓嶈兘涓虹┖") ; + public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getDistrictsBySupperId(@PathVariable("supperId") Long supperId) { + if (supperId == null || supperId <= 0) { + return BaseResponseUtils.buildFail("鐖禝D涓嶈兘涓虹┖"); } List<Map<String, Object>> map_Districts = Optional.ofNullable(sv.getDistrictsBySupperId(supperId)).orElse(new ArrayList<>()); - if(map_Districts == null || map_Districts.size() == 0) { - return BaseResponseUtils.buildFail("鎮ㄨ緭鍏ョ殑鐖剁骇ID鏈夎") ; + if (map_Districts == null || map_Districts.size() == 0) { + return BaseResponseUtils.buildFail("鎮ㄨ緭鍏ョ殑鐖剁骇ID鏈夎"); } return BaseResponseUtils.buildSuccess(map_Districts); } /** * 鑾峰彇涓夌骇琛屾斂鍖哄垝 + * * @return 鍘块晣鏉戜笁绾ц鏀垮尯鍒� */ @GetMapping(path = "/three") @@ -279,35 +288,35 @@ JSONArray array_villages = new JSONArray(); List<Map<String, Object>> list_counties = Optional.ofNullable(sv.getDistrictgsByLevel(2)).orElse(new ArrayList<>()); - if(list_counties.size() > 0) { + if (list_counties.size() > 0) { array_counties = JSONArray.parseArray(JSON.toJSONString(list_counties)); // 閬嶅巻姣忎竴涓幙锛屽皢鍘夸笅鐨勯晣鏉戝姞鍒板幙鐨勫瓙闆� - for(int i = 0; i < array_counties.size(); i++) { + for (int i = 0; i < array_counties.size(); i++) { JSONObject job_county = array_counties.getJSONObject(i); - Long countyId = job_county.getLong("id"); - List<Map<String, Object>> list_towns = Optional.ofNullable(sv.getDistrictsBySupperId(countyId)).orElse(new ArrayList<>()); - if(list_towns.size() > 0) { - array_towns = JSONArray.parseArray(JSON.toJSONString(list_towns)); - // 閬嶅巻姣忎竴涓晣锛屽皢闀囦笅鏉戝垪琛ㄥ姞鍒伴晣鐨勫瓙闆� - for(int j = 0; j < array_towns.size(); j++) { - JSONObject job_town = array_towns.getJSONObject(j); - Long townId = job_town.getLong("id"); - List<Map<String, Object>> list_villages = Optional.ofNullable(sv.getDistrictsBySupperId(townId)).orElse(new ArrayList<>()); - if(list_villages.size() > 0) { - array_villages = JSONArray.parseArray(JSON.toJSONString(list_villages)); - job_town.put("children", array_villages); - } + Long countyId = job_county.getLong("id"); + List<Map<String, Object>> list_towns = Optional.ofNullable(sv.getDistrictsBySupperId(countyId)).orElse(new ArrayList<>()); + if (list_towns.size() > 0) { + array_towns = JSONArray.parseArray(JSON.toJSONString(list_towns)); + // 閬嶅巻姣忎竴涓晣锛屽皢闀囦笅鏉戝垪琛ㄥ姞鍒伴晣鐨勫瓙闆� + for (int j = 0; j < array_towns.size(); j++) { + JSONObject job_town = array_towns.getJSONObject(j); + Long townId = job_town.getLong("id"); + List<Map<String, Object>> list_villages = Optional.ofNullable(sv.getDistrictsBySupperId(townId)).orElse(new ArrayList<>()); + if (list_villages.size() > 0) { + array_villages = JSONArray.parseArray(JSON.toJSONString(list_villages)); + job_town.put("children", array_villages); } - //System.out.println("----" + array_towns); } - // 闀囨潙缁勮瀹屾瘯锛屽皢闀囨潙鍔犲埌鍘夸笅 - job_county.put("children", array_towns); + //System.out.println("----" + array_towns); + } + // 闀囨潙缁勮瀹屾瘯锛屽皢闀囨潙鍔犲埌鍘夸笅 + job_county.put("children", array_towns); } // 鍘跨粍瑁呭畬姣� //String a = array_counties.toJSONString(); //System.out.println(a); return BaseResponseUtils.buildSuccess(array_counties); - }else { + } else { return BaseResponseUtils.buildFail("鍘跨骇琛屾斂鍖哄垝涓嶅瓨鍦�"); } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java index 167cecd..389bf86 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java @@ -213,13 +213,15 @@ @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() - public BaseResponse<Boolean> update(@RequestBody @Valid PrDivide po, BindingResult bindingResult){ + public BaseResponse<Boolean> update(@RequestBody @Valid DtoDivide po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } // 鎺ユ敹鏉戠紪鍙凤紙涓婚敭锛� - Long villageId = po.getVillageid(); + Long villageId = po.getVillageId(); + + PrDivide prDivide = DtoToDividePojo.INSTANCT.po2vo(po); if (villageId!=null){ /** @@ -231,14 +233,14 @@ } Long countryId = Long.parseLong(map_districts.get("countryId").toString()); Long townId = Long.parseLong(map_districts.get("townId").toString()); - po.setCountyid(countryId); - po.setTownid(townId); + prDivide.setCountyid(countryId); + prDivide.setTownid(townId); } Date operateTime = new Date(); - po.setOperatedt(operateTime); + prDivide.setOperatedt(operateTime); - Integer rec = Optional.ofNullable(divideSv.updateByPrimaryKey(po)).orElse(0); + Integer rec = Optional.ofNullable(divideSv.updateByPrimaryKey(prDivide)).orElse(0); if(rec == 0) { return BaseResponseUtils.buildFail("鍒嗘按鎴夸慨鏀瑰け璐�"); } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoDivide.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoDivide.java index 996457b..06269f7 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoDivide.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoDivide.java @@ -18,6 +18,8 @@ public class DtoDivide { public static final long serialVersionUID = 1L; + @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Long id; /** * 鎵�鍦ㄦ潙 */ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoToDividePojo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoToDividePojo.java index 9fbdc5e..a608212 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoToDividePojo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DtoToDividePojo.java @@ -16,6 +16,7 @@ public interface DtoToDividePojo { DtoToDividePojo INSTANCT = Mappers.getMapper(DtoToDividePojo.class); + @Mapping(target = "id", source = "id") @Mapping(target = "villageid", source = "villageId") @Mapping(target = "blockid", source = "blockId") @Mapping(target = "name", source = "name") diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java index 68b7405..5767579 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java @@ -5,6 +5,7 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper; import com.dy.pipIrrGlobal.pojoSe.SeActiveCard; import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.util.Constant; @@ -50,6 +51,7 @@ private final ClientCardSv clientCardSv; private final RechargeCtrl rechargeCtrl; private final RechargeSv rechargeSv; + private final BaSettingsMapper baSettingsMapper; //@Value("${projectCode.ym}") @@ -232,8 +234,11 @@ }else { map.put("orderNumber",rec+"");//杩斿洖寮�鍗D } - //map.put("projectCode", projectCode); - map.put("projectCode", Constant.projectCode_ym); + String projectNo = baSettingsMapper.getItemValue("projectNo"); + Integer projectNo1 = Integer.valueOf(projectNo); + String projectNo3 = String.format("%02x", projectNo1); + map.put("projectNo", projectNo3); + //map.put("projectCode", Constant.projectCode_ym); map.put("cardNum", cardNum); return BaseResponseUtils.buildSuccess(map) ; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java index 2c1d508..f79e599 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java @@ -188,7 +188,8 @@ if(rec_history == 0) { return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL_WRITE_RECHARGE_HISTORY_ERROR.getMessage()); } - - return BaseResponseUtils.buildSuccess(true) ; + Map returnMap = new HashMap(); + returnMap.put("orderNumber",rec+"");//杩斿洖鍏呭�糏D + return BaseResponseUtils.buildSuccess(returnMap) ; } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java index e90474a..6385700 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java @@ -269,6 +269,7 @@ Map<String, String> headers = new HashMap<>(); headers.put("Authorization", header); headers.put("Accept", "application/json"); + //headers.put("User-Agent", "https://zh.wikipedia.org/wiki/User_agent"); JSONObject job_result = restTemplateUtil.getHeaders(PayInfo.certificates,null, headers); JSONObject job_headers = job_result.getJSONObject("headers"); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java index e478388..832e9da 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java @@ -155,6 +155,15 @@ } /** + * 鏍规嵁璁㈠崟鍙疯幏鍙栬櫄鎷熷崱鍏呭�煎璞� + * @param orderNumber + * @return + */ + public SeVcRecharge getVCRechargeByorderNumber(String orderNumber) { + return seVcRechargeMapper.getVCRechargeByorderNumber(orderNumber); + } + + /** * 淇敼铏氭嫙鍗″厖鍊艰褰� * 寰俊鏀粯閫氱煡鍚庯細 * 1. 鏇存柊鍏呭�艰〃锛氬厖鍊煎悗浣欓銆佹敮浠樺畬鎴愭椂闂淬�佽鍗曠姸鎬� diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java index 4e96448..a91afb1 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java @@ -42,7 +42,7 @@ * 鏀粯缁撴灉閫氱煡API */ //public static String notifyUrl = "https://www.muxiaobao.com/api/Payment/OrderNotify"; - public static String notifyUrl = "https://44978f7456.imdo.co/webchat/payment/orderNotify"; + public static String notifyUrl = "https://44978f7456.imdo.co/sell/payment/orderNotify"; /* * 鏌ヨ璁㈠崟API diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java index 48e0a35..2d237fa 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java @@ -1,5 +1,6 @@ package com.dy.pipIrrSell.wechatpay; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; @@ -17,8 +18,8 @@ import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM; import com.dy.pipIrrSell.virtualCard.enums.RefundItemStateENUM; import com.dy.pipIrrSell.wallet.enums.RefundStatusENUM; -import com.dy.pipIrrSell.wechatpay.dto.Code2Session; import com.dy.pipIrrSell.wechatpay.dto.DtoOrder; +import com.dy.pipIrrSell.wechatpay.dto.NotifyResource; import com.dy.pipIrrSell.wechatpay.dto.OrderNotify; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; @@ -26,6 +27,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -37,6 +39,7 @@ import org.springframework.web.bind.annotation.*; import javax.crypto.NoSuchPaddingException; +import java.io.BufferedReader; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.InvalidKeyException; @@ -80,60 +83,6 @@ // 骞冲彴璇佷功鍏挜 private final Map CERTIFICATE_MAP = new HashMap(); - - /** - * 鐧诲綍鍑瘉鏍¢獙 - * @param code2Session 鐧诲綍鍑瘉鏍¢獙浼犲叆瀵硅薄 - * @param bindingResult - * @return - * @throws Exception - */ - @Operation(summary = "鐧诲綍鍑瘉鏍¢獙", description = "鐧诲綍鍑瘉鏍¢獙") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) - @PostMapping(path = "getSessionId") - @Transactional(rollbackFor = Exception.class) - @SsoAop() - public BaseResponse<Boolean> getSessionId(@RequestBody @Valid Code2Session code2Session, BindingResult bindingResult) throws Exception { - if(bindingResult != null && bindingResult.hasErrors()){ - return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); - } - - Map<String, Object> queryParams = new HashMap<>(); - queryParams.put("appid", appid); - queryParams.put("secret", code2Session.getSecret()); - queryParams.put("js_code", code2Session.getJs_code()); - queryParams.put("grant_type", grantType); - Map<String, String> headerParams = new HashMap<>(); - JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams); - - if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) { - return BaseResponseUtils.buildFail("鐧诲綍鍑瘉鏍¢獙澶辫触"); - } - - String openid = job.getString("openid"); - String sessionKey = job.getString("session_key"); - - // 娣诲姞鐧诲綍鎬佽褰� - SeWebchatLogonState po = new SeWebchatLogonState(); - po.setOpenId(openid); - po.setSessionKey(sessionKey); - Date createTime = new Date(); - po.setCreateTime(createTime); - Long id = paymentSv.insert(po); - if(id == null || id <= 0) { - return BaseResponseUtils.buildFail("鐧诲綍鎬佽褰曟坊鍔犲け璐�"); - } - String SessionId = String.valueOf(id); - - return BaseResponseUtils.buildSuccess(SessionId) ; - } /** * 涓嬭浇寰俊鏀粯骞冲彴璇佷功 娴嬭瘯瀹屽簾闄� @@ -203,14 +152,12 @@ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - // 鎺ユ敹鍙傛暟锛氱櫥褰曟�両D銆佸啘鎴稩D銆佽櫄鎷熷崱ID銆佸厖鍊奸噾棰� + // 鎺ユ敹鍙傛暟锛氱櫥褰曟�両D銆佽櫄鎷熷崱ID銆佸厖鍊奸噾棰濓紙鍒嗭級 Long sessionId = order.getSessionId(); - Long virtualId = order.getVirtualId(); + Long virtualId = order.getVcId(); Integer rechargeAmount = order.getRechargeAmount(); String prepayId = ""; - //SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId)); - //String openid = po.getOpenId(); SeOpenId po = paymentSv.selectOne(sessionId); String openid = po.getOpenId(); @@ -245,7 +192,7 @@ //璁㈠崟閲戦 JSONObject job_amount = new JSONObject(); - job_amount.put("total", 1); + job_amount.put("total", rechargeAmount); job_amount.put("currency", "CNY"); job_body.put("amount", job_amount); @@ -278,9 +225,47 @@ } /** + * 鍐嶆绛惧悕 + * @param prepayId 棰勬敮浠樹氦鏄撲細璇濇爣璇� + * @return 灏忕▼搴忚皟璧锋敮浠樺弬鏁� + * @throws Exception + */ + @Operation(summary = "鍐嶆绛惧悕", description = "鍐嶆绛惧悕") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @GetMapping(path = "/signAgain") + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<JSONObject> signAgain(@RequestParam("prepayId") String prepayId) throws Exception { + + // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇� + String appid = PayInfo.appid; + String timeStamp = String.valueOf(System.currentTimeMillis() / 1000); + String nonceStr = payHelper.generateRandomString(); + String pkg = "prepay_id=" + prepayId; + String message = payHelper.buildMessage_signAgain(appid, timeStamp, nonceStr, pkg); + String paySign = payHelper.sign(message.getBytes("utf-8"), privateCertFileName); + + JSONObject job_result = new JSONObject(); + job_result.put("timeStamp", timeStamp); + job_result.put("nonceStr", nonceStr); + job_result.put("package", pkg); + job_result.put("signType", signType); + job_result.put("paySign", paySign); + + return BaseResponseUtils.buildSuccess(job_result) ; + } + + /** * 鏀粯閫氱煡/閫�娆剧粨鏋滈�氱煡 * @param headers - * @param orderNotify + * @param request * @param response * @return * @throws IOException @@ -298,12 +283,12 @@ @PostMapping(path = "orderNotify", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() - public JSONObject orderNotify(@RequestHeader HttpHeaders headers, @RequestBody OrderNotify orderNotify, HttpServletResponse response) throws IOException, GeneralSecurityException { + public JSONObject orderNotify(@RequestHeader HttpHeaders headers, HttpServletRequest request, HttpServletResponse response) throws IOException, GeneralSecurityException { JSONObject result = new JSONObject(); /** * 1.楠岀澶勭悊 - * 浠巋eader涓彇鍑�4涓瓙鍙傛暟锛屽悓鏃跺彇鍑篵ody + * 浠巋eader涓彇鍑�4涓瓙鍙傛暟 * 楠屾椂闂村樊锛岃秴杩�5鍒嗛挓鐨勪笉澶勭悊 * 楠岃瘉绛惧悕 * 楠岃瘉涔﹀簭鍒楀彿锛屽繀椤讳笌鏌愪竴涓瘉涔︾殑搴忓垪鍙蜂竴鑷� @@ -312,7 +297,18 @@ String wechatpaySerial = String.valueOf(headers.get("Wechatpay-Serial").get(0)); String wechatpaySignature = String.valueOf(headers.get("Wechatpay-Signature").get(0)); String wechatpayTimestamp = String.valueOf(headers.get("Wechatpay-Timestamp").get(0)); - String bodyStr = JSONObject.toJSONString(orderNotify); + + // 鑾峰彇body鍐呭 + BufferedReader reader = request.getReader(); + StringBuilder stringBuilder = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + stringBuilder.append(line); + } + String bodyStr = stringBuilder.toString(); + + // body杞璞� + OrderNotify orderNotify = JSON.parseObject(bodyStr, OrderNotify.class); // 楠屾椂闂存埑锛屾椂闂村樊澶т簬5鍒嗛挓鐨勬嫆缁� Long timeDiff = (System.currentTimeMillis() / 1000 - Long.parseLong(wechatpayTimestamp))/60; @@ -348,10 +344,7 @@ return result; } - /** - * 瑙e瘑澶勭悊 - * 1 - */ + // 瑙e瘑澶勭悊 String eventType = orderNotify.getEvent_type(); if(eventType != null && eventType.equals("TRANSACTION.SUCCESS")) { @@ -361,7 +354,7 @@ * 鍙栧嚭閫氱煡鏁版嵁瀵硅薄锛岀户鑰屽彇鍑鸿В瀵嗘墍闇�鐨刟ssociatedData鍜宯once锛屼互鍙婂瘑鏂嘽iphertext * 瑙e瘑ciphertext寰楀埌 */ - OrderNotify.NotifyResource notifyResource = orderNotify.getResource(); + NotifyResource notifyResource = orderNotify.getResource(); String associatedData = notifyResource.getAssociated_data(); String nonce = notifyResource.getNonce(); String ciphertext = notifyResource.getCiphertext(); @@ -369,19 +362,22 @@ String resource = AesUtil.decryptToString(PayInfo.key.getBytes("utf-8"), associatedData.getBytes("utf-8"), nonce.getBytes("utf-8"), ciphertext); JSONObject job_resource = JSONObject.parseObject(resource); - // 瑙e瘑鍚庡彇鍑猴細鍟嗘埛璁㈠崟鍛樸�佸井淇℃敮浠樿鍗曞彿銆佷氦鏄撶姸鎬併�佹敮浠樺畬鎴愭椂闂� + // 瑙e瘑鍚庡彇鍑猴細鍟嗘埛璁㈠崟鍙枫�佸井淇℃敮浠樿鍗曞彿銆佷氦鏄撶姸鎬併�佹敮浠樺畬鎴愭椂闂� String out_trade_no = job_resource.getString("out_trade_no"); String transaction_id = job_resource.getString("transaction_id"); String trade_state = job_resource.getString("trade_state"); Date success_time = job_resource.getDate("success_time"); - // 鏇存柊铏氭嫙鍗¤〃鍙婂厖鍊艰〃鍝嶅簲瀛楁 - BaseResponse result_ = virtualCardSv.updateVCRecharge(out_trade_no, success_time); - if(!result_.getCode().equals("0001")) { - response.setStatus(500); - result.put("code", "FAIL"); - result.put("message", "澶辫触"); - return result; + // 濡傛灉褰撳墠璁㈠崟鐘舵�佷负鏈敮浠樼姸鎬侊紝鍒欐洿鏂拌櫄鎷熷崱琛ㄥ強鍏呭�艰〃鍝嶅簲瀛楁 + SeVcRecharge seVcRecharge = virtualCardSv.getVCRechargeByorderNumber(out_trade_no); + if(seVcRecharge != null && seVcRecharge.getOrderState() == 1) { + BaseResponse result_ = virtualCardSv.updateVCRecharge(out_trade_no, success_time); + if(!result_.getCode().equals("0001")) { + response.setStatus(500); + result.put("code", "FAIL"); + result.put("message", "澶辫触"); + return result; + } } } else if(eventType != null && eventType.equals("REFUND.SUCCESS")) { // 閫�娆炬垚鍔熷悗鍥炶皟 @@ -390,7 +386,7 @@ * 鍙栧嚭閫氱煡鏁版嵁瀵硅薄锛岀户鑰屽彇鍑鸿В瀵嗘墍闇�鐨刟ssociatedData鍜宯once锛屼互鍙婂瘑鏂嘽iphertext * 瑙e瘑ciphertext寰楀埌 */ - OrderNotify.NotifyResource notifyResource = orderNotify.getResource(); + NotifyResource notifyResource = orderNotify.getResource(); String associatedData = notifyResource.getAssociated_data(); String nonce = notifyResource.getNonce(); String ciphertext = notifyResource.getCiphertext(); @@ -454,43 +450,5 @@ result.put("code", "SUCCESS"); result.put("message", "鎴愬姛"); return result; - } - - /** - * 鍐嶆绛惧悕 - * @param prepayId 棰勬敮浠樹氦鏄撲細璇濇爣璇� - * @return 灏忕▼搴忚皟璧锋敮浠樺弬鏁� - * @throws Exception - */ - @Operation(summary = "鍐嶆绛惧悕", description = "鍐嶆绛惧悕") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) - @GetMapping(path = "/signAgain") - @Transactional(rollbackFor = Exception.class) - @SsoAop() - public BaseResponse<JSONObject> signAgain(@RequestParam("prepayId") String prepayId) throws Exception { - - // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇� - String appid = PayInfo.appid; - String timestamp = String.valueOf(System.currentTimeMillis() / 1000); - String nonceStr = payHelper.generateRandomString(); - String pkg = "prepay_id=" + prepayId; - String message = payHelper.buildMessage_signAgain(appid, timestamp, nonceStr, pkg); - String paySign = payHelper.sign(message.getBytes("utf-8"), privateCertFileName); - - JSONObject job_result = new JSONObject(); - job_result.put("timestamp", timestamp); - job_result.put("nonceStr", nonceStr); - job_result.put("package", pkg); - job_result.put("signType", signType); - job_result.put("paySign", paySign); - - return BaseResponseUtils.buildSuccess(job_result) ; } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java index 6a3075d..2dce1c1 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java @@ -2,10 +2,8 @@ import com.dy.pipIrrGlobal.daoSe.SeOpenIdMapper; import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper; -import com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper; import com.dy.pipIrrGlobal.pojoSe.SeOpenId; import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge; -import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,33 +19,16 @@ @Service public class PaymentSv { @Autowired - private SeWebchatLogonStateMapper seWebchatLogonStateMapper; - - @Autowired private SeVcRechargeMapper seVcRechargeMapper; @Autowired private SeOpenIdMapper seOpenIdMapper; /** - * 娣诲姞鐧诲綍鎬佺姸鎬佽褰� - * @param po - * @return - */ - Long insert(SeWebchatLogonState po) { - seWebchatLogonStateMapper.insert(po); - return po.getId(); - } - - /** * 鏍规嵁鐧诲綍鎬両D鑾峰彇鐧诲綍鎬佸璞� - * @param id + * @param sessionId * @return */ - SeWebchatLogonState selectOne2(Long id) { - return seWebchatLogonStateMapper.selectByPrimaryKey(id); - } - SeOpenId selectOne(Long sessionId) { return seOpenIdMapper.selectByPrimaryKey(sessionId); } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java index 66f726d..f4ef320 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java @@ -24,11 +24,11 @@ private Long sessionId; /** - * 铏氭嫙鍗$紪鍙凤紝澶栭敭锛岀敤鏉ヨ幏鍙栬櫄鎷熷崱浣欓 + * 铏氭嫙鍗D锛岀敤鏉ヨ幏鍙栬櫄鎷熷崱浣欓 */ @Schema(description = "铏氭嫙鍗$紪鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @NotNull(message = "铏氭嫙鍗$紪鍙蜂笉鑳戒负绌�") - private Long virtualId; + @NotNull(message = "铏氭嫙鍗D涓嶈兘涓虹┖") + private Long vcId; /** * 鍏呭�奸噾棰濋噾棰� diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/NotifyResource.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/NotifyResource.java new file mode 100644 index 0000000..159d91a --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/NotifyResource.java @@ -0,0 +1,40 @@ +package com.dy.pipIrrSell.wechatpay.dto; + +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-06-13 19:16 + * @LastEditTime 2024-06-13 19:16 + * @Description + */ + +@Data +public class NotifyResource { + /** + * 鍘熷绫诲瀷 + * 鍘熷鍥炶皟绫诲瀷涓猴細transaction + */ + private String original_type; + + /** + * 鍔犲瘑绠楁硶绫诲瀷 + * 浠呮敮鎸丄EAD_AES_256_GCM + */ + private String algorithm; + + /** + * 鏁版嵁瀵嗘枃 + */ + private String ciphertext; + + /** + * 闄勫姞鏁版嵁 + */ + public String associated_data; + + /** + * 闅忔満涓� + */ + private String nonce; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java index dff01c7..1d44981 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java @@ -48,34 +48,34 @@ private String summary; - @Data - public class NotifyResource { - - /** - * 鍔犲瘑绠楁硶绫诲瀷 - * 浠呮敮鎸丄EAD_AES_256_GCM - */ - private String algorithm; - - /** - * 鏁版嵁瀵嗘枃 - */ - private String ciphertext; - - /** - * 闄勫姞鏁版嵁 - */ - public String associated_data; - - /** - * 鍘熷绫诲瀷 - * 鍘熷鍥炶皟绫诲瀷涓猴細transaction - */ - private String original_type; - - /** - * 闅忔満涓� - */ - private String nonce; - } + //@Data + //public class NotifyResource { + // + // /** + // * 鍔犲瘑绠楁硶绫诲瀷 + // * 浠呮敮鎸丄EAD_AES_256_GCM + // */ + // private String algorithm; + // + // /** + // * 鏁版嵁瀵嗘枃 + // */ + // private String ciphertext; + // + // /** + // * 闄勫姞鏁版嵁 + // */ + // public String associated_data; + // + // /** + // * 鍘熷绫诲瀷 + // * 鍘熷鍥炶皟绫诲瀷涓猴細transaction + // */ + // private String original_type; + // + // /** + // * 闅忔満涓� + // */ + // private String nonce; + //} } \ No newline at end of file -- Gitblit v1.8.0