From f77bf50a9c210e2554d7b7cd1f6d8ab4015214ae Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Mon, 15 Jan 2024 07:18:24 +0000 Subject: [PATCH 01/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=88=BF=E5=B1=8B?= =?UTF-8?q?=E6=94=B6=E8=B4=B9=EF=BC=8C=E5=AF=BC=E5=85=A5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=9A=E9=81=8D=E6=97=B6=20=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../mapper/report/ReportCommunityServiceDaoImplMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml index 5601e4283d..e72ebaa1c8 100755 --- a/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml @@ -249,7 +249,7 @@ - SELECT t.room_id, + SELECT distinct t.room_id, t.room_id roomId, t.layer, t.room_num, From 5a7f9c345d483f5bb355b4e2dd0dcafa8193689d Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Wed, 17 Jan 2024 02:20:51 +0000 Subject: [PATCH 02/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=B4=A7=E6=80=A5?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=8A=A5=E9=94=99bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../mapper/store/ResourceStoreServiceDaoImplMapper.xml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/java110-db/src/main/resources/mapper/store/ResourceStoreServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/store/ResourceStoreServiceDaoImplMapper.xml index 5105186bfe..5a18bab4ce 100755 --- a/java110-db/src/main/resources/mapper/store/ResourceStoreServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/store/ResourceStoreServiceDaoImplMapper.xml @@ -210,14 +210,12 @@ averagePrice,rss.spec_name rssName,t.mini_unit_code,t.mini_unit_code miniUnitCode,t.mini_stock,t.mini_stock miniStock,t.mini_unit_stock,t.mini_unit_stock miniUnitStock,td.name unitCodeName,td1.name miniUnitCodeName,t.parent_rst_id parentRstId,t.rst_id rstId,rst1.name parentRstName,rst.name - rstName,rstm.times_id timesId, - t.is_fixed,t.is_fixed isFixed,td2.name isFixedName,t.community_id communityId + rstName,t.is_fixed,t.is_fixed isFixed,td2.name isFixedName,t.community_id communityId from resource_store t left join resource_store_type rst on t.rst_id = rst.rst_id and rst.status_cd = '0' left join resource_store_type rst1 on t.parent_rst_id = rst1.rst_id and rst1.status_cd = '0' left join resource_store_specification rss on t.rss_id = rss.rss_id and rss.status_cd = '0' left join storehouse sh on t.sh_id = sh.sh_id and t.store_id = sh.store_id and sh.status_cd = '0' - left join resource_store_times rstm on t.res_code = rstm.res_code and rstm.status_cd = '0' left join t_dict td on t.unit_code = td.status_cd and td.table_name = 'resource_store' and td.table_columns = 'unit_code' left join t_dict td1 on t.mini_unit_code = td1.status_cd and td1.table_name = 'resource_store' and @@ -321,7 +319,7 @@ and t.stock > 0 - order by t.res_code + order by t.create_time desc limit #{page}, #{row} @@ -414,7 +412,6 @@ left join resource_store_type rst1 on t.parent_rst_id = rst1.rst_id and rst1.status_cd = '0' left join resource_store_specification rss on t.rss_id = rss.rss_id and rss.status_cd = '0' left join storehouse sh on t.sh_id = sh.sh_id and t.store_id = sh.store_id and sh.status_cd = '0' - left join resource_store_times rstm on t.res_code = rstm.res_code and rstm.status_cd = '0' left join t_dict td on t.unit_code = td.status_cd and td.table_name = 'resource_store' and td.table_columns = 'unit_code' left join t_dict td1 on t.mini_unit_code = td1.status_cd and td1.table_name = 'resource_store' and From 825645a9f425eb7521a85fdc4c799091f498ee24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=BF=AA?= Date: Wed, 17 Jan 2024 07:24:04 +0000 Subject: [PATCH 03/37] =?UTF-8?q?update=20java110-core/src/main/java/com/j?= =?UTF-8?q?ava110/core/log/LoggerFactory.java.=20=E4=BF=AE=E5=A4=8Dbug?= =?UTF-8?q?=EF=BC=9AisWarnEnabled()=E8=B0=83=E7=94=A8=E8=87=AA=E8=BA=AB?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=A0=86=E6=A0=88=E6=BA=A2=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 安迪 --- .../src/main/java/com/java110/core/log/LoggerFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java110-core/src/main/java/com/java110/core/log/LoggerFactory.java b/java110-core/src/main/java/com/java110/core/log/LoggerFactory.java index b893ec1a2f..c00efd2534 100644 --- a/java110-core/src/main/java/com/java110/core/log/LoggerFactory.java +++ b/java110-core/src/main/java/com/java110/core/log/LoggerFactory.java @@ -355,6 +355,6 @@ public void info(Marker marker, String msg, Throwable t) { @Override public boolean isWarnEnabled() { - return this.isWarnEnabled(); + return this.logger.isWarnEnabled(); } } From 006389ede4a3b9802ed97996793c377a4cdff07b Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Thu, 18 Jan 2024 07:13:08 +0000 Subject: [PATCH 04/37] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- springboot/src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/springboot/src/main/resources/application.yml b/springboot/src/main/resources/application.yml index bfa50977b3..caf4dfcd64 100644 --- a/springboot/src/main/resources/application.yml +++ b/springboot/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: debug \ No newline at end of file + active: dev \ No newline at end of file From 2a6fc916b7b70069a9248182fead9277a8d05e1d Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Thu, 18 Jan 2024 07:45:40 +0000 Subject: [PATCH 05/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../owner/impl/GeneratorOwnerUserBMOImpl.java | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/service-user/src/main/java/com/java110/user/bmo/owner/impl/GeneratorOwnerUserBMOImpl.java b/service-user/src/main/java/com/java110/user/bmo/owner/impl/GeneratorOwnerUserBMOImpl.java index 2dbe2aeb1f..9a7f20b400 100644 --- a/service-user/src/main/java/com/java110/user/bmo/owner/impl/GeneratorOwnerUserBMOImpl.java +++ b/service-user/src/main/java/com/java110/user/bmo/owner/impl/GeneratorOwnerUserBMOImpl.java @@ -3,6 +3,7 @@ import com.java110.core.factory.AuthenticationFactory; import com.java110.core.factory.GenerateCodeFactory; import com.java110.dto.community.CommunityDto; +import com.java110.dto.user.UserDto; import com.java110.intf.community.ICommunityInnerServiceSMO; import com.java110.intf.user.IOwnerAppUserV1InnerServiceSMO; import com.java110.intf.user.IUserV1InnerServiceSMO; @@ -15,6 +16,7 @@ import com.java110.utils.constant.UserLevelConstant; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.ListUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,18 +50,29 @@ public void generator(OwnerPo ownerPo) { Assert.listNotNull(communityDtos, "未包含小区信息"); CommunityDto tmpCommunityDto = communityDtos.get(0); - UserPo userPo = new UserPo(); - userPo.setUserId(GenerateCodeFactory.getUserId()); - userPo.setName(ownerPo.getName()); - userPo.setTel(ownerPo.getLink()); - userPo.setPassword(AuthenticationFactory.passwdMd5(ownerPo.getLink())); - userPo.setLevelCd(UserLevelConstant.USER_LEVEL_ORDINARY); - userPo.setAge(ownerPo.getAge()); - userPo.setAddress(ownerPo.getAddress()); - userPo.setSex(ownerPo.getSex()); - flag = userV1InnerServiceSMOImpl.saveUser(userPo); - if (flag < 1) { - throw new CmdException("注册失败"); + UserDto userDto = new UserDto(); + userDto.setTel(ownerPo.getLink()); + userDto.setLevelCd(UserLevelConstant.USER_LEVEL_ORDINARY); + List userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto); + String userId = ""; + if (ListUtil.isNull(userDtos)) { + UserPo userPo = new UserPo(); + userPo.setUserId(GenerateCodeFactory.getUserId()); + userPo.setName(ownerPo.getName()); + userPo.setTel(ownerPo.getLink()); + userPo.setPassword(AuthenticationFactory.passwdMd5(ownerPo.getLink())); + userPo.setLevelCd(UserLevelConstant.USER_LEVEL_ORDINARY); + userPo.setAge(ownerPo.getAge()); + userPo.setAddress(ownerPo.getAddress()); + userPo.setSex(ownerPo.getSex()); + flag = userV1InnerServiceSMOImpl.saveUser(userPo); + if (flag < 1) { + throw new CmdException("注册失败"); + } + userId = userPo.getUserId(); + } else { + userId = userDtos.get(0).getUserId(); + } OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo(); @@ -74,7 +87,7 @@ public void generator(OwnerPo ownerPo) { ownerAppUserPo.setIdCard(ownerPo.getIdCard()); ownerAppUserPo.setAppType("WECHAT"); ownerAppUserPo.setLink(ownerPo.getLink()); - ownerAppUserPo.setUserId(userPo.getUserId()); + ownerAppUserPo.setUserId(userId); ownerAppUserPo.setOpenId("-1"); flag = ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo); From d7e8567967120bd07fb0e9781cb224666b3466e7 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Fri, 19 Jan 2024 06:59:01 +0000 Subject: [PATCH 06/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=94=BE=E8=A1=8C=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../com/java110/common/cmd/itemRelease/SaveItemReleaseCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-common/src/main/java/com/java110/common/cmd/itemRelease/SaveItemReleaseCmd.java b/service-common/src/main/java/com/java110/common/cmd/itemRelease/SaveItemReleaseCmd.java index 11ba2b0f59..9cdc97192d 100644 --- a/service-common/src/main/java/com/java110/common/cmd/itemRelease/SaveItemReleaseCmd.java +++ b/service-common/src/main/java/com/java110/common/cmd/itemRelease/SaveItemReleaseCmd.java @@ -111,7 +111,7 @@ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 */ -@Java110Cmd(serviceCode = " itemRelease.saveItemRelease") +@Java110Cmd(serviceCode = "itemRelease.saveItemRelease") public class SaveItemReleaseCmd extends Cmd { private static Logger logger = LoggerFactory.getLogger(SaveItemReleaseCmd.class); From 7499ee1266a318e0868677ca78477786331dc4a5 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Tue, 30 Jan 2024 07:48:44 +0000 Subject: [PATCH 07/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E8=B5=84=E4=BA=A7=E6=8F=90=E7=A4=BA=E8=A1=8C=E6=95=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../ImportRoomOwnerDataCleaningAdapt.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/springboot/src/main/java/com/java110/boot/importData/adapt/ImportRoomOwnerDataCleaningAdapt.java b/springboot/src/main/java/com/java110/boot/importData/adapt/ImportRoomOwnerDataCleaningAdapt.java index 2a394f9924..67f6bd9688 100644 --- a/springboot/src/main/java/com/java110/boot/importData/adapt/ImportRoomOwnerDataCleaningAdapt.java +++ b/springboot/src/main/java/com/java110/boot/importData/adapt/ImportRoomOwnerDataCleaningAdapt.java @@ -128,13 +128,13 @@ private void validateRoomInfo(List ownerRooms) { importOwnerRoomDto = ownerRooms.get(roomIndex); // 1、楼栋单元房屋 中不支持 - # ? & 等特殊符号 if (hasSpecialCharacters(importOwnerRoomDto.getFloorNum())) { - throw new IllegalArgumentException((roomIndex + 1) + "行楼栋中包含特殊符号 - # ? & 请删除!"); + throw new IllegalArgumentException((roomIndex + 2) + "行楼栋中包含特殊符号 - # ? & 请删除!"); } if (hasSpecialCharacters(importOwnerRoomDto.getUnitNum())) { - throw new IllegalArgumentException((roomIndex + 1) + "行单元中包含特殊符号 - # ? & 请删除!"); + throw new IllegalArgumentException((roomIndex + 2) + "行单元中包含特殊符号 - # ? & 请删除!"); } if (hasRoomSpecialCharacters(importOwnerRoomDto.getRoomNum())) { - throw new IllegalArgumentException((roomIndex + 1) + "行单元中包含特殊符号 - # ? & 请删除!"); + throw new IllegalArgumentException((roomIndex + 2) + "行单元中包含特殊符号 - # ? & 请删除!"); } // if (!StringUtil.isNumber(importOwnerRoomDto.getLayer())) { @@ -142,25 +142,25 @@ private void validateRoomInfo(List ownerRooms) { // } if (!StringUtil.isNumber(importOwnerRoomDto.getLayerCount())) { - throw new IllegalArgumentException((roomIndex + 1) + "行总楼层不是有效数字"); + throw new IllegalArgumentException((roomIndex + 2) + "行总楼层不是有效数字"); } if (!StringUtil.isNumber(importOwnerRoomDto.getRoomSubType())) { - throw new IllegalArgumentException((roomIndex + 1) + "行房屋类型不是有效数字"); + throw new IllegalArgumentException((roomIndex + 2) + "行房屋类型不是有效数字"); } if (StringUtil.isEmpty(importOwnerRoomDto.getSection())) { - throw new IllegalArgumentException((roomIndex + 1) + "行房屋户型不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行房屋户型不能为空"); } if (StringUtil.isEmpty(importOwnerRoomDto.getBuiltUpArea())) { - throw new IllegalArgumentException((roomIndex + 1) + "行建筑面积不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行建筑面积不能为空"); } if (StringUtil.isEmpty(importOwnerRoomDto.getRoomArea())) { - throw new IllegalArgumentException((roomIndex + 1) + "行室内面积不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行室内面积不能为空"); } if (StringUtil.isEmpty(importOwnerRoomDto.getRoomRent())) { - throw new IllegalArgumentException((roomIndex + 1) + "行租金不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行租金不能为空"); } // 如果为空说明 房屋目前是空闲没有业主 if (StringUtil.isEmpty(importOwnerRoomDto.getOwnerName())) { @@ -168,7 +168,7 @@ private void validateRoomInfo(List ownerRooms) { } if (StringUtil.isEmpty(importOwnerRoomDto.getSex())) { - throw new IllegalArgumentException((roomIndex + 1) + "行性别不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行性别不能为空"); } // if (StringUtil.isEmpty(importOwnerRoomDto.getAge())) { @@ -177,11 +177,11 @@ private void validateRoomInfo(List ownerRooms) { //系统目前 在香港台湾 以及新加坡等地都有商用 所以 并不是中国大陆手机号规则 所以不做严格校验 //烦请专业测试团队勿喷 if (StringUtil.isEmpty(importOwnerRoomDto.getTel())) { - throw new IllegalArgumentException((roomIndex + 1) + "行手机号不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行手机号不能为空"); } if (importOwnerRoomDto.getTel().length() > 11) { - throw new IllegalArgumentException((roomIndex + 1) + "行手机号超过11位,请核实"); + throw new IllegalArgumentException((roomIndex + 2) + "行手机号超过11位,请核实"); } // if (StringUtil.isEmpty(importOwnerRoomDto.getIdCard())) { @@ -189,18 +189,18 @@ private void validateRoomInfo(List ownerRooms) { // } if (!StringUtil.isEmpty(importOwnerRoomDto.getIdCard()) && importOwnerRoomDto.getIdCard().length() > 18) { - throw new IllegalArgumentException((roomIndex + 1) + " 的身份证超过18位,请核实"); + throw new IllegalArgumentException((roomIndex + 2) + " 的身份证超过18位,请核实"); } if (!StringUtil.isNumber(importOwnerRoomDto.getOwnerTypeCd())) { - throw new IllegalArgumentException((roomIndex + 1) + "行业主类型不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行业主类型不能为空"); } if (RoomDto.STATE_FREE.equals(importOwnerRoomDto.getRoomState()) && !StringUtil.isEmpty(importOwnerRoomDto.getOwnerName())) { - throw new IllegalArgumentException((roomIndex + 1) + "行房屋状态为未销售状态,不能包含业主信息"); + throw new IllegalArgumentException((roomIndex + 2) + "行房屋状态为未销售状态,不能包含业主信息"); } if (!RoomDto.STATE_FREE.equals(importOwnerRoomDto.getRoomState()) && StringUtil.isEmpty(importOwnerRoomDto.getOwnerName())) { - throw new IllegalArgumentException((roomIndex + 1) + "行房屋状态不是未销售状态,必须包含业主信息"); + throw new IllegalArgumentException((roomIndex + 2) + "行房屋状态不是未销售状态,必须包含业主信息"); } // 如果是业主 跳过 @@ -222,7 +222,7 @@ private void validateRoomInfo(List ownerRooms) { } if (!hasOwnerType) { - throw new IllegalArgumentException((roomIndex + 1) + "行一个房屋必须要有业主存在 才能 写家庭成员和房屋租客 和临时人员,并且业主要写在 其他之前"); + throw new IllegalArgumentException((roomIndex + 2) + "行一个房屋必须要有业主存在 才能 写家庭成员和房屋租客 和临时人员,并且业主要写在 其他之前"); } } } From b2cdf725f282e3f2dc4882ca969b986d3a41f309 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Tue, 30 Jan 2024 07:49:40 +0000 Subject: [PATCH 08/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../ImportRoomOwnerDataCleaningAdapt.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/service-api/src/main/java/com/java110/api/importData/adapt/ImportRoomOwnerDataCleaningAdapt.java b/service-api/src/main/java/com/java110/api/importData/adapt/ImportRoomOwnerDataCleaningAdapt.java index 6586c94025..505c086059 100644 --- a/service-api/src/main/java/com/java110/api/importData/adapt/ImportRoomOwnerDataCleaningAdapt.java +++ b/service-api/src/main/java/com/java110/api/importData/adapt/ImportRoomOwnerDataCleaningAdapt.java @@ -122,13 +122,13 @@ private void validateRoomInfo(List ownerRooms) { importOwnerRoomDto = ownerRooms.get(roomIndex); // 1、楼栋单元房屋 中不支持 - # ? & 等特殊符号 if (hasSpecialCharacters(importOwnerRoomDto.getFloorNum())) { - throw new IllegalArgumentException((roomIndex + 1) + "行楼栋中包含特殊符号 - # ? & 请删除!"); + throw new IllegalArgumentException((roomIndex + 2) + "行楼栋中包含特殊符号 - # ? & 请删除!"); } if (hasSpecialCharacters(importOwnerRoomDto.getUnitNum())) { - throw new IllegalArgumentException((roomIndex + 1) + "行单元中包含特殊符号 - # ? & 请删除!"); + throw new IllegalArgumentException((roomIndex + 2) + "行单元中包含特殊符号 - # ? & 请删除!"); } if (hasRoomSpecialCharacters(importOwnerRoomDto.getRoomNum())) { - throw new IllegalArgumentException((roomIndex + 1) + "行单元中包含特殊符号 - # ? & 请删除!"); + throw new IllegalArgumentException((roomIndex + 2) + "行单元中包含特殊符号 - # ? & 请删除!"); } // if (!StringUtil.isNumber(importOwnerRoomDto.getLayer())) { @@ -136,25 +136,25 @@ private void validateRoomInfo(List ownerRooms) { // } if (!StringUtil.isNumber(importOwnerRoomDto.getLayerCount())) { - throw new IllegalArgumentException((roomIndex + 1) + "行总楼层不是有效数字"); + throw new IllegalArgumentException((roomIndex + 2) + "行总楼层不是有效数字"); } if (!StringUtil.isNumber(importOwnerRoomDto.getRoomSubType())) { - throw new IllegalArgumentException((roomIndex + 1) + "行房屋类型不是有效数字"); + throw new IllegalArgumentException((roomIndex + 2) + "行房屋类型不是有效数字"); } if (StringUtil.isEmpty(importOwnerRoomDto.getSection())) { - throw new IllegalArgumentException((roomIndex + 1) + "行房屋户型不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行房屋户型不能为空"); } if (StringUtil.isEmpty(importOwnerRoomDto.getBuiltUpArea())) { - throw new IllegalArgumentException((roomIndex + 1) + "行建筑面积不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行建筑面积不能为空"); } if (StringUtil.isEmpty(importOwnerRoomDto.getRoomArea())) { - throw new IllegalArgumentException((roomIndex + 1) + "行室内面积不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行室内面积不能为空"); } if (StringUtil.isEmpty(importOwnerRoomDto.getRoomRent())) { - throw new IllegalArgumentException((roomIndex + 1) + "行租金不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行租金不能为空"); } // 如果为空说明 房屋目前是空闲没有业主 if (StringUtil.isEmpty(importOwnerRoomDto.getOwnerName())) { @@ -162,7 +162,7 @@ private void validateRoomInfo(List ownerRooms) { } if (StringUtil.isEmpty(importOwnerRoomDto.getSex())) { - throw new IllegalArgumentException((roomIndex + 1) + "行性别不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行性别不能为空"); } // if (StringUtil.isEmpty(importOwnerRoomDto.getAge())) { @@ -171,11 +171,11 @@ private void validateRoomInfo(List ownerRooms) { //系统目前 在香港台湾 以及新加坡等地都有商用 所以 并不是中国大陆手机号规则 所以不做严格校验 //烦请专业测试团队勿喷 if (StringUtil.isEmpty(importOwnerRoomDto.getTel())) { - throw new IllegalArgumentException((roomIndex + 1) + "行手机号不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行手机号不能为空"); } if (importOwnerRoomDto.getTel().length() > 11) { - throw new IllegalArgumentException((roomIndex + 1) + "行手机号超过11位,请核实"); + throw new IllegalArgumentException((roomIndex + 2) + "行手机号超过11位,请核实"); } // if (StringUtil.isEmpty(importOwnerRoomDto.getIdCard())) { @@ -183,18 +183,18 @@ private void validateRoomInfo(List ownerRooms) { // } if (!StringUtil.isEmpty(importOwnerRoomDto.getIdCard()) && importOwnerRoomDto.getIdCard().length() > 18) { - throw new IllegalArgumentException((roomIndex + 1) + " 的身份证超过18位,请核实"); + throw new IllegalArgumentException((roomIndex + 2) + " 的身份证超过18位,请核实"); } if (!StringUtil.isNumber(importOwnerRoomDto.getOwnerTypeCd())) { - throw new IllegalArgumentException((roomIndex + 1) + "行业主类型不能为空"); + throw new IllegalArgumentException((roomIndex + 2) + "行业主类型不能为空"); } if (RoomDto.STATE_FREE.equals(importOwnerRoomDto.getRoomState()) && !StringUtil.isEmpty(importOwnerRoomDto.getOwnerName())) { - throw new IllegalArgumentException((roomIndex + 1) + "行房屋状态为未销售状态,不能包含业主信息"); + throw new IllegalArgumentException((roomIndex + 2) + "行房屋状态为未销售状态,不能包含业主信息"); } if (!RoomDto.STATE_FREE.equals(importOwnerRoomDto.getRoomState()) && StringUtil.isEmpty(importOwnerRoomDto.getOwnerName())) { - throw new IllegalArgumentException((roomIndex + 1) + "行房屋状态不是未销售状态,必须包含业主信息"); + throw new IllegalArgumentException((roomIndex + 2) + "行房屋状态不是未销售状态,必须包含业主信息"); } // 如果是业主 跳过 @@ -216,7 +216,7 @@ private void validateRoomInfo(List ownerRooms) { } if (!hasOwnerType) { - throw new IllegalArgumentException((roomIndex + 1) + "行一个房屋必须要有业主存在 才能 写家庭成员和房屋租客 和临时人员,并且业主要写在 其他之前"); + throw new IllegalArgumentException((roomIndex + 2) + "行一个房屋必须要有业主存在 才能 写家庭成员和房屋租客 和临时人员,并且业主要写在 其他之前"); } } } From b23fababdd33734f2d06f1f7e023c67069b49f8a Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Thu, 1 Feb 2024 08:57:25 +0000 Subject: [PATCH 09/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../java/com/java110/api/smo/DefaultAbstractComponentSMO.java | 4 ++-- .../com/java110/boot/smo/DefaultAbstractComponentSMO.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java b/service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java index f650be94e6..ba948358d1 100644 --- a/service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java +++ b/service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java @@ -91,10 +91,10 @@ protected ResponseEntity callCenterService(RestTemplate restTemplate, IP headers.put(CommonConstant.USER_ID, StringUtil.isEmpty(pd.getUserId()) ? "-1" : pd.getUserId()); if (!headers.containsKey(CommonConstant.HTTP_APP_ID)) { - headers.put(CommonConstant.HTTP_APP_ID, AppDto.WEB_APP_ID); + headers.put(CommonConstant.HTTP_APP_ID, pd.getAppId()); } if (!headers.containsKey(CommonConstant.APP_ID)) { - headers.put(CommonConstant.APP_ID, AppDto.WEB_APP_ID); + headers.put(CommonConstant.APP_ID, pd.getAppId()); } if (!headers.containsKey(CommonConstant.HTTP_TRANSACTION_ID)) { diff --git a/springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java b/springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java index 9f4da14f9d..3a1fc2095b 100644 --- a/springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java +++ b/springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java @@ -92,10 +92,10 @@ protected ResponseEntity callCenterService(RestTemplate restTemplate, IP headers.put(CommonConstant.USER_ID, StringUtil.isEmpty(pd.getUserId()) ? "-1" : pd.getUserId()); if (!headers.containsKey(CommonConstant.HTTP_APP_ID)) { - headers.put(CommonConstant.HTTP_APP_ID, AppDto.WEB_APP_ID); + headers.put(CommonConstant.HTTP_APP_ID, pd.getAppId()); } if (!headers.containsKey(CommonConstant.APP_ID)) { - headers.put(CommonConstant.APP_ID, AppDto.WEB_APP_ID); + headers.put(CommonConstant.APP_ID, pd.getAppId()); } if (!headers.containsKey(CommonConstant.HTTP_TRANSACTION_ID)) { From c7a2215d8c440107167889dcc908e072f77abd76 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Thu, 1 Feb 2024 09:50:18 +0000 Subject: [PATCH 10/37] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../java/com/java110/core/factory/AuthenticationFactory.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java b/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java index e66dbee125..c6a3fd47fc 100755 --- a/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java +++ b/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java @@ -329,6 +329,8 @@ public static void createSign(HttpHeaders headers, HttpMethod httpMethod, String paramStr = param; } String sign = transactionId + requestTime + appId + paramStr + appRoutes.get(0).getSecurityCode(); + logger.debug("鉴权前createSign:{}",sign); + headers.remove("sign"); headers.add("sign", md5(sign)); } @@ -369,6 +371,8 @@ public static void createSign(Map headers, HttpMethod httpMethod paramStr = param; } String sign = transactionId + requestTime + appId + paramStr + appRoutes.get(0).getSecurityCode(); + logger.debug("鉴权前createSign:{}",sign); + headers.put("sign", md5(sign)); } From 43f733f496342e011e4ba676bb40c70b49adf171 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Thu, 1 Feb 2024 10:01:13 +0000 Subject: [PATCH 11/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=89=B4=E6=9D=83bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../com/java110/core/factory/AuthenticationFactory.java | 4 ++-- .../com/java110/api/smo/DefaultAbstractComponentSMO.java | 8 ++++++-- .../com/java110/boot/smo/DefaultAbstractComponentSMO.java | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java b/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java index c6a3fd47fc..daf954c48e 100755 --- a/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java +++ b/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java @@ -311,7 +311,7 @@ public static void createSign(HttpHeaders headers, HttpMethod httpMethod, String transactionId = headers.getFirst(CommonConstant.TRANSACTION_ID); } String requestTime = headers.getFirst(CommonConstant.HTTP_REQ_TIME); - if (StringUtil.isEmpty(transactionId)) { + if (StringUtil.isEmpty(requestTime)) { requestTime = headers.getFirst(CommonConstant.REQUEST_TIME); } @@ -353,7 +353,7 @@ public static void createSign(Map headers, HttpMethod httpMethod transactionId = headers.get(CommonConstant.HTTP_TRANSACTION_ID); } String requestTime = headers.get(CommonConstant.REQUEST_TIME); - if (StringUtil.isEmpty(transactionId)) { + if (StringUtil.isEmpty(requestTime)) { requestTime = headers.get(CommonConstant.HTTP_REQ_TIME); } diff --git a/service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java b/service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java index ba948358d1..4d0533acac 100644 --- a/service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java +++ b/service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java @@ -112,8 +112,10 @@ protected ResponseEntity callCenterService(RestTemplate restTemplate, IP if (HttpMethod.GET == httpMethod) { initUrlParam(JSONObject.parseObject(param), headers); headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url + mapToUrlParam(JSONObject.parseObject(param))); + } else { + headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url); } - AuthenticationFactory.createSign(headers,httpMethod,headers.get("REQUEST_URL"),param); + AuthenticationFactory.createSign(headers, httpMethod, headers.get("REQUEST_URL"), param); try { responseEntity = apiServiceSMOImpl.service(param, headers); @@ -164,8 +166,10 @@ protected ResponseEntity callCenterService(Map headers, } if (HttpMethod.GET == httpMethod) { headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url + mapToUrlParam(JSONObject.parseObject(param))); + }else { + headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url); } - AuthenticationFactory.createSign(headers,httpMethod,headers.get("REQUEST_URL"),param); + AuthenticationFactory.createSign(headers, httpMethod, headers.get("REQUEST_URL"), param); try { responseEntity = apiServiceSMOImpl.service(param, headers); diff --git a/springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java b/springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java index 3a1fc2095b..f40ebd7b84 100644 --- a/springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java +++ b/springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java @@ -113,8 +113,10 @@ protected ResponseEntity callCenterService(RestTemplate restTemplate, IP if (HttpMethod.GET == httpMethod) { initUrlParam(JSONObject.parseObject(param), headers); headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url + mapToUrlParam(JSONObject.parseObject(param))); + } else { + headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url); } - AuthenticationFactory.createSign(headers,httpMethod,headers.get("REQUEST_URL"),param); + AuthenticationFactory.createSign(headers, httpMethod, headers.get("REQUEST_URL"), param); try { responseEntity = apiServiceSMOImpl.service(param, headers); @@ -165,8 +167,10 @@ protected ResponseEntity callCenterService(Map headers, } if (HttpMethod.GET == httpMethod) { headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url + mapToUrlParam(JSONObject.parseObject(param))); + }else { + headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url); } - AuthenticationFactory.createSign(headers,httpMethod,headers.get("REQUEST_URL"),param); + AuthenticationFactory.createSign(headers, httpMethod, headers.get("REQUEST_URL"), param); try { responseEntity = apiServiceSMOImpl.service(param, headers); From d4ec6c57c343e7ba210c0ceb823bd46ddbc35e8d Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Tue, 6 Feb 2024 21:49:49 +0800 Subject: [PATCH 12/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E7=B2=BE=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/java110/utils/util/MoneyUtil.java | 16 ++++++- .../cmd/dataReport/QueryFeeDataReportCmd.java | 25 +++++------ .../QueryReceivedDetailStatisticsCmd.java | 4 +- .../QueryReceivedStatisticsCmd.java | 15 ++++--- .../QueryReportFeeDetailCarCmd.java | 18 +++++--- .../QueryReportFeeDetailContractCmd.java | 18 +++++--- .../QueryReportFeeDetailOwnerCmd.java | 19 +++++--- .../QueryReportFeeDetailRoomCmd.java | 43 +++++++++++-------- .../QueryReportFeeSummaryCmd.java | 13 +++--- 9 files changed, 108 insertions(+), 63 deletions(-) diff --git a/java110-utils/src/main/java/com/java110/utils/util/MoneyUtil.java b/java110-utils/src/main/java/com/java110/utils/util/MoneyUtil.java index c7f16f961e..81ae2bf995 100644 --- a/java110-utils/src/main/java/com/java110/utils/util/MoneyUtil.java +++ b/java110-utils/src/main/java/com/java110/utils/util/MoneyUtil.java @@ -24,7 +24,12 @@ public class MoneyUtil { public static double computePriceScale(double price,String scale,int decimalPlace){ //todo 解决 群里反馈 进度丢失问题 - //todo 发现了个BUG MoneyUtil.computePriceScale 计算金额四舍五入时,精度丢失问题, new BigDecimal(String ) 就OK了, double 会出问题。 例如444.195 四舍五入变成了 44.19 + //todo 发现了个BUG + // MoneyUtil.computePriceScale + // 计算金额四舍五入时,精度丢失问题, + // new BigDecimal(String ) + // 就OK了, double 会出问题。 + // 例如444.195 四舍五入变成了 44.19 BigDecimal feeTotalPrice = new BigDecimal(price+""); if(DOWN.equals(scale)) { @@ -38,5 +43,14 @@ public static double computePriceScale(double price,String scale,int decimalPlac return feeTotalPrice.doubleValue(); } + /** + * 四舍五入 + * @param price + * @return + */ + public static double computePriceScale(double price){ + return computePriceScale(price,HALF_UP,2); + } + } diff --git a/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryFeeDataReportCmd.java b/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryFeeDataReportCmd.java index 5b02ed1b08..bf09636af6 100644 --- a/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryFeeDataReportCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryFeeDataReportCmd.java @@ -11,6 +11,7 @@ import com.java110.report.statistics.IOrderStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.MoneyUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; @@ -59,69 +60,69 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso double receivedFee = feeStatisticsImpl.getReceivedFee(queryStatisticsDto); data = new JSONObject(); data.put("name","实收金额"); - data.put("value", receivedFee); + data.put("value", MoneyUtil.computePriceScale(receivedFee)); datas.add(data); // todo 查询 欠费金额 double oweFee = feeStatisticsImpl.getOweFee(queryStatisticsDto); data = new JSONObject(); data.put("name","欠费金额"); - data.put("value", oweFee); + data.put("value", MoneyUtil.computePriceScale(oweFee)); datas.add(data); // todo 查询 优惠金额 double discountFee = feeStatisticsImpl.getDiscountFee(queryStatisticsDto); data = new JSONObject(); data.put("name","优惠金额"); - data.put("value", discountFee); + data.put("value", MoneyUtil.computePriceScale(discountFee)); datas.add(data); // todo 查询 滞纳金 double lateFee = feeStatisticsImpl.getLateFee(queryStatisticsDto); data = new JSONObject(); data.put("name","滞纳金"); - data.put("value", lateFee); + data.put("value", MoneyUtil.computePriceScale(lateFee)); datas.add(data); // todo 查询 账户预存 double prestoreAccount = feeStatisticsImpl.getPrestoreAccount(queryStatisticsDto); data = new JSONObject(); data.put("name","账户预存"); - data.put("value", prestoreAccount); + data.put("value", MoneyUtil.computePriceScale(prestoreAccount)); datas.add(data); // todo 查询 账户扣款 double withholdAccount = feeStatisticsImpl.getWithholdAccount(queryStatisticsDto); data = new JSONObject(); data.put("name","账户扣款"); - data.put("value", withholdAccount); + data.put("value", MoneyUtil.computePriceScale(withholdAccount)); datas.add(data); // todo 查询 临时车收入 double tempCarFee = feeStatisticsImpl.getTempCarFee(queryStatisticsDto); data = new JSONObject(); data.put("name","临时车收入"); - data.put("value", tempCarFee); + data.put("value", MoneyUtil.computePriceScale(tempCarFee)); datas.add(data); // todo 查询 押金退款 double refundDeposit = feeStatisticsImpl.geRefundDeposit(queryStatisticsDto); data = new JSONObject(); data.put("name","押金退款"); - data.put("value", refundDeposit); + data.put("value", MoneyUtil.computePriceScale(refundDeposit)); datas.add(data); // todo 查询 退款订单数 double refundOrderCount = feeStatisticsImpl.geRefundOrderCount(queryStatisticsDto); data = new JSONObject(); data.put("name","退款订单数"); - data.put("value", refundOrderCount); + data.put("value", MoneyUtil.computePriceScale(refundOrderCount)); datas.add(data); // todo 查询 退款金额 double refundFee = feeStatisticsImpl.geRefundFee(queryStatisticsDto); data = new JSONObject(); data.put("name","退款金额"); - data.put("value", refundFee); + data.put("value", MoneyUtil.computePriceScale(refundFee)); datas.add(data); @@ -130,14 +131,14 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso double chargeFee = feeStatisticsImpl.getChargeFee(queryStatisticsDto); data = new JSONObject(); data.put("name","充电金额"); - data.put("value", chargeFee); + data.put("value", MoneyUtil.computePriceScale(chargeFee)); datas.add(data); // todo 查询 月卡金额 double chargeMonthOrderMoney = orderStatisticsImpl.getChargeMonthOrderCount(queryStatisticsDto); data = new JSONObject(); data.put("name","月卡实收"); - data.put("value", chargeMonthOrderMoney); + data.put("value", MoneyUtil.computePriceScale(chargeMonthOrderMoney)); datas.add(data); diff --git a/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedDetailStatisticsCmd.java b/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedDetailStatisticsCmd.java index be3d448c31..f307276605 100644 --- a/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedDetailStatisticsCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedDetailStatisticsCmd.java @@ -14,6 +14,7 @@ import com.java110.report.statistics.IFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.MoneyUtil; import com.java110.utils.util.StringUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; @@ -151,7 +152,6 @@ private JSONArray computeRoomOweReceivedFee(List rooms, QueryStatistics continue; } for (DictDto tDict : dictDtos) { - //feeTypeCd = info.get("feeTypeCd").toString(); feeTypeCd = tDict.getStatusCd(); if (!info.containsKey(feeTypeCd)) { continue; @@ -160,7 +160,7 @@ private JSONArray computeRoomOweReceivedFee(List rooms, QueryStatistics data.put("receivedFee" + feeTypeCd, info.get(feeTypeCd)); } } - data.put("receivedFee", receivedFee.doubleValue()); + data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); } return datas; diff --git a/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedStatisticsCmd.java b/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedStatisticsCmd.java index 5cfee166d5..51e4646f1f 100644 --- a/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedStatisticsCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedStatisticsCmd.java @@ -9,6 +9,8 @@ import com.java110.report.statistics.IFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.ListUtil; +import com.java110.utils.util.MoneyUtil; import com.java110.utils.util.StringUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; @@ -64,7 +66,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso } private List computeFloorReceivedFee(List datas) { - if (datas == null || datas.size() < 1) { + if (ListUtil.isNull(datas)) { return new ArrayList<>(); } @@ -75,22 +77,23 @@ private List computeFloorReceivedFee(List datas) { } } - if (tmpDatas == null || tmpDatas.size() < 1) { + if (ListUtil.isNull(tmpDatas)) { return new ArrayList<>(); } BigDecimal receivedFee = null; + double receivedFeeD = 0; for (Map tmpData : tmpDatas) { receivedFee = new BigDecimal(0.00); for (Map data : datas) { if (!data.get("floorId").toString().equals(tmpData.get("floorId"))) { continue; } - - receivedFee = receivedFee.add(new BigDecimal(data.get("receivedFee").toString())); - tmpData.put("receivedFee" + data.get("feeTypeCd").toString(), data.get("receivedFee")); + receivedFeeD = Double.parseDouble(data.get("receivedFee").toString()); + receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); + tmpData.put("receivedFee" + data.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); } - tmpData.put("receivedFee", receivedFee.doubleValue()); + tmpData.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); } return tmpDatas; diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailCarCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailCarCmd.java index 5e3b33f2ee..8f1de38ab2 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailCarCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailCarCmd.java @@ -13,6 +13,7 @@ import com.java110.report.statistics.IFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.MoneyUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -118,6 +119,8 @@ private JSONArray computeCarOweReceivedFee(List ownerCarDtos, Query BigDecimal oweFee = null; BigDecimal receivedFee = null; + double oweFeeD = 0; + double receivedFeeD = 0; for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) { oweFee = new BigDecimal(0.00); receivedFee = new BigDecimal(0.00); @@ -127,13 +130,16 @@ private JSONArray computeCarOweReceivedFee(List ownerCarDtos, Query continue; } - oweFee = oweFee.add(new BigDecimal(info.get("oweFee").toString())); - receivedFee = receivedFee.add(new BigDecimal(info.get("receivedFee").toString())); - data.put("oweFee" + info.get("feeTypeCd").toString(), info.get("oweFee")); - data.put("receivedFee" + info.get("feeTypeCd").toString(), info.get("receivedFee")); + oweFeeD = Double.parseDouble(info.get("oweFee").toString()); + receivedFeeD = Double.parseDouble(info.get("receivedFee").toString()); + + oweFee = oweFee.add(new BigDecimal(oweFeeD + "")); + receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); + data.put("oweFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(oweFeeD)); + data.put("receivedFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); } - data.put("oweFee", oweFee.doubleValue()); - data.put("receivedFee", receivedFee.doubleValue()); + data.put("oweFee", MoneyUtil.computePriceScale(oweFee.doubleValue())); + data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); } return datas; diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailContractCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailContractCmd.java index 564597e5df..79074ac95e 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailContractCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailContractCmd.java @@ -12,6 +12,7 @@ import com.java110.report.statistics.IFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.MoneyUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -117,6 +118,8 @@ private JSONArray computeContractOweReceivedFee(List contractDtos, BigDecimal oweFee = null; BigDecimal receivedFee = null; + double oweFeeD = 0; + double receivedFeeD = 0; for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) { data = datas.getJSONObject(dataIndex); oweFee = new BigDecimal(0.00); @@ -126,13 +129,16 @@ private JSONArray computeContractOweReceivedFee(List contractDtos, continue; } - oweFee = oweFee.add(new BigDecimal(info.get("oweFee").toString())); - receivedFee = receivedFee.add(new BigDecimal(info.get("receivedFee").toString())); - data.put("oweFee" + info.get("feeTypeCd").toString(), info.get("oweFee")); - data.put("receivedFee" + info.get("feeTypeCd").toString(), info.get("receivedFee")); + oweFeeD = Double.parseDouble(info.get("oweFee").toString()); + receivedFeeD = Double.parseDouble(info.get("receivedFee").toString()); + + oweFee = oweFee.add(new BigDecimal(oweFeeD + "")); + receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); + data.put("oweFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(oweFeeD)); + data.put("receivedFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); } - data.put("oweFee", oweFee.doubleValue()); - data.put("receivedFee", receivedFee.doubleValue()); + data.put("oweFee", MoneyUtil.computePriceScale(oweFee.doubleValue())); + data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); } return datas; diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailOwnerCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailOwnerCmd.java index ed431374ac..a4f2cc2aef 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailOwnerCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailOwnerCmd.java @@ -12,6 +12,7 @@ import com.java110.report.statistics.IFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.MoneyUtil; import com.java110.utils.util.StringUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; @@ -107,6 +108,8 @@ private JSONArray computeOwnerOweReceivedFee(List owners, QueryStatist BigDecimal oweFee = null; BigDecimal receivedFee = null; + double oweFeeD = 0; + double receivedFeeD = 0; for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) { data = datas.getJSONObject(dataIndex); oweFee = new BigDecimal(0.00); @@ -116,14 +119,18 @@ private JSONArray computeOwnerOweReceivedFee(List owners, QueryStatist continue; } - oweFee = oweFee.add(new BigDecimal(info.get("oweFee").toString())); - receivedFee = receivedFee.add(new BigDecimal(info.get("receivedFee").toString())); - data.put("oweFee" + info.get("feeTypeCd").toString(), info.get("oweFee")); - data.put("receivedFee" + info.get("feeTypeCd").toString(), info.get("receivedFee")); + oweFeeD = Double.parseDouble(info.get("oweFee").toString()); + receivedFeeD = Double.parseDouble(info.get("receivedFee").toString()); + + oweFee = oweFee.add(new BigDecimal(oweFeeD + "")); + receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); + data.put("oweFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(oweFeeD)); + data.put("receivedFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); data.put("objName", info.get("objName")); + } - data.put("oweFee", oweFee.doubleValue()); - data.put("receivedFee", receivedFee.doubleValue()); + data.put("oweFee", MoneyUtil.computePriceScale(oweFee.doubleValue())); + data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); // todo 处理 收费对象重复问题 delRepeatObjName(data); } diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailRoomCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailRoomCmd.java index 1e315fb568..7f0cb77c6a 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailRoomCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeDetailRoomCmd.java @@ -12,6 +12,8 @@ import com.java110.report.statistics.IFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.ListUtil; +import com.java110.utils.util.MoneyUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -70,7 +72,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso } // todo 计算 房屋欠费实收数据 - JSONArray datas = computeRoomOweReceivedFee(rooms,queryStatisticsDto); + JSONArray datas = computeRoomOweReceivedFee(rooms, queryStatisticsDto); ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) queryStatisticsDto.getRow()), count, datas); @@ -85,8 +87,8 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso * @param rooms * @return */ - private JSONArray computeRoomOweReceivedFee(List rooms,QueryStatisticsDto queryStatisticsDto) { - if (rooms == null || rooms.size() < 1) { + private JSONArray computeRoomOweReceivedFee(List rooms, QueryStatisticsDto queryStatisticsDto) { + if (ListUtil.isNull(rooms)) { return new JSONArray(); } @@ -97,39 +99,44 @@ private JSONArray computeRoomOweReceivedFee(List rooms,QueryStatisticsD for (RoomDto roomDto : rooms) { objIds.add(roomDto.getRoomId()); data = new JSONObject(); - data.put("roomId",roomDto.getRoomId()); - data.put("roomName",roomDto.getFloorNum()+"-"+roomDto.getUnitNum()+"-"+roomDto.getRoomNum()); - data.put("ownerName",roomDto.getOwnerName()); - data.put("ownerId",roomDto.getOwnerId()); - data.put("link",roomDto.getLink()); + data.put("roomId", roomDto.getRoomId()); + data.put("roomName", roomDto.getFloorNum() + "-" + roomDto.getUnitNum() + "-" + roomDto.getRoomNum()); + data.put("ownerName", roomDto.getOwnerName()); + data.put("ownerId", roomDto.getOwnerId()); + data.put("link", roomDto.getLink()); datas.add(data); } queryStatisticsDto.setObjIds(objIds.toArray(new String[objIds.size()])); List infos = feeStatisticsImpl.getObjFeeSummary(queryStatisticsDto); - if(infos == null || infos.size() < 1){ + if (infos == null || infos.size() < 1) { return datas; } BigDecimal oweFee = null; BigDecimal receivedFee = null; - for(int dataIndex = 0; dataIndex < datas.size();dataIndex ++){ + double oweFeeD = 0; + double receivedFeeD = 0; + for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) { oweFee = new BigDecimal(0.00); receivedFee = new BigDecimal(0.00); data = datas.getJSONObject(dataIndex); - for(Map info : infos){ - if(!data.get("roomId").toString().equals(info.get("objId"))){ + for (Map info : infos) { + if (!data.get("roomId").toString().equals(info.get("objId"))) { continue; } - oweFee = oweFee.add(new BigDecimal(info.get("oweFee").toString())); - receivedFee = receivedFee.add(new BigDecimal(info.get("receivedFee").toString())); - data.put("oweFee"+info.get("feeTypeCd").toString(),info.get("oweFee")); - data.put("receivedFee"+info.get("feeTypeCd").toString(),info.get("receivedFee")); + oweFeeD = Double.parseDouble(info.get("oweFee").toString()); + receivedFeeD = Double.parseDouble(info.get("receivedFee").toString()); + + oweFee = oweFee.add(new BigDecimal(oweFeeD + "")); + receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); + data.put("oweFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(oweFeeD)); + data.put("receivedFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); } - data.put("oweFee",oweFee.doubleValue()); - data.put("receivedFee",receivedFee.doubleValue()); + data.put("oweFee", MoneyUtil.computePriceScale(oweFee.doubleValue())); + data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); } return datas; diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java index 49070503c6..eb4b310465 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java @@ -11,6 +11,7 @@ import com.java110.report.statistics.IFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.MoneyUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; @@ -101,15 +102,15 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso int oweRoomCount = feeStatisticsImpl.getOweRoomCount(queryStatisticsDto); JSONObject data = new JSONObject(); - data.put("hisOweFee", hisOweFee); - data.put("curOweFee", curOweFee); - data.put("hisReceivedFee", hisReceivedFee); - data.put("preReceivedFee", preReceivedFee); - data.put("receivedFee", receivedFee); + data.put("hisOweFee", MoneyUtil.computePriceScale(hisOweFee)); + data.put("curOweFee", MoneyUtil.computePriceScale(curOweFee)); + data.put("hisReceivedFee", MoneyUtil.computePriceScale(hisReceivedFee)); + data.put("preReceivedFee", MoneyUtil.computePriceScale(preReceivedFee)); + data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee)); data.put("roomCount", roomCount); data.put("feeRoomCount", feeRoomCount); data.put("oweRoomCount", oweRoomCount); - data.put("curReceivableFee", curReceivableFee); + data.put("curReceivableFee", MoneyUtil.computePriceScale(curReceivableFee)); JSONArray datas = new JSONArray(); datas.add(data); From 3c22e09cf959d1a70c8852aeac2e297dd276c764 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Thu, 8 Feb 2024 04:43:13 +0000 Subject: [PATCH 13/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BD=A6=E8=BE=86?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=B4=B9=E7=94=A8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- .../com/java110/fee/cmd/fee/SaveParkingSpaceCreateFeeCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/SaveParkingSpaceCreateFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/SaveParkingSpaceCreateFeeCmd.java index f3314095c5..ae9e2adfe3 100644 --- a/service-fee/src/main/java/com/java110/fee/cmd/fee/SaveParkingSpaceCreateFeeCmd.java +++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/SaveParkingSpaceCreateFeeCmd.java @@ -238,7 +238,7 @@ private void dealParkingSpaceFee(List ownerCarDtos, ICmdDataFlowCon } parkingSpaceDto = new ParkingSpaceDto(); - parkingSpaceDto.setCarNum(ownerCarDtos.get(ownerCarIndex).getCarNum()); + parkingSpaceDto.setPsId(ownerCarDtos.get(ownerCarIndex).getPsId()); parkingSpaceDto.setCommunityId(ownerCarDtos.get(0).getCommunityId()); parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); From f382cdb57dc79d3bdf0689ac0b3d7a4c5dcd9afd Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 22 Feb 2024 15:01:42 +0800 Subject: [PATCH 14/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/java110/dto/owner/OwnerCarDto.java | 10 + .../dto/payFee/PayFeeDetailMonthDto.java | 23 ++ .../dto/payFee/PayFeeMonthOwnerDto.java | 10 + .../po/payFee/PayFeeDetailMonthPo.java | 20 + .../PayFeeDetailMonthServiceDaoImplMapper.xml | 8 +- ...eportFeeStatisticsServiceDaoImplMapper.xml | 353 ++++++++---------- .../user/OwnerCarServiceDaoImplMapper.xml | 2 +- .../IPayFeeDetailMonthInnerServiceSMO.java | 8 +- .../java110/fee/feeMonth/PayFeeMonthHelp.java | 63 +++- .../java110/fee/feeMonth/PayFeeMonthImpl.java | 6 +- 10 files changed, 290 insertions(+), 213 deletions(-) diff --git a/java110-bean/src/main/java/com/java110/dto/owner/OwnerCarDto.java b/java110-bean/src/main/java/com/java110/dto/owner/OwnerCarDto.java index d0d92bf14e..019afc6f0a 100755 --- a/java110-bean/src/main/java/com/java110/dto/owner/OwnerCarDto.java +++ b/java110-bean/src/main/java/com/java110/dto/owner/OwnerCarDto.java @@ -109,6 +109,8 @@ public class OwnerCarDto extends PageDto implements Serializable { private String logStartTime; private String logEndTime; + private String paId; + private List ownerCarAttrDto; public String getCarColor() { @@ -566,4 +568,12 @@ public String getLogEndTime() { public void setLogEndTime(String logEndTime) { this.logEndTime = logEndTime; } + + public String getPaId() { + return paId; + } + + public void setPaId(String paId) { + this.paId = paId; + } } diff --git a/java110-bean/src/main/java/com/java110/dto/payFee/PayFeeDetailMonthDto.java b/java110-bean/src/main/java/com/java110/dto/payFee/PayFeeDetailMonthDto.java index eb6337a9bf..4b9ce1f1c2 100644 --- a/java110-bean/src/main/java/com/java110/dto/payFee/PayFeeDetailMonthDto.java +++ b/java110-bean/src/main/java/com/java110/dto/payFee/PayFeeDetailMonthDto.java @@ -58,6 +58,11 @@ public class PayFeeDetailMonthDto extends FeeDto implements Serializable { private String feeName; private String configId; + private String objFpcId; + + private String feeTypeCd; + + private List feeAttrs; public String getDetailMonth() { @@ -276,4 +281,22 @@ public String getFeeState() { public void setFeeState(String feeState) { this.feeState = feeState; } + + public String getObjFpcId() { + return objFpcId; + } + + public void setObjFpcId(String objFpcId) { + this.objFpcId = objFpcId; + } + + @Override + public String getFeeTypeCd() { + return feeTypeCd; + } + + @Override + public void setFeeTypeCd(String feeTypeCd) { + this.feeTypeCd = feeTypeCd; + } } diff --git a/java110-bean/src/main/java/com/java110/dto/payFee/PayFeeMonthOwnerDto.java b/java110-bean/src/main/java/com/java110/dto/payFee/PayFeeMonthOwnerDto.java index 1c3c44cdf0..66ef8f0b55 100644 --- a/java110-bean/src/main/java/com/java110/dto/payFee/PayFeeMonthOwnerDto.java +++ b/java110-bean/src/main/java/com/java110/dto/payFee/PayFeeMonthOwnerDto.java @@ -17,6 +17,8 @@ public class PayFeeMonthOwnerDto implements Serializable { private String link; private String payFeeTime; + private String objFpcId; + public String getObjName() { return objName; } @@ -64,4 +66,12 @@ public String getPayFeeTime() { public void setPayFeeTime(String payFeeTime) { this.payFeeTime = payFeeTime; } + + public String getObjFpcId() { + return objFpcId; + } + + public void setObjFpcId(String objFpcId) { + this.objFpcId = objFpcId; + } } diff --git a/java110-bean/src/main/java/com/java110/po/payFee/PayFeeDetailMonthPo.java b/java110-bean/src/main/java/com/java110/po/payFee/PayFeeDetailMonthPo.java index 5cd7f59146..e858ffc881 100644 --- a/java110-bean/src/main/java/com/java110/po/payFee/PayFeeDetailMonthPo.java +++ b/java110-bean/src/main/java/com/java110/po/payFee/PayFeeDetailMonthPo.java @@ -36,6 +36,10 @@ public class PayFeeDetailMonthPo implements Serializable { private String deadlineTime; + private String objFpcId; + + private String feeTypeCd; + public String getDetailMonth() { return detailMonth; @@ -228,4 +232,20 @@ public String getDeadlineTime() { public void setDeadlineTime(String deadlineTime) { this.deadlineTime = deadlineTime; } + + public String getObjFpcId() { + return objFpcId; + } + + public void setObjFpcId(String objFpcId) { + this.objFpcId = objFpcId; + } + + public String getFeeTypeCd() { + return feeTypeCd; + } + + public void setFeeTypeCd(String feeTypeCd) { + this.feeTypeCd = feeTypeCd; + } } diff --git a/java110-db/src/main/resources/mapper/fee/PayFeeDetailMonthServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/fee/PayFeeDetailMonthServiceDaoImplMapper.xml index 9d34bc41e0..10376e1323 100644 --- a/java110-db/src/main/resources/mapper/fee/PayFeeDetailMonthServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/fee/PayFeeDetailMonthServiceDaoImplMapper.xml @@ -9,11 +9,11 @@ insert into pay_fee_detail_month( detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id, obj_name,obj_id,owner_name,owner_id,link,state,pay_fee_time,cur_month_time, - fee_name,config_id + fee_name,config_id,obj_fpc_id,fee_type_cd ) values ( #{detailMonth},#{detailYear},#{detailId},#{receivableAmount},#{discountAmount},#{remark},#{receivedAmount},#{communityId},#{feeId},#{monthId}, #{objName},#{objId},#{ownerName},#{ownerId},#{link},#{state},#{payFeeTime},#{curMonthTime}, - #{feeName},#{configId} + #{feeName},#{configId},#{objFpcId},#{feeTypeCd} ) @@ -22,14 +22,14 @@ insert into pay_fee_detail_month( detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id, obj_name,obj_id,owner_name,owner_id,link,state,pay_fee_time,cur_month_time, - fee_name,config_id,deadline_time + fee_name,config_id,deadline_time,obj_fpc_id,fee_type_cd ) values ( #{item.detailMonth},#{item.detailYear},#{item.detailId},#{item.receivableAmount},#{item.discountAmount}, #{item.remark},#{item.receivedAmount},#{item.communityId},#{item.feeId},#{item.monthId}, #{item.objName},#{item.objId},#{item.ownerName},#{item.ownerId},#{item.link},#{item.state},#{item.payFeeTime},#{item.curMonthTime}, - #{item.feeName},#{item.configId},#{item.deadlineTime} + #{item.feeName},#{item.configId},#{item.deadlineTime},#{item.objFpcId},#{item.feeTypeCd} ) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index a534fbf330..0e5e8a3b7c 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -345,43 +345,43 @@ select count(1) feeRoomCount from ( - select t.payer_obj_id - from report_owe_fee t - inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - - left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' - - where - 1=1 - and t.payer_obj_type = '3333' - and t.community_id= #{communityId} - and t.end_time < #{endDate} - - and bu.floor_id = #{floorId} - - - and t.config_id = #{configId} - - - and t.payer_obj_name like concat('%',#{objName},'%') - - - and t.owner_name like concat('%',#{ownerName},'%') - - - and t.owner_tel = #{link} - - - and t.config_id in - - #{item} - - - - and pfc.fee_type_cd = #{feeTypeCd} - - group by t.payer_obj_id + select t.payer_obj_id + from report_owe_fee t + inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + + left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' + + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} + and t.end_time < #{endDate} + + and bu.floor_id = #{floorId} + + + and t.config_id = #{configId} + + + and t.payer_obj_name like concat('%',#{objName},'%') + + + and t.owner_name like concat('%',#{ownerName},'%') + + + and t.owner_tel = #{link} + + + and t.config_id in + + #{item} + + + + and pfc.fee_type_cd = #{feeTypeCd} + + group by t.payer_obj_id ) a @@ -390,55 +390,55 @@ select a.floor_id floorId,a.floor_num floorNum,a.name floorName, ( select count(1) from ( - select bu.floor_id,t.payer_obj_id - from report_owe_fee t + select bu.floor_id,t.payer_obj_id + from report_owe_fee t inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - - left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' - - where - 1=1 - and t.payer_obj_type = '3333' - and t.community_id= #{communityId} - and t.end_time <= #{endDate} - and t.amount_owed != 0 - - and t.config_id in - - #{item} - - - - and pfc.fee_type_cd = #{feeTypeCd} - - group by bu.floor_id,t.payer_obj_id + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + + left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' + + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} + and t.end_time <= #{endDate} + and t.amount_owed != 0 + + and t.config_id in + + #{item} + + + + and pfc.fee_type_cd = #{feeTypeCd} + + group by bu.floor_id,t.payer_obj_id ) b where b.floor_id = a.floor_id ) oweRoomCount, ( select count(1) from ( - select bu.floor_id,t.payer_obj_id - from report_owe_fee t - inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001' + select bu.floor_id,t.payer_obj_id + from report_owe_fee t + inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001' inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where - 1=1 - and t.payer_obj_type = '3333' - and t.community_id= #{communityId} - and pf.community_id= #{communityId} - and t.end_time <= #{endDate} - - and t.config_id in - - #{item} - - - - and pf.fee_type_cd = #{feeTypeCd} - - group by bu.floor_id,t.payer_obj_id + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} + and pf.community_id= #{communityId} + and t.end_time <= #{endDate} + + and t.config_id in + + #{item} + + + + and pf.fee_type_cd = #{feeTypeCd} + + group by bu.floor_id,t.payer_obj_id ) b where b.floor_id = a.floor_id ) feeRoomCount, @@ -446,11 +446,9 @@ select ifnull(sum(t.received_amount),0.0) receivedFee from pay_fee_detail t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' where 1=1 - and bu.floor_id = a.floor_id + and t.obj_fpc_id = a.floor_id and t.status_cd = '0' and t.community_id= a.community_id and t.create_time > #{startDate} @@ -462,18 +460,16 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} ) receivedFee, ( select ifnull(sum(t.received_amount),0.0) preReceivedFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' where 1=1 - and bu.floor_id = a.floor_id + and t.obj_fpc_id = a.floor_id and t.status_cd = '0' and t.community_id= a.community_id and t.pay_fee_time > #{startDate} @@ -486,18 +482,16 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} ) preReceivedFee, ( select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' where 1=1 - and bu.floor_id = a.floor_id + and t.obj_fpc_id = a.floor_id and t.status_cd = '0' and t.community_id= a.community_id and t.detail_id = '-1' @@ -509,18 +503,16 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} ) hisOweFee, ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' where 1=1 - and bu.floor_id = a.floor_id + and t.obj_fpc_id = a.floor_id and t.status_cd = '0' and t.community_id= a.community_id and t.cur_month_time >= #{startDate} @@ -532,18 +524,16 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} ) curReceivableFee, ( select ifnull(sum(t.receivable_amount),0.0) curReceivedFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' where 1=1 - and bu.floor_id = a.floor_id + and t.obj_fpc_id = a.floor_id and t.status_cd = '0' and t.community_id= a.community_id and t.cur_month_time >= #{startDate} @@ -556,18 +546,16 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} ) curReceivedFee, ( select ifnull(sum(t.received_amount),0.0) hisReceivedFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' where 1=1 - and bu.floor_id = a.floor_id + and t.obj_fpc_id = a.floor_id and t.status_cd = '0' and t.community_id= a.community_id and t.pay_fee_time > #{startDate} @@ -581,7 +569,7 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} ) hisReceivedFee from f_floor a @@ -595,27 +583,27 @@ select a.name, ( select count(1) from ( - select pfc.fee_type_cd,t.payer_obj_id - from report_owe_fee t + select pfc.fee_type_cd,t.payer_obj_id + from report_owe_fee t inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' - where - 1=1 - and t.payer_obj_type = '3333' - and t.community_id= #{communityId} - and t.end_time <= #{endDate} - and t.amount_owed != 0 - - and t.config_id in - - #{item} - - - - and pfc.fee_type_cd = #{feeTypeCd} - - group by pfc.fee_type_cd,t.payer_obj_id + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} + and t.end_time <= #{endDate} + and t.amount_owed != 0 + + and t.config_id in + + #{item} + + + + and pfc.fee_type_cd = #{feeTypeCd} + + group by pfc.fee_type_cd,t.payer_obj_id ) b where b.fee_type_cd = a.status_cd ) oweRoomCount, @@ -674,14 +662,10 @@ select ifnull(sum(t.received_amount),0.0) preReceivedFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.status_cd = '0' and t.community_id= #{communityId} @@ -695,20 +679,16 @@ #{item} - and pf.fee_type_cd = a.status_cd + and t.fee_type_cd = a.status_cd ) preReceivedFee, ( select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.status_cd = '0' and t.community_id= #{communityId} @@ -720,20 +700,16 @@ #{item} - and pf.fee_type_cd = a.status_cd + and t.fee_type_cd = a.status_cd ) hisOweFee, ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.status_cd = '0' and t.community_id= #{communityId} @@ -745,20 +721,16 @@ #{item} - and pf.fee_type_cd = a.status_cd + and t.fee_type_cd = a.status_cd ) curReceivableFee, ( select ifnull(sum(t.receivable_amount),0.0) curReceivedFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.status_cd = '0' and t.community_id= #{communityId} @@ -771,20 +743,16 @@ #{item} - and pf.fee_type_cd = a.status_cd + and t.fee_type_cd = a.status_cd ) curReceivedFee, ( select ifnull(sum(t.received_amount),0.0) hisReceivedFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.status_cd = '0' and t.community_id= #{communityId} @@ -798,7 +766,7 @@ #{item} - and pf.fee_type_cd = a.status_cd + and t.fee_type_cd = a.status_cd ) hisReceivedFee from t_dict a where 1=1 @@ -810,17 +778,17 @@ select count(1) feeRoomCount from ( - select t.payer_ob_id - from report_owe_fee t - inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001' + select t.payer_ob_id + from report_owe_fee t + inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001' inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where - 1=1 - and t.payer_obj_type = '3333' - and t.community_id= #{communityId} - and pf.community_id= #{communityId} - group by a.payer_ob_id + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} + and pf.community_id= #{communityId} + group by a.payer_ob_id ) b @@ -831,24 +799,21 @@ select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - inner join pay_fee_config pfc1 on pfc1.config_id = t.config_id and pfc1.status_cd = '0' - where t.obj_id = a.obj_id - and t.status_cd = '0' + where t.status_cd = '0' and t.detail_id = '-1' and t.community_id= a.community_id and t.obj_id = a.obj_id - and pfc1.fee_type_cd = pfc.fee_type_cd + and t.fee_type_cd = a.fee_type_cd and t.cur_month_time < #{endDate} ) oweFee, ( select ifnull(sum(t.received_amount),0.0) receivedFee from pay_fee_detail t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - inner join pay_fee_config pfc1 on pfc1.config_id = pf.config_id and pfc1.status_cd = '0' where pf.payer_obj_id = a.obj_id and t.status_cd = '0' and t.community_id= a.community_id - and pfc1.fee_type_cd = pfc.fee_type_cd + and t.fee_type_cd = a.fee_type_cd and t.create_time > #{startDate} and t.create_time < #{endDate} ) receivedFee @@ -869,24 +834,22 @@ select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - inner join pay_fee_config pfc1 on pfc1.config_id = t.config_id and pfc1.status_cd = '0' where 1=1 and t.status_cd = '0' and t.detail_id = '-1' and t.community_id= a.community_id and t.owner_id = a.owner_id - and pfc1.fee_type_cd = pfc.fee_type_cd + and t.fee_type_cd = a.fee_type_cd and t.cur_month_time < #{endDate} ) oweFee, ( select ifnull(sum(t.received_amount),0.0) receivedFee from pay_fee_detail_month t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - inner join pay_fee_config pfc1 on pfc1.config_id = t.config_id and pfc1.status_cd = '0' where t.owner_id = a.owner_id and t.status_cd = '0' and t.community_id= a.community_id - and pfc1.fee_type_cd = pfc.fee_type_cd + and t.fee_type_cd = a.fee_type_cd and t.pay_fee_time > #{startDate} and t.pay_fee_time < #{endDate} ) receivedFee @@ -1089,35 +1052,35 @@ ) roomCount, ( select count(1) from ( - select bu.floor_id,br.room_id - from report_owe_fee t - inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001' + select bu.floor_id,br.room_id + from report_owe_fee t + inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001' inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where - 1=1 - and t.payer_obj_type = '3333' - and t.community_id= #{communityId} + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} and pf.community_id= #{communityId} - and t.end_time < #{endDate} - group by bu.floor_id,br.room_id + and t.end_time < #{endDate} + group by bu.floor_id,br.room_id ) b where b.floor_id = a.floor_id ) feeRoomCount, ( select count(1) from ( - select bu.floor_id,br.room_id - from report_owe_fee t + select bu.floor_id,br.room_id + from report_owe_fee t inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' - where - 1=1 - and t.payer_obj_type = '3333' - and t.community_id= #{communityId} - and t.end_time < #{endDate} - and t.amount_owed != 0 - group by bu.floor_id,br.room_id + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} + and t.end_time < #{endDate} + and t.amount_owed != 0 + group by bu.floor_id,br.room_id ) b where b.floor_id = a.floor_id ) oweRoomCount, @@ -1235,7 +1198,7 @@ LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0' left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' where 1=1 - and bu.floor_id = #{floorId} + and bu.floor_id = #{floorId} and t.community_id = #{communityId} and pf.community_id= #{communityId} and t.pay_fee_time > #{startDate} diff --git a/java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml index 7f612f29c5..52038917f9 100755 --- a/java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml @@ -130,7 +130,7 @@ t.owner_id ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId ,t.create_time createTime,t.community_id communityId,bow.name ownerName,bow.id_card idCard,bow.link,t2.name stateName, t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.state, - t.car_type_cd,t.car_type_cd carTypeCd,t.member_id,t.member_id memberId,ps.num,pa.num areaNum,t.lease_type + t.car_type_cd,t.car_type_cd carTypeCd,t.member_id,t.member_id memberId,ps.num,pa.num areaNum,pa.pa_id paId,t.lease_type leaseType, t3.name leaseTypeName,t4.name carTypeCdName diff --git a/java110-interface/src/main/java/com/java110/intf/fee/IPayFeeDetailMonthInnerServiceSMO.java b/java110-interface/src/main/java/com/java110/intf/fee/IPayFeeDetailMonthInnerServiceSMO.java index 47098bafc3..77a93d3937 100644 --- a/java110-interface/src/main/java/com/java110/intf/fee/IPayFeeDetailMonthInnerServiceSMO.java +++ b/java110-interface/src/main/java/com/java110/intf/fee/IPayFeeDetailMonthInnerServiceSMO.java @@ -25,17 +25,17 @@ public interface IPayFeeDetailMonthInnerServiceSMO { @RequestMapping(value = "/savePayFeeDetailMonth", method = RequestMethod.POST) - public int savePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo); + int savePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo); @RequestMapping(value = "/savePayFeeDetailMonths", method = RequestMethod.POST) - public int savePayFeeDetailMonths(@RequestBody List payFeeDetailMonthPos); + int savePayFeeDetailMonths(@RequestBody List payFeeDetailMonthPos); @RequestMapping(value = "/updatePayFeeDetailMonth", method = RequestMethod.POST) - public int updatePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo); + int updatePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo); @RequestMapping(value = "/deletePayFeeDetailMonth", method = RequestMethod.POST) - public int deletePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo); + int deletePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo); /** * 查询小区楼信息 diff --git a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java index 8e92b02cef..4e8c6386e1 100644 --- a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java +++ b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java @@ -2,15 +2,22 @@ import com.java110.core.factory.GenerateCodeFactory; import com.java110.core.smo.IComputeFeeSMO; +import com.java110.dto.contract.ContractDto; import com.java110.dto.fee.FeeAttrDto; import com.java110.dto.fee.FeeDetailDto; import com.java110.dto.fee.FeeDto; +import com.java110.dto.owner.OwnerCarDto; import com.java110.dto.payFee.PayFeeDetailMonthDto; import com.java110.dto.payFee.PayFeeMonthOwnerDto; +import com.java110.dto.room.RoomDto; import com.java110.intf.community.IRoomInnerServiceSMO; import com.java110.intf.fee.IPayFeeDetailMonthInnerServiceSMO; +import com.java110.intf.store.IContractInnerServiceSMO; +import com.java110.intf.user.IOwnerCarInnerServiceSMO; import com.java110.po.payFee.PayFeeDetailMonthPo; import com.java110.utils.util.DateUtil; +import com.java110.utils.util.ListUtil; +import com.java110.utils.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -23,6 +30,12 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { @Autowired private IRoomInnerServiceSMO roomInnerServiceSMOImpl; + @Autowired + private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; + + @Autowired + private IContractInnerServiceSMO contractInnerServiceSMOImpl; + @Autowired private IComputeFeeSMO computeFeeSMOImpl; @@ -38,6 +51,39 @@ public PayFeeMonthOwnerDto generatorOwnerRoom(FeeDto feeDto) { payFeeMonthOwnerDto.setLink(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_OWNER_LINK)); payFeeMonthOwnerDto.setObjName(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_PAY_OBJECT_NAME)); payFeeMonthOwnerDto.setObjId(feeDto.getPayerObjId()); + payFeeMonthOwnerDto.setObjFpcId("-1"); + + if(StringUtil.isEmpty(feeDto.getPayerObjId())){ + return payFeeMonthOwnerDto; + } + + // 如果是房屋 + if(FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())){ + + RoomDto roomDto = new RoomDto(); + roomDto.setRoomId(feeDto.getPayerObjId()); + roomDto.setCommunityId(feeDto.getCommunityId()); + List roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); + if(!ListUtil.isNull(roomDtos)){ + payFeeMonthOwnerDto.setObjFpcId(roomDtos.get(0).getFloorId()); + } + }else if(FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())){ + + OwnerCarDto ownerCarDto = new OwnerCarDto(); + ownerCarDto.setMemberId(feeDto.getPayerObjId()); + ownerCarDto.setCommunityId(feeDto.getCommunityId()); + List ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto); + if(!ListUtil.isNull(ownerCarDtos)){ + payFeeMonthOwnerDto.setObjFpcId(ownerCarDtos.get(0).getPaId()); + } + }else { + ContractDto contractDto = new ContractDto(); + contractDto.setContractId(feeDto.getPayerObjId()); + List contractDtos = contractInnerServiceSMOImpl.queryContracts(contractDto); + if(!ListUtil.isNull(contractDtos)){ + payFeeMonthOwnerDto.setObjFpcId(contractDtos.get(0).getContractType()); + } + } return payFeeMonthOwnerDto; } @@ -168,12 +214,12 @@ public void waitDispersedOweFee(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOw // todo 如果不是整月,则转换为按天计算 // if (curDay != curMonthMaxDay) { - //todo 周期性费用 日应收重新算 - if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { - dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 - } - // todo 计算 应收 - curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); + //todo 周期性费用 日应收重新算 + if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { + dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 + } + // todo 计算 应收 + curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); // } else { // todo 如果是整月 那就按月计算,以免 转换成天再 乘以天数后的误差 // curMonthReceivableAmount = receivableAmount; // } @@ -332,6 +378,11 @@ private void toSavePayFeeDetailMonth(double receivableAmount, tmpPayFeeDetailMonthPo.setState("W"); // todo 这里暂时写死,目前用不到,算是预留字段 tmpPayFeeDetailMonthPo.setFeeName(feeDto.getFeeName()); tmpPayFeeDetailMonthPo.setConfigId(feeDto.getConfigId()); + tmpPayFeeDetailMonthPo.setFeeTypeCd(feeDto.getFeeTypeCd()); + + //todo 查询obj_fpc_id + tmpPayFeeDetailMonthPo.setObjFpcId(payFeeMonthOwnerDto.getObjFpcId()); + payFeeDetailMonthPos.add(tmpPayFeeDetailMonthPo); } diff --git a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java index 815878d53b..a216c3fbb5 100644 --- a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java +++ b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java @@ -176,9 +176,9 @@ public void doGeneratorOweFees(List feeIds, String communityId) { feeDto.setFeeId(feeId); List tmpFeeDtos = feeInnerServiceSMOImpl.queryFees(feeDto); - if(tmpFeeDtos == null || tmpFeeDtos.size() < 1){ - continue; - } + if(tmpFeeDtos == null || tmpFeeDtos.size() < 1){ + continue; + } generatorOweFeeInnerServiceSMOImpl.computeOweFee(tmpFeeDtos.get(0)); } } From 6caf02bfd3eafe80c0b37ac4ad04077ea549dc92 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 22 Feb 2024 15:02:53 +0800 Subject: [PATCH 15/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/db/tt.sql | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/db/tt.sql b/docs/db/tt.sql index 55a3798ba5..9fffcc408f 100644 --- a/docs/db/tt.sql +++ b/docs/db/tt.sql @@ -28949,8 +28949,8 @@ CREATE TABLE `pay_fee_detail_month` ( `fee_id` varchar(30) NOT NULL COMMENT '费用ID', `detail_id` varchar(30) NOT NULL COMMENT '费用明细ID', `community_id` varchar(30) NOT NULL COMMENT '小区ID', - `detail_year` int(11) NOT NULL COMMENT '年', - `detail_month` int(11) NOT NULL COMMENT '月', + `detail_year` int NOT NULL COMMENT '年', + `detail_month` int NOT NULL COMMENT '月', `receivable_amount` decimal(10,4) NOT NULL COMMENT '应收金额', `received_amount` decimal(10,4) NOT NULL COMMENT '应收金额', `discount_amount` decimal(10,4) NOT NULL DEFAULT '0.0000' COMMENT '折扣金额', @@ -28968,19 +28968,22 @@ CREATE TABLE `pay_fee_detail_month` ( `fee_name` varchar(64) DEFAULT NULL COMMENT '费用名称', `config_id` varchar(30) NOT NULL COMMENT '标准ID', `deadline_time` date NOT NULL DEFAULT '1000-01-01' COMMENT '缴费截止时间', + `obj_fpc_id` varchar(30) NOT NULL COMMENT '对象目录,房屋时 floor_id 车辆时 pa_id 合同时 contract_type_id', + `fee_type_cd` varchar(30) NOT NULL COMMENT '费用大类', PRIMARY KEY (`month_id`), KEY `i_pfdm_community_id` (`community_id`), KEY `i_pfdm_cur_month_time` (`cur_month_time`), KEY `i_pfdm_fee_id` (`fee_id`), KEY `i_pfdm_obj_id` (`obj_id`), KEY `i_pfdm_config_id` (`config_id`), - KEY `i_pfdm_owner_id` (`owner_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + KEY `i_pfdm_owner_id` (`owner_id`), + KEY `i_obj_fac_id` (`obj_fpc_id`), + KEY `i_fee_type_cd` (`fee_type_cd`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 -- ---------------------------- -- Records of pay_fee_detail_month -- ---------------------------- -INSERT INTO `pay_fee_detail_month` VALUES ('79202401081920015305000055', '902024010804100039', '912024010830450050', '2024010802740034', '2024', '1', '120.0000', '120.0000', '0.0000', '程序计算生成', '2024-01-08 19:20:01', '0', '1-1-1001', '752024010827870016', '测试业主', '772024010866770019', '18109711443', 'W', '2024-01-08 19:19:47', '2024-01-01 00:00:00', '物业费', '922024010877430036', '2024-02-01'); -- ---------------------------- -- Table structure for pay_fee_qrcode From e934b7ddaf26a2731531cd9687f656178a507396 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 22 Feb 2024 15:11:19 +0800 Subject: [PATCH 16/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/ReportFeeStatisticsServiceDaoImplMapper.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index 0e5e8a3b7c..a6ea3b4976 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -446,9 +446,11 @@ select ifnull(sum(t.received_amount),0.0) receivedFee from pay_fee_detail t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' + LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0' + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' where 1=1 - and t.obj_fpc_id = a.floor_id + and bu.floor_id = a.floor_id and t.status_cd = '0' and t.community_id= a.community_id and t.create_time > #{startDate} @@ -460,7 +462,7 @@ - and t.fee_type_cd = #{feeTypeCd} + and pf.fee_type_cd = #{feeTypeCd} ) receivedFee, ( @@ -810,10 +812,11 @@ select ifnull(sum(t.received_amount),0.0) receivedFee from pay_fee_detail t INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' + inner join pay_fee_config pfc1 on pfc1.config_id = pf.config_id and pfc1.status_cd = '0' where pf.payer_obj_id = a.obj_id and t.status_cd = '0' and t.community_id= a.community_id - and t.fee_type_cd = a.fee_type_cd + and pfc1.fee_type_cd = pfc.fee_type_cd and t.create_time > #{startDate} and t.create_time < #{endDate} ) receivedFee From b8bfea24a0e97dd3b3220e8ba69c5c60b34c5579 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 22 Feb 2024 16:12:04 +0800 Subject: [PATCH 17/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eportFeeStatisticsServiceDaoImplMapper.xml | 72 +++++-------------- 1 file changed, 16 insertions(+), 56 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index a6ea3b4976..b9636de9e8 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -8,15 +8,10 @@ select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.config_id = #{configId} @@ -37,7 +32,7 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} and t.status_cd = '0' and t.detail_id = '-1' @@ -49,15 +44,10 @@ select ifnull(sum(t.receivable_amount),0.0) curOweFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.config_id = #{configId} @@ -78,7 +68,7 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} and t.status_cd = '0' and t.detail_id = '-1' @@ -90,15 +80,10 @@ select ifnull(sum(t.receivable_amount),0.0) oweFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.config_id = #{configId} @@ -119,7 +104,7 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} and t.status_cd = '0' and t.detail_id = '-1' @@ -131,15 +116,11 @@ select ifnull(sum(t.receivable_amount),0.0) curReceivableFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - + where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.config_id = #{configId} @@ -160,7 +141,7 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} and t.status_cd = '0' and t.community_id= #{communityId} @@ -172,15 +153,11 @@ select ifnull(sum(t.received_amount),0.0) hisReceivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - + where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.config_id = #{configId} @@ -201,7 +178,7 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} and t.status_cd = '0' and t.community_id= #{communityId} @@ -214,15 +191,11 @@ select ifnull(sum(t.received_amount),0.0) preReceivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - + where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.config_id = #{configId} @@ -243,7 +216,7 @@ - and pf.fee_type_cd = #{feeTypeCd} + and t.fee_type_cd = #{feeTypeCd} and t.status_cd = '0' and t.community_id= #{communityId} @@ -267,7 +240,7 @@ where 1=1 - and bu.floor_id = #{floorId} + and t.obj_fpc_id = #{floorId} and t.config_id = #{configId} @@ -468,7 +441,6 @@ ( select ifnull(sum(t.received_amount),0.0) preReceivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and t.obj_fpc_id = a.floor_id @@ -490,7 +462,6 @@ ( select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and t.obj_fpc_id = a.floor_id @@ -511,7 +482,6 @@ ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and t.obj_fpc_id = a.floor_id @@ -532,7 +502,6 @@ ( select ifnull(sum(t.receivable_amount),0.0) curReceivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and t.obj_fpc_id = a.floor_id @@ -554,7 +523,6 @@ ( select ifnull(sum(t.received_amount),0.0) hisReceivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and t.obj_fpc_id = a.floor_id @@ -663,7 +631,6 @@ ( select ifnull(sum(t.received_amount),0.0) preReceivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 @@ -686,7 +653,6 @@ ( select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 @@ -707,7 +673,6 @@ ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 @@ -728,7 +693,6 @@ ( select ifnull(sum(t.receivable_amount),0.0) curReceivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 @@ -750,7 +714,6 @@ ( select ifnull(sum(t.received_amount),0.0) hisReceivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 @@ -800,7 +763,6 @@ ( select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where t.status_cd = '0' and t.detail_id = '-1' and t.community_id= a.community_id @@ -836,7 +798,6 @@ ( select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and t.status_cd = '0' and t.detail_id = '-1' @@ -848,7 +809,6 @@ ( select ifnull(sum(t.received_amount),0.0) receivedFee from pay_fee_detail_month t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where t.owner_id = a.owner_id and t.status_cd = '0' and t.community_id= a.community_id From 32fa18c46eb80ee39aca95dd4581c9fd68d7024a Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 22 Feb 2024 17:13:06 +0800 Subject: [PATCH 18/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index b9636de9e8..fa04b0f435 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -240,7 +240,7 @@ where 1=1 - and t.obj_fpc_id = #{floorId} + and bu.floor_id = #{floorId} and t.config_id = #{configId} From 7ec49b173d0acbb465554dc6fac3fc0e7b76f55e Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 22 Feb 2024 18:29:57 +0800 Subject: [PATCH 19/37] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=B9=B6=E5=8F=91?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QueryReportFeeSummaryCmd.java | 111 ++++++++++++------ 1 file changed, 74 insertions(+), 37 deletions(-) diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java index eb4b310465..65b8e04271 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java @@ -6,6 +6,7 @@ import com.java110.core.context.ICmdDataFlowContext; import com.java110.core.event.cmd.Cmd; import com.java110.core.event.cmd.CmdEvent; +import com.java110.core.factory.Java110ThreadPoolFactory; import com.java110.dto.report.QueryStatisticsDto; import com.java110.report.statistics.IBaseDataStatistics; import com.java110.report.statistics.IFeeStatistics; @@ -60,7 +61,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso queryStatisticsDto.setCommunityId(reqJson.getString("communityId")); queryStatisticsDto.setStartDate(reqJson.getString("startDate")); queryStatisticsDto.setEndDate(reqJson.getString("endDate")); - if(reqJson.containsKey("endDate") && !reqJson.getString("endDate").contains(":")) { + if (reqJson.containsKey("endDate") && !reqJson.getString("endDate").contains(":")) { queryStatisticsDto.setEndDate(reqJson.getString("endDate") + " 23:59:59"); } queryStatisticsDto.setConfigId(reqJson.getString("configId")); @@ -70,47 +71,83 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso queryStatisticsDto.setOwnerName(reqJson.getString("ownerName")); queryStatisticsDto.setLink(reqJson.getString("link")); - if(reqJson.containsKey("configIds")){ + if (reqJson.containsKey("configIds")) { queryStatisticsDto.setConfigIds(reqJson.getString("configIds").split(",")); } - //todo 查询历史欠费 - double hisOweFee = feeStatisticsImpl.getHisMonthOweFee(queryStatisticsDto); - - //todo 查询 单月欠费 - double curOweFee = feeStatisticsImpl.getCurMonthOweFee(queryStatisticsDto); - - //todo 查询当月应收 - double curReceivableFee = feeStatisticsImpl.getCurReceivableFee(queryStatisticsDto); - - //todo 查询 欠费追回 - double hisReceivedFee = feeStatisticsImpl.getHisReceivedFee(queryStatisticsDto); - - //todo 查询 预交费用 - double preReceivedFee = feeStatisticsImpl.getPreReceivedFee(queryStatisticsDto); - - //todo 查询实收 - double receivedFee = feeStatisticsImpl.getReceivedFee(queryStatisticsDto); - - //todo 房屋数 - long roomCount = baseDataStatisticsImpl.getRoomCount(queryStatisticsDto); - - //todo 收费房屋数 - long feeRoomCount = feeStatisticsImpl.getFeeRoomCount(queryStatisticsDto); - - //todo 欠费户数 - int oweRoomCount = feeStatisticsImpl.getOweRoomCount(queryStatisticsDto); JSONObject data = new JSONObject(); - data.put("hisOweFee", MoneyUtil.computePriceScale(hisOweFee)); - data.put("curOweFee", MoneyUtil.computePriceScale(curOweFee)); - data.put("hisReceivedFee", MoneyUtil.computePriceScale(hisReceivedFee)); - data.put("preReceivedFee", MoneyUtil.computePriceScale(preReceivedFee)); - data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee)); - data.put("roomCount", roomCount); - data.put("feeRoomCount", feeRoomCount); - data.put("oweRoomCount", oweRoomCount); - data.put("curReceivableFee", MoneyUtil.computePriceScale(curReceivableFee)); + + Java110ThreadPoolFactory java110ThreadPoolFactory = null; + try { + java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(9); + java110ThreadPoolFactory.submit(() -> { + //todo 查询历史欠费 + double hisOweFee = feeStatisticsImpl.getHisMonthOweFee(queryStatisticsDto); + data.put("hisOweFee", MoneyUtil.computePriceScale(hisOweFee)); + return hisOweFee; + }); + + java110ThreadPoolFactory.submit(() -> { + //todo 查询 单月欠费 + double curOweFee = feeStatisticsImpl.getCurMonthOweFee(queryStatisticsDto); + data.put("curOweFee", MoneyUtil.computePriceScale(curOweFee)); + return curOweFee; + }); + + java110ThreadPoolFactory.submit(() -> { + //todo 查询当月应收 + double curReceivableFee = feeStatisticsImpl.getCurReceivableFee(queryStatisticsDto); + data.put("curReceivableFee", MoneyUtil.computePriceScale(curReceivableFee)); + return curReceivableFee; + }); + + java110ThreadPoolFactory.submit(() -> { + //todo 查询 欠费追回 + double hisReceivedFee = feeStatisticsImpl.getHisReceivedFee(queryStatisticsDto); + data.put("hisReceivedFee", MoneyUtil.computePriceScale(hisReceivedFee)); + return hisReceivedFee; + }); + + java110ThreadPoolFactory.submit(() -> { + //todo 查询 预交费用 + double preReceivedFee = feeStatisticsImpl.getPreReceivedFee(queryStatisticsDto); + data.put("preReceivedFee", MoneyUtil.computePriceScale(preReceivedFee)); + return preReceivedFee; + }); + + java110ThreadPoolFactory.submit(() -> { + //todo 查询实收 + double receivedFee = feeStatisticsImpl.getReceivedFee(queryStatisticsDto); + data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee)); + return receivedFee; + }); + + java110ThreadPoolFactory.submit(() -> { + //todo 房屋数 + long roomCount = baseDataStatisticsImpl.getRoomCount(queryStatisticsDto); + data.put("roomCount", roomCount); + return roomCount; + }); + java110ThreadPoolFactory.submit(() -> { + //todo 收费房屋数 + long feeRoomCount = feeStatisticsImpl.getFeeRoomCount(queryStatisticsDto); + data.put("feeRoomCount", feeRoomCount); + return feeRoomCount; + }); + java110ThreadPoolFactory.submit(() -> { + //todo 欠费户数 + int oweRoomCount = feeStatisticsImpl.getOweRoomCount(queryStatisticsDto); + data.put("oweRoomCount", oweRoomCount); + return oweRoomCount; + }); + + java110ThreadPoolFactory.get(); + } finally { + if (java110ThreadPoolFactory != null) { + java110ThreadPoolFactory.stop(); + } + } JSONArray datas = new JSONArray(); datas.add(data); From 6898f137ec1262d8b4fa77efcdffea2e8cdfb492 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 01:53:08 +0800 Subject: [PATCH 20/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A5=BC=E6=A0=8B?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/report/QueryStatisticsDto.java | 18 ++ .../report/ReportFloorFeeStatisticsDto.java | 123 ++++++++++ ...eportFeeStatisticsServiceDaoImplMapper.xml | 12 +- ...FloorFeeStatisticsServiceDaoImplMapper.xml | 230 ++++++++++++++++++ ...portFloorFeeStatisticsInnerServiceSMO.java | 103 ++++++++ .../QueryReportFloorFeeSummaryCmd.java | 182 ++++++++++++-- .../IReportFloorFeeStatisticsServiceDao.java | 26 ++ ...eportFloorFeeStatisticsServiceDaoImpl.java | 74 ++++++ ...FloorFeeStatisticsInnerServiceSMOImpl.java | 80 ++++++ .../statistics/IFloorFeeStatistics.java | 91 +++++++ .../impl/FloorFeeStatisticsImpl.java | 57 +++++ 11 files changed, 973 insertions(+), 23 deletions(-) create mode 100644 java110-bean/src/main/java/com/java110/dto/report/ReportFloorFeeStatisticsDto.java create mode 100644 java110-db/src/main/resources/mapper/report/ReportFloorFeeStatisticsServiceDaoImplMapper.xml create mode 100644 java110-interface/src/main/java/com/java110/intf/report/IReportFloorFeeStatisticsInnerServiceSMO.java create mode 100644 service-report/src/main/java/com/java110/report/dao/IReportFloorFeeStatisticsServiceDao.java create mode 100644 service-report/src/main/java/com/java110/report/dao/impl/ReportFloorFeeStatisticsServiceDaoImpl.java create mode 100644 service-report/src/main/java/com/java110/report/smo/impl/ReportFloorFeeStatisticsInnerServiceSMOImpl.java create mode 100644 service-report/src/main/java/com/java110/report/statistics/IFloorFeeStatistics.java create mode 100644 service-report/src/main/java/com/java110/report/statistics/impl/FloorFeeStatisticsImpl.java diff --git a/java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java b/java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java index e919e35c7f..22a40ad1e8 100644 --- a/java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java +++ b/java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java @@ -17,6 +17,7 @@ public class QueryStatisticsDto extends PageDto implements Serializable { private String endDate; private String floorId; + private String[] floorIds; private String configId; @@ -29,6 +30,7 @@ public class QueryStatisticsDto extends PageDto implements Serializable { private String link; private String feeTypeCd; + private String[] feeTypeCds; private String[] unitIds; @@ -159,4 +161,20 @@ public String getHisDate() { public void setHisDate(String hisDate) { this.hisDate = hisDate; } + + public String[] getFloorIds() { + return floorIds; + } + + public void setFloorIds(String[] floorIds) { + this.floorIds = floorIds; + } + + public String[] getFeeTypeCds() { + return feeTypeCds; + } + + public void setFeeTypeCds(String[] feeTypeCds) { + this.feeTypeCds = feeTypeCds; + } } diff --git a/java110-bean/src/main/java/com/java110/dto/report/ReportFloorFeeStatisticsDto.java b/java110-bean/src/main/java/com/java110/dto/report/ReportFloorFeeStatisticsDto.java new file mode 100644 index 0000000000..5dde85712b --- /dev/null +++ b/java110-bean/src/main/java/com/java110/dto/report/ReportFloorFeeStatisticsDto.java @@ -0,0 +1,123 @@ +package com.java110.dto.report; + +public class ReportFloorFeeStatisticsDto { + + private String floorId; + + private String floorNum; + + private String floorName; + private String oweRoomCount; + private String feeRoomCount; + private String receivedFee; + private String preReceivedFee; + private String hisOweFee; + private String curReceivableFee; + private String curReceivedFee; + private String hisReceivedFee; + + //todo 欠费房屋数 oweRoomCount + + //todo 收费房屋数 feeRoomCount + + //todo 实收金额 receivedFee + + //todo 预收金额 preReceivedFee + + //todo 历史欠费金额 hisOweFee + + //todo 当期应收金额 curReceivableFee + + //todo 当期实收金额 curReceivedFee + + //todo 欠费追回 hisReceivedFee + + + public String getFloorId() { + return floorId; + } + + public void setFloorId(String floorId) { + this.floorId = floorId; + } + + public String getFloorNum() { + return floorNum; + } + + public void setFloorNum(String floorNum) { + this.floorNum = floorNum; + } + + public String getFloorName() { + return floorName; + } + + public void setFloorName(String floorName) { + this.floorName = floorName; + } + + public String getOweRoomCount() { + return oweRoomCount; + } + + public void setOweRoomCount(String oweRoomCount) { + this.oweRoomCount = oweRoomCount; + } + + public String getFeeRoomCount() { + return feeRoomCount; + } + + public void setFeeRoomCount(String feeRoomCount) { + this.feeRoomCount = feeRoomCount; + } + + public String getReceivedFee() { + return receivedFee; + } + + public void setReceivedFee(String receivedFee) { + this.receivedFee = receivedFee; + } + + public String getPreReceivedFee() { + return preReceivedFee; + } + + public void setPreReceivedFee(String preReceivedFee) { + this.preReceivedFee = preReceivedFee; + } + + public String getHisOweFee() { + return hisOweFee; + } + + public void setHisOweFee(String hisOweFee) { + this.hisOweFee = hisOweFee; + } + + public String getCurReceivableFee() { + return curReceivableFee; + } + + public void setCurReceivableFee(String curReceivableFee) { + this.curReceivableFee = curReceivableFee; + } + + public String getCurReceivedFee() { + return curReceivedFee; + } + + public void setCurReceivedFee(String curReceivedFee) { + this.curReceivedFee = curReceivedFee; + } + + public String getHisReceivedFee() { + return hisReceivedFee; + } + + public void setHisReceivedFee(String hisReceivedFee) { + this.hisReceivedFee = hisReceivedFee; + } +} diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index fa04b0f435..dd2b7a48aa 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -759,7 +759,7 @@ select - a.obj_id objId,pfc.fee_type_cd feeTypeCd, + a.obj_id objId,a.fee_type_cd feeTypeCd, ( select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t @@ -778,23 +778,22 @@ where pf.payer_obj_id = a.obj_id and t.status_cd = '0' and t.community_id= a.community_id - and pfc1.fee_type_cd = pfc.fee_type_cd + and pfc1.fee_type_cd = a.fee_type_cd and t.create_time > #{startDate} and t.create_time < #{endDate} ) receivedFee from pay_fee_detail_month a - inner join pay_fee_config pfc on a.config_id = pfc.config_id and pfc.status_cd = '0' where a.obj_id in #{item} - group by a.obj_id,pfc.fee_type_cd,a.community_id + group by a.obj_id,a.fee_type_cd,a.community_id select - a.owner_id ownerId,GROUP_CONCAT(a.obj_name) objName,pfc.fee_type_cd feeTypeCd, + a.owner_id ownerId,GROUP_CONCAT(a.obj_name) objName,a.fee_type_cd feeTypeCd, ( select ifnull(sum(t.receivable_amount),0.0) hisOweFee from pay_fee_detail_month t @@ -817,12 +816,11 @@ and t.pay_fee_time < #{endDate} ) receivedFee from pay_fee_detail_month a - inner join pay_fee_config pfc on a.config_id = pfc.config_id and pfc.status_cd = '0' where a.owner_id in #{item} - group by a.owner_id,pfc.fee_type_cd,a.community_id + group by a.owner_id,a.fee_type_cd,a.community_id diff --git a/java110-db/src/main/resources/mapper/report/ReportFloorFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFloorFeeStatisticsServiceDaoImplMapper.xml new file mode 100644 index 0000000000..2e87da96ab --- /dev/null +++ b/java110-db/src/main/resources/mapper/report/ReportFloorFeeStatisticsServiceDaoImplMapper.xml @@ -0,0 +1,230 @@ + + + + + + + select b.floor_id floorId,count(1) oweRoomCount + from ( + select distinct bu.floor_id,t.payer_obj_id + from report_owe_fee t + inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + + left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' + + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} + and t.end_time <= #{endDate} + and t.amount_owed != 0 + and bu.floor_id in + + #{item} + + + and t.config_id in + + #{item} + + + + and pfc.fee_type_cd = #{feeTypeCd} + + ) b + group by b.floor_id + + + + select b.floor_id floorId,count(1) feeRoomCount + from ( + select distinct bu.floor_id,t.payer_obj_id + from report_owe_fee t + inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001' + inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + where + 1=1 + and t.payer_obj_type = '3333' + and t.community_id= #{communityId} + and pf.community_id= #{communityId} + and t.end_time <= #{endDate} + and bu.floor_id in + + #{item} + + + and t.config_id in + + #{item} + + + + and pf.fee_type_cd = #{feeTypeCd} + + ) b + group by b.floor_id + + + + select bu.floor_id floorId,ifnull(sum(t.received_amount),0.0) receivedFee + from pay_fee_detail t + INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' + LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0' + left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' + where + 1=1 + and t.status_cd = '0' + and t.community_id= #{communityId} + and t.create_time > #{startDate} + and t.create_time < #{endDate} + and bu.floor_id in + + #{item} + + + and pf.config_id in + + #{item} + + + + and pf.fee_type_cd = #{feeTypeCd} + + group by bu.floor_id + + + + select t.obj_fpc_id floorId,ifnull(sum(t.received_amount),0.0) preReceivedFee + from pay_fee_detail_month t + where + 1=1 + and t.obj_fpc_id in + + #{item} + + and t.status_cd = '0' + and t.community_id= #{communityId} + and t.pay_fee_time > #{startDate} + and t.pay_fee_time < #{endDate} + and t.cur_month_time >= #{endDate} + + and t.config_id in + + #{item} + + + + and t.fee_type_cd = #{feeTypeCd} + + group by t.obj_fpc_id + + + + select t.obj_fpc_id floorId,ifnull(sum(t.receivable_amount),0.0) hisOweFee + from pay_fee_detail_month t + where + 1=1 + and t.obj_fpc_id in + + #{item} + + and t.status_cd = '0' + and t.community_id= #{communityId} + and t.detail_id = '-1' + and t.cur_month_time < #{startDate} + + and t.config_id in + + #{item} + + + + and t.fee_type_cd = #{feeTypeCd} + + group by t.obj_fpc_id + + + + select t.obj_fpc_id floorId,ifnull(sum(t.receivable_amount),0.0) curReceivableFee + from pay_fee_detail_month t + where + 1=1 + and t.obj_fpc_id in + + #{item} + + and t.status_cd = '0' + and t.community_id= #{communityId} + and t.cur_month_time >= #{startDate} + and t.cur_month_time < #{endDate} + + and t.config_id in + + #{item} + + + + and t.fee_type_cd = #{feeTypeCd} + + group by t.obj_fpc_id + + + + select t.obj_fpc_id floorId, ifnull(sum(t.receivable_amount),0.0) curReceivedFee + from pay_fee_detail_month t + where + 1=1 + and t.obj_fpc_id in + + #{item} + + and t.status_cd = '0' + and t.community_id= #{communityId} + and t.cur_month_time >= #{startDate} + and t.cur_month_time < #{endDate} + and t.detail_id != '-1' + + and t.config_id in + + #{item} + + + + and t.fee_type_cd = #{feeTypeCd} + + group by t.obj_fpc_id + + + + select t.obj_fpc_id floorId,ifnull(sum(t.received_amount),0.0) hisReceivedFee + from pay_fee_detail_month t + where + 1=1 + and t.obj_fpc_id in + + #{item} + + and t.status_cd = '0' + and t.community_id= #{communityId} + and t.pay_fee_time > #{startDate} + and t.pay_fee_time < #{endDate} + and t.cur_month_time < #{startDate} + and t.detail_id != '-1' + + and t.config_id in + + #{item} + + + + and t.fee_type_cd = #{feeTypeCd} + + group by t.obj_fpc_id + + + + diff --git a/java110-interface/src/main/java/com/java110/intf/report/IReportFloorFeeStatisticsInnerServiceSMO.java b/java110-interface/src/main/java/com/java110/intf/report/IReportFloorFeeStatisticsInnerServiceSMO.java new file mode 100644 index 0000000000..df867feafb --- /dev/null +++ b/java110-interface/src/main/java/com/java110/intf/report/IReportFloorFeeStatisticsInnerServiceSMO.java @@ -0,0 +1,103 @@ +package com.java110.intf.report; + +import com.java110.config.feign.FeignConfiguration; +import com.java110.dto.report.QueryStatisticsDto; +import com.java110.dto.report.ReportFloorFeeStatisticsDto; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import java.util.List; + +/** + * @ClassName IReportFeeStatisticsInnerServiceSMO + * @Description 费用统计类 服务类 + * @Author wuxw + * @Date 2019/4/24 9:04 + * @Version 1.0 + * add by wuxw 2019/4/24 + **/ +@FeignClient(name = "report-service", configuration = {FeignConfiguration.class}) +@RequestMapping("/reportFloorFeeStatisticsApi") +public interface IReportFloorFeeStatisticsInnerServiceSMO { + + + + + /** + * 查询 //todo 欠费房屋数 oweRoomCount + * @param queryStatisticsDto + * @return + */ + @RequestMapping(value = "/getFloorOweRoomCount", method = RequestMethod.POST) + List getFloorOweRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 收费房屋数 feeRoomCount + * @param queryStatisticsDto + * @return + */ + @RequestMapping(value = "/getFloorFeeRoomCount", method = RequestMethod.POST) + List getFloorFeeRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 实收金额 receivedFee + * @param queryStatisticsDto + * @return + */ + @RequestMapping(value = "/getFloorReceivedFee", method = RequestMethod.POST) + List getFloorReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 预收金额 preReceivedFee + * @param queryStatisticsDto + * @return + */ + @RequestMapping(value = "/getFloorPreReceivedFee", method = RequestMethod.POST) + List getFloorPreReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 历史欠费金额 hisOweFee + * @param queryStatisticsDto + * @return + */ + @RequestMapping(value = "/getFloorHisOweFee", method = RequestMethod.POST) + List getFloorHisOweFee(@RequestBody QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 当期应收金额 curReceivableFee + * @param queryStatisticsDto + * @return + */ + @RequestMapping(value = "/getFloorCurReceivableFee", method = RequestMethod.POST) + List getFloorCurReceivableFee(@RequestBody QueryStatisticsDto queryStatisticsDto); + + + + + + + /** + * 查询 //todo 当期实收金额 curReceivedFee + * @param queryStatisticsDto + * @return + */ + @RequestMapping(value = "/getFloorCurReceivedFee", method = RequestMethod.POST) + List getFloorCurReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto); + + + + /** + * 查询 //todo 欠费追回 hisReceivedFee + * @param queryStatisticsDto + * @return + */ + @RequestMapping(value = "/getFloorHisReceivedFee", method = RequestMethod.POST) + List getFloorHisReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto); +} diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java index d85921a66a..5ed2f2acf3 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java @@ -5,15 +5,22 @@ import com.java110.core.context.ICmdDataFlowContext; import com.java110.core.event.cmd.Cmd; import com.java110.core.event.cmd.CmdEvent; +import com.java110.dto.floor.FloorDto; import com.java110.dto.report.QueryStatisticsDto; +import com.java110.dto.report.ReportFloorFeeStatisticsDto; +import com.java110.intf.community.IFloorInnerServiceSMO; import com.java110.report.statistics.IFeeStatistics; +import com.java110.report.statistics.IFloorFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.ListUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import java.math.BigDecimal; import java.text.ParseException; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -24,7 +31,10 @@ public class QueryReportFloorFeeSummaryCmd extends Cmd { @Autowired - private IFeeStatistics feeStatisticsImpl; + private IFloorFeeStatistics floorFeeStatisticsImpl; + + @Autowired + private IFloorInnerServiceSMO floorInnerServiceSMOImpl; @Override public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { @@ -39,17 +49,67 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso queryStatisticsDto.setCommunityId(reqJson.getString("communityId")); queryStatisticsDto.setStartDate(reqJson.getString("startDate")); queryStatisticsDto.setEndDate(reqJson.getString("endDate")); - if(reqJson.containsKey("endDate") && !reqJson.getString("endDate").contains(":")) { + if (reqJson.containsKey("endDate") && !reqJson.getString("endDate").contains(":")) { queryStatisticsDto.setEndDate(reqJson.getString("endDate") + " 23:59:59"); } queryStatisticsDto.setFeeTypeCd(reqJson.getString("feeTypeCd")); - if(reqJson.containsKey("configIds")){ + if (reqJson.containsKey("configIds")) { queryStatisticsDto.setConfigIds(reqJson.getString("configIds").split(",")); } - List datas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); + //todo 查询楼栋 + FloorDto floorDto = new FloorDto(); + floorDto.setCommunityId(reqJson.getString("communityId")); + List floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto); + + if (ListUtil.isNull(floorDtos)) { + context.setResponseEntity(ResultVo.createResponseEntity(new ArrayList<>())); + return; + } + + List floorIds = new ArrayList<>(); + List datas = new ArrayList<>(); + Map dataInfo = null; + for(FloorDto floorDto1:floorDtos){ + floorIds.add(floorDto1.getFloorId()); + dataInfo = new HashMap<>(); + dataInfo.put("floorId",floorDto1.getFloorId()); + dataInfo.put("floorName",floorDto1.getFloorName()); + dataInfo.put("floorNum",floorDto1.getFloorNum()); + datas.add(dataInfo); + } + queryStatisticsDto.setFloorIds(floorIds.toArray(new String[floorIds.size()])); + + //todo 欠费房屋数 oweRoomCount + List oweRoomCounts = floorFeeStatisticsImpl.getFloorOweRoomCount(queryStatisticsDto); + + //todo 收费房屋数 feeRoomCount + List feeRoomCounts = floorFeeStatisticsImpl.getFloorFeeRoomCount(queryStatisticsDto); + + //todo 实收金额 receivedFee + List receivedFees = floorFeeStatisticsImpl.getFloorReceivedFee(queryStatisticsDto); + + //todo 预收金额 preReceivedFee + List preReceivedFees = floorFeeStatisticsImpl.getFloorPreReceivedFee(queryStatisticsDto); - if(datas == null || datas.size() < 1){ + //todo 历史欠费金额 hisOweFee + List hisOweFees = floorFeeStatisticsImpl.getFloorHisOweFee(queryStatisticsDto); + + //todo 当期应收金额 curReceivableFee + List curReceivableFees = floorFeeStatisticsImpl.getFloorCurReceivableFee(queryStatisticsDto); + + //todo 当期实收金额 curReceivedFee + List curReceivedFees = floorFeeStatisticsImpl.getFloorCurReceivedFee(queryStatisticsDto); + + //todo 欠费追回 hisReceivedFee + List hisReceivedFees = floorFeeStatisticsImpl.getFloorHisOweFee(queryStatisticsDto); + + //todo 拼接数据 + computeData(datas,oweRoomCounts,feeRoomCounts,receivedFees,preReceivedFees,hisOweFees,curReceivableFees,curReceivedFees,hisReceivedFees); + + //List datas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); + + if (datas == null || datas.size() < 1) { context.setResponseEntity(ResultVo.createResponseEntity(datas)); return; } @@ -58,29 +118,119 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso BigDecimal feeRoomRate = null; BigDecimal curReceivedFee = null; BigDecimal curReceivableFee = null; - for(Map data:datas){ + for (Map data : datas) { //todo 计算 户收费率 - if(Double.parseDouble(data.get("feeRoomCount").toString())>0){ + if (Double.parseDouble(data.get("feeRoomCount").toString()) > 0) { feeRoomCountDec = new BigDecimal(Double.parseDouble(data.get("feeRoomCount").toString())); oweRoomCountDec = new BigDecimal(Double.parseDouble(data.get("oweRoomCount").toString())); - feeRoomRate = feeRoomCountDec.subtract(oweRoomCountDec).divide(feeRoomCountDec,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP); - data.put("feeRoomRate",feeRoomRate.doubleValue()); - }else{ - data.put("feeRoomRate",0.0); + feeRoomRate = feeRoomCountDec.subtract(oweRoomCountDec).divide(feeRoomCountDec, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP); + data.put("feeRoomRate", feeRoomRate.doubleValue()); + } else { + data.put("feeRoomRate", 0.0); } //todo 计算 收费率 curReceivedFee = new BigDecimal(Double.parseDouble(data.get("curReceivedFee").toString())); curReceivableFee = new BigDecimal(Double.parseDouble(data.get("curReceivableFee").toString())); - if(curReceivableFee.doubleValue()> 0){ - feeRoomRate = curReceivedFee.divide(curReceivableFee,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP); - data.put("feeRate",feeRoomRate.doubleValue()); - }else{ - data.put("feeRate",0.0); + if (curReceivableFee.doubleValue() > 0) { + feeRoomRate = curReceivedFee.divide(curReceivableFee, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP); + data.put("feeRate", feeRoomRate.doubleValue()); + } else { + data.put("feeRate", 0.0); } } context.setResponseEntity(ResultVo.createResponseEntity(datas)); } + + private void computeData(List datas, List oweRoomCounts, + List feeRoomCounts, + List receivedFees, + List preReceivedFees, + List hisOweFees, + List curReceivableFees, + List curReceivedFees, + List hisReceivedFees) { + //todo 欠费房屋数 oweRoomCount + for(Map data :datas){ + data.put("oweRoomCount","0"); + for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:oweRoomCounts){ + if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ + data.put("oweRoomCount",reportFloorFeeStatisticsDto.getOweRoomCount()); + } + } + } + + //todo 收费房屋数 feeRoomCount + for(Map data :datas){ + data.put("feeRoomCount","0"); + for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:feeRoomCounts){ + if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ + data.put("feeRoomCount",reportFloorFeeStatisticsDto.getFeeRoomCount()); + } + } + } + + //todo 实收金额 receivedFee + for(Map data :datas){ + data.put("receivedFee","0"); + for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:receivedFees){ + if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ + data.put("receivedFee",reportFloorFeeStatisticsDto.getReceivedFee()); + } + } + } + + //todo 预收金额 preReceivedFee + for(Map data :datas){ + data.put("preReceivedFee","0"); + for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:preReceivedFees){ + if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ + data.put("preReceivedFee",reportFloorFeeStatisticsDto.getPreReceivedFee()); + } + } + } + + + //todo 历史欠费金额 hisOweFee + for(Map data :datas){ + data.put("hisOweFee","0"); + for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:hisOweFees){ + if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ + data.put("hisOweFee",reportFloorFeeStatisticsDto.getHisOweFee()); + } + } + } + + //todo 当期应收金额 curReceivableFee + for(Map data :datas){ + data.put("curReceivableFee","0"); + for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:curReceivableFees){ + if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ + data.put("curReceivableFee",reportFloorFeeStatisticsDto.getCurReceivableFee()); + } + } + } + + //todo 当期实收金额 curReceivedFee + + for(Map data :datas){ + data.put("curReceivedFee","0"); + for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:curReceivedFees){ + if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ + data.put("curReceivedFee",reportFloorFeeStatisticsDto.getCurReceivedFee()); + } + } + } + //todo 欠费追回 hisReceivedFee + for(Map data :datas){ + data.put("hisReceivedFee","0"); + for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:hisReceivedFees){ + if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ + data.put("hisReceivedFee",reportFloorFeeStatisticsDto.getHisReceivedFee()); + } + } + } + } } diff --git a/service-report/src/main/java/com/java110/report/dao/IReportFloorFeeStatisticsServiceDao.java b/service-report/src/main/java/com/java110/report/dao/IReportFloorFeeStatisticsServiceDao.java new file mode 100644 index 0000000000..e206ced24e --- /dev/null +++ b/service-report/src/main/java/com/java110/report/dao/IReportFloorFeeStatisticsServiceDao.java @@ -0,0 +1,26 @@ +package com.java110.report.dao; + +import java.util.List; +import java.util.Map; + +/** + * 费用统计 dao 层 + */ +public interface IReportFloorFeeStatisticsServiceDao { + + List getFloorOweRoomCount(Map info); + + List getFloorFeeRoomCount(Map info); + + List getFloorReceivedFee(Map info); + + List getFloorPreReceivedFee(Map info); + + List getFloorHisOweFee(Map info); + + List getFloorCurReceivableFee(Map info); + + List getFloorCurReceivedFee(Map info); + + List getFloorHisReceivedFee(Map info); +} diff --git a/service-report/src/main/java/com/java110/report/dao/impl/ReportFloorFeeStatisticsServiceDaoImpl.java b/service-report/src/main/java/com/java110/report/dao/impl/ReportFloorFeeStatisticsServiceDaoImpl.java new file mode 100644 index 0000000000..e5b079ab0d --- /dev/null +++ b/service-report/src/main/java/com/java110/report/dao/impl/ReportFloorFeeStatisticsServiceDaoImpl.java @@ -0,0 +1,74 @@ +package com.java110.report.dao.impl; + +import com.java110.core.base.dao.BaseServiceDao; +import com.java110.core.log.LoggerFactory; +import com.java110.report.dao.IReportFloorFeeStatisticsServiceDao; +import org.slf4j.Logger; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName ReportCommunityServiceDaoImpl + * @Description TODO + * @Author wuxw + * @Date 2020/10/15 22:15 + * @Version 1.0 + * add by wuxw 2020/10/15 + **/ +@Service("reportFloorFeeStatisticsServiceDaoImpl") +public class ReportFloorFeeStatisticsServiceDaoImpl extends BaseServiceDao implements IReportFloorFeeStatisticsServiceDao { + + private static Logger logger = LoggerFactory.getLogger(ReportFloorFeeStatisticsServiceDaoImpl.class); + + + + @Override + public List getFloorOweRoomCount(Map info) { + List infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorOweRoomCount", info); + return infos; + } + + @Override + public List getFloorFeeRoomCount(Map info) { + List infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorFeeRoomCount", info); + return infos; + } + + @Override + public List getFloorReceivedFee(Map info) { + List infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorReceivedFee", info); + return infos; + } + + @Override + public List getFloorPreReceivedFee(Map info) { + List infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorPreReceivedFee", info); + return infos; + } + + @Override + public List getFloorHisOweFee(Map info) { + List infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorHisOweFee", info); + return infos; + } + + @Override + public List getFloorCurReceivableFee(Map info) { + List infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorCurReceivableFee", info); + return infos; + } + + @Override + public List getFloorCurReceivedFee(Map info) { + List infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorCurReceivedFee", info); + return infos; + } + + @Override + public List getFloorHisReceivedFee(Map info) { + List infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorHisReceivedFee", info); + return infos; + } +} diff --git a/service-report/src/main/java/com/java110/report/smo/impl/ReportFloorFeeStatisticsInnerServiceSMOImpl.java b/service-report/src/main/java/com/java110/report/smo/impl/ReportFloorFeeStatisticsInnerServiceSMOImpl.java new file mode 100644 index 0000000000..5f3d5e0cc4 --- /dev/null +++ b/service-report/src/main/java/com/java110/report/smo/impl/ReportFloorFeeStatisticsInnerServiceSMOImpl.java @@ -0,0 +1,80 @@ +package com.java110.report.smo.impl; + + +import com.java110.core.base.smo.BaseServiceSMO; +import com.java110.dto.report.QueryStatisticsDto; +import com.java110.dto.report.ReportFloorFeeStatisticsDto; +import com.java110.intf.report.IReportFloorFeeStatisticsInnerServiceSMO; +import com.java110.report.dao.IReportFloorFeeStatisticsServiceDao; +import com.java110.utils.util.BeanConvertUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName ReportFeeStatisticsInnerServiceSMOImpl + * @Description 费用统计类 + * @Author wuxw + * @Date 2019/4/24 9:20 + * @Version 1.0 + * add by wuxw 2019/4/24 + **/ +@RestController +public class ReportFloorFeeStatisticsInnerServiceSMOImpl extends BaseServiceSMO implements IReportFloorFeeStatisticsInnerServiceSMO { + + @Autowired + private IReportFloorFeeStatisticsServiceDao reportFloorFeeStatisticsServiceDaoImpl; + + + + @Override + public List getFloorOweRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto) { + List data = reportFloorFeeStatisticsServiceDaoImpl.getFloorOweRoomCount(BeanConvertUtil.beanCovertMap(queryStatisticsDto)); + return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class); + } + + @Override + public List getFloorFeeRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto) { + List data = reportFloorFeeStatisticsServiceDaoImpl.getFloorFeeRoomCount(BeanConvertUtil.beanCovertMap(queryStatisticsDto)); + return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class); + } + + @Override + public List getFloorReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto) { + List data = reportFloorFeeStatisticsServiceDaoImpl.getFloorReceivedFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto)); + return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class); + } + + @Override + public List getFloorPreReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto) { + List data = reportFloorFeeStatisticsServiceDaoImpl.getFloorPreReceivedFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto)); + return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class); + } + + @Override + public List getFloorHisOweFee(@RequestBody QueryStatisticsDto queryStatisticsDto) { + List data = reportFloorFeeStatisticsServiceDaoImpl.getFloorHisOweFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto)); + return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class); + } + + @Override + public List getFloorCurReceivableFee(@RequestBody QueryStatisticsDto queryStatisticsDto) { + List data = reportFloorFeeStatisticsServiceDaoImpl.getFloorCurReceivableFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto)); + return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class); + } + + @Override + public List getFloorCurReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto) { + List data = reportFloorFeeStatisticsServiceDaoImpl.getFloorCurReceivedFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto)); + return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class); + } + + @Override + public List getFloorHisReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto) { + List data = reportFloorFeeStatisticsServiceDaoImpl.getFloorHisReceivedFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto)); + return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class); + } +} diff --git a/service-report/src/main/java/com/java110/report/statistics/IFloorFeeStatistics.java b/service-report/src/main/java/com/java110/report/statistics/IFloorFeeStatistics.java new file mode 100644 index 0000000000..05793cb0f4 --- /dev/null +++ b/service-report/src/main/java/com/java110/report/statistics/IFloorFeeStatistics.java @@ -0,0 +1,91 @@ +package com.java110.report.statistics; + +import com.java110.dto.report.QueryStatisticsDto; +import com.java110.dto.report.ReportFloorFeeStatisticsDto; + +import java.util.List; + +/** + * 楼栋费用统计 + */ +public interface IFloorFeeStatistics { + + /** + * 查询 //todo 欠费房屋数 oweRoomCount + * @param queryStatisticsDto + * @return + */ + List getFloorOweRoomCount(QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 收费房屋数 feeRoomCount + * @param queryStatisticsDto + * @return + */ + List getFloorFeeRoomCount(QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 实收金额 receivedFee + * @param queryStatisticsDto + * @return + */ + List getFloorReceivedFee(QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 预收金额 preReceivedFee + * @param queryStatisticsDto + * @return + */ + List getFloorPreReceivedFee(QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 历史欠费金额 hisOweFee + * @param queryStatisticsDto + * @return + */ + List getFloorHisOweFee(QueryStatisticsDto queryStatisticsDto); + + + /** + * 查询 //todo 当期应收金额 curReceivableFee + * @param queryStatisticsDto + * @return + */ + List getFloorCurReceivableFee(QueryStatisticsDto queryStatisticsDto); + + + + + + + /** + * 查询 //todo 当期实收金额 curReceivedFee + * @param queryStatisticsDto + * @return + */ + List getFloorCurReceivedFee(QueryStatisticsDto queryStatisticsDto); + + + + /** + * 查询 //todo 欠费追回 hisReceivedFee + * @param queryStatisticsDto + * @return + */ + List getFloorHisReceivedFee(QueryStatisticsDto queryStatisticsDto); + + + + + + + + + + + +} diff --git a/service-report/src/main/java/com/java110/report/statistics/impl/FloorFeeStatisticsImpl.java b/service-report/src/main/java/com/java110/report/statistics/impl/FloorFeeStatisticsImpl.java new file mode 100644 index 0000000000..db23f7204b --- /dev/null +++ b/service-report/src/main/java/com/java110/report/statistics/impl/FloorFeeStatisticsImpl.java @@ -0,0 +1,57 @@ +package com.java110.report.statistics.impl; + +import com.java110.dto.report.QueryStatisticsDto; +import com.java110.dto.report.ReportFloorFeeStatisticsDto; +import com.java110.intf.report.IReportFloorFeeStatisticsInnerServiceSMO; +import com.java110.report.statistics.IFloorFeeStatistics; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FloorFeeStatisticsImpl implements IFloorFeeStatistics { + @Autowired + private IReportFloorFeeStatisticsInnerServiceSMO reportFloorFeeStatisticsInnerServiceSMOImpl; + @Override + public List getFloorOweRoomCount(QueryStatisticsDto queryStatisticsDto) { + return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorOweRoomCount(queryStatisticsDto); + } + + @Override + public List getFloorFeeRoomCount(QueryStatisticsDto queryStatisticsDto) { + return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorFeeRoomCount(queryStatisticsDto); + } + + @Override + public List getFloorReceivedFee(QueryStatisticsDto queryStatisticsDto) { + return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorReceivedFee(queryStatisticsDto); + + } + + @Override + public List getFloorPreReceivedFee(QueryStatisticsDto queryStatisticsDto) { + return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorPreReceivedFee(queryStatisticsDto); + } + + @Override + public List getFloorHisOweFee(QueryStatisticsDto queryStatisticsDto) { + return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorHisOweFee(queryStatisticsDto); + + } + + @Override + public List getFloorCurReceivableFee(QueryStatisticsDto queryStatisticsDto) { + return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorCurReceivableFee(queryStatisticsDto); + } + + @Override + public List getFloorCurReceivedFee(QueryStatisticsDto queryStatisticsDto) { + return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorCurReceivedFee(queryStatisticsDto); + } + + @Override + public List getFloorHisReceivedFee(QueryStatisticsDto queryStatisticsDto) { + return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorHisReceivedFee(queryStatisticsDto); + } +} From 288213ec6f39905321bd02c5e6acb80a74fcb8e3 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 02:44:42 +0800 Subject: [PATCH 21/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8C=89=E6=B5=81?= =?UTF-8?q?=E5=8A=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eportFeeStatisticsServiceDaoImplMapper.xml | 3 + .../QueryReportFloorFeeSummaryCmd.java | 125 +++++++----------- 2 files changed, 53 insertions(+), 75 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index dd2b7a48aa..4858eeaeeb 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -546,6 +546,9 @@ where 1=1 and a.status_cd = '0' and a.community_id = #{communityId} + + and a.floor_id = #{floorId} + order by a.seq diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java index 5ed2f2acf3..6cbb08af31 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java @@ -33,6 +33,9 @@ public class QueryReportFloorFeeSummaryCmd extends Cmd { @Autowired private IFloorFeeStatistics floorFeeStatisticsImpl; + @Autowired + private IFeeStatistics feeStatisticsImpl; + @Autowired private IFloorInnerServiceSMO floorInnerServiceSMOImpl; @@ -67,45 +70,17 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso return; } - List floorIds = new ArrayList<>(); List datas = new ArrayList<>(); - Map dataInfo = null; - for(FloorDto floorDto1:floorDtos){ - floorIds.add(floorDto1.getFloorId()); - dataInfo = new HashMap<>(); - dataInfo.put("floorId",floorDto1.getFloorId()); - dataInfo.put("floorName",floorDto1.getFloorName()); - dataInfo.put("floorNum",floorDto1.getFloorNum()); - datas.add(dataInfo); - } - queryStatisticsDto.setFloorIds(floorIds.toArray(new String[floorIds.size()])); - - //todo 欠费房屋数 oweRoomCount - List oweRoomCounts = floorFeeStatisticsImpl.getFloorOweRoomCount(queryStatisticsDto); - - //todo 收费房屋数 feeRoomCount - List feeRoomCounts = floorFeeStatisticsImpl.getFloorFeeRoomCount(queryStatisticsDto); - - //todo 实收金额 receivedFee - List receivedFees = floorFeeStatisticsImpl.getFloorReceivedFee(queryStatisticsDto); - - //todo 预收金额 preReceivedFee - List preReceivedFees = floorFeeStatisticsImpl.getFloorPreReceivedFee(queryStatisticsDto); - - //todo 历史欠费金额 hisOweFee - List hisOweFees = floorFeeStatisticsImpl.getFloorHisOweFee(queryStatisticsDto); - - //todo 当期应收金额 curReceivableFee - List curReceivableFees = floorFeeStatisticsImpl.getFloorCurReceivableFee(queryStatisticsDto); - - //todo 当期实收金额 curReceivedFee - List curReceivedFees = floorFeeStatisticsImpl.getFloorCurReceivedFee(queryStatisticsDto); - //todo 欠费追回 hisReceivedFee - List hisReceivedFees = floorFeeStatisticsImpl.getFloorHisOweFee(queryStatisticsDto); + for (FloorDto floorDto1 : floorDtos) { + queryStatisticsDto.setFloorId(floorDto1.getFloorId()); + List floorDatas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); + if (!ListUtil.isNull(floorDatas)) { + datas.add(floorDatas.get(0)); + } + } //todo 拼接数据 - computeData(datas,oweRoomCounts,feeRoomCounts,receivedFees,preReceivedFees,hisOweFees,curReceivableFees,curReceivedFees,hisReceivedFees); //List datas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); @@ -153,82 +128,82 @@ private void computeData(List datas, List oweR List curReceivedFees, List hisReceivedFees) { //todo 欠费房屋数 oweRoomCount - for(Map data :datas){ - data.put("oweRoomCount","0"); - for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:oweRoomCounts){ - if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ - data.put("oweRoomCount",reportFloorFeeStatisticsDto.getOweRoomCount()); + for (Map data : datas) { + data.put("oweRoomCount", "0"); + for (ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto : oweRoomCounts) { + if (reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))) { + data.put("oweRoomCount", reportFloorFeeStatisticsDto.getOweRoomCount()); } } } //todo 收费房屋数 feeRoomCount - for(Map data :datas){ - data.put("feeRoomCount","0"); - for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:feeRoomCounts){ - if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ - data.put("feeRoomCount",reportFloorFeeStatisticsDto.getFeeRoomCount()); + for (Map data : datas) { + data.put("feeRoomCount", "0"); + for (ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto : feeRoomCounts) { + if (reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))) { + data.put("feeRoomCount", reportFloorFeeStatisticsDto.getFeeRoomCount()); } } } //todo 实收金额 receivedFee - for(Map data :datas){ - data.put("receivedFee","0"); - for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:receivedFees){ - if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ - data.put("receivedFee",reportFloorFeeStatisticsDto.getReceivedFee()); + for (Map data : datas) { + data.put("receivedFee", "0"); + for (ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto : receivedFees) { + if (reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))) { + data.put("receivedFee", reportFloorFeeStatisticsDto.getReceivedFee()); } } } //todo 预收金额 preReceivedFee - for(Map data :datas){ - data.put("preReceivedFee","0"); - for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:preReceivedFees){ - if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ - data.put("preReceivedFee",reportFloorFeeStatisticsDto.getPreReceivedFee()); + for (Map data : datas) { + data.put("preReceivedFee", "0"); + for (ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto : preReceivedFees) { + if (reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))) { + data.put("preReceivedFee", reportFloorFeeStatisticsDto.getPreReceivedFee()); } } } //todo 历史欠费金额 hisOweFee - for(Map data :datas){ - data.put("hisOweFee","0"); - for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:hisOweFees){ - if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ - data.put("hisOweFee",reportFloorFeeStatisticsDto.getHisOweFee()); + for (Map data : datas) { + data.put("hisOweFee", "0"); + for (ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto : hisOweFees) { + if (reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))) { + data.put("hisOweFee", reportFloorFeeStatisticsDto.getHisOweFee()); } } } //todo 当期应收金额 curReceivableFee - for(Map data :datas){ - data.put("curReceivableFee","0"); - for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:curReceivableFees){ - if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ - data.put("curReceivableFee",reportFloorFeeStatisticsDto.getCurReceivableFee()); + for (Map data : datas) { + data.put("curReceivableFee", "0"); + for (ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto : curReceivableFees) { + if (reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))) { + data.put("curReceivableFee", reportFloorFeeStatisticsDto.getCurReceivableFee()); } } } //todo 当期实收金额 curReceivedFee - for(Map data :datas){ - data.put("curReceivedFee","0"); - for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:curReceivedFees){ - if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ - data.put("curReceivedFee",reportFloorFeeStatisticsDto.getCurReceivedFee()); + for (Map data : datas) { + data.put("curReceivedFee", "0"); + for (ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto : curReceivedFees) { + if (reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))) { + data.put("curReceivedFee", reportFloorFeeStatisticsDto.getCurReceivedFee()); } } } //todo 欠费追回 hisReceivedFee - for(Map data :datas){ - data.put("hisReceivedFee","0"); - for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:hisReceivedFees){ - if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){ - data.put("hisReceivedFee",reportFloorFeeStatisticsDto.getHisReceivedFee()); + for (Map data : datas) { + data.put("hisReceivedFee", "0"); + for (ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto : hisReceivedFees) { + if (reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))) { + data.put("hisReceivedFee", reportFloorFeeStatisticsDto.getHisReceivedFee()); } } } From 8fdf21bb51e894565e19078add363b39a4985c73 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 02:52:08 +0800 Subject: [PATCH 22/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8C=89=E6=B5=81?= =?UTF-8?q?=E5=8A=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QueryReportFloorFeeSummaryCmd.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java index 6cbb08af31..b8c60525d9 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java @@ -5,6 +5,7 @@ import com.java110.core.context.ICmdDataFlowContext; import com.java110.core.event.cmd.Cmd; import com.java110.core.event.cmd.CmdEvent; +import com.java110.core.factory.Java110ThreadPoolFactory; import com.java110.dto.floor.FloorDto; import com.java110.dto.report.QueryStatisticsDto; import com.java110.dto.report.ReportFloorFeeStatisticsDto; @@ -71,12 +72,24 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso } List datas = new ArrayList<>(); - - for (FloorDto floorDto1 : floorDtos) { - queryStatisticsDto.setFloorId(floorDto1.getFloorId()); - List floorDatas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); - if (!ListUtil.isNull(floorDatas)) { - datas.add(floorDatas.get(0)); + Java110ThreadPoolFactory java110ThreadPoolFactory = null; + try { + java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(5); + for (FloorDto floorDto1 : floorDtos) { + queryStatisticsDto.setFloorId(floorDto1.getFloorId()); + java110ThreadPoolFactory.submit(() -> { + //todo 欠费户数 + List floorDatas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); + if (!ListUtil.isNull(floorDatas)) { + datas.add(floorDatas.get(0)); + } + return datas; + }); + } + java110ThreadPoolFactory.get(); + } finally { + if (java110ThreadPoolFactory != null) { + java110ThreadPoolFactory.stop(); } } From c36e5fe7a36a9ee736c15c9766795382aa11ede9 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 03:06:56 +0800 Subject: [PATCH 23/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8C=89=E6=B5=81?= =?UTF-8?q?=E5=8A=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QueryReportFloorFeeSummaryCmd.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java index b8c60525d9..fb35425b13 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java @@ -64,6 +64,10 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso //todo 查询楼栋 FloorDto floorDto = new FloorDto(); floorDto.setCommunityId(reqJson.getString("communityId")); + if(reqJson.containsKey("page")) { + floorDto.setPage(reqJson.getIntValue("page")); + floorDto.setRow(reqJson.getIntValue("row")); + } List floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto); if (ListUtil.isNull(floorDtos)) { @@ -77,9 +81,10 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(5); for (FloorDto floorDto1 : floorDtos) { queryStatisticsDto.setFloorId(floorDto1.getFloorId()); + QueryStatisticsDto tmpQueryStatisticsDto = queryStatisticsDto; java110ThreadPoolFactory.submit(() -> { //todo 欠费户数 - List floorDatas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); + List floorDatas = feeStatisticsImpl.getFloorFeeSummary(tmpQueryStatisticsDto); if (!ListUtil.isNull(floorDatas)) { datas.add(floorDatas.get(0)); } From 05a7bd779ec83e2377ea88d631e462ca36efda0a Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 03:10:59 +0800 Subject: [PATCH 24/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8C=89=E6=B5=81?= =?UTF-8?q?=E5=8A=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QueryReportFloorFeeSummaryCmd.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java index fb35425b13..0c4e6da240 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java @@ -14,6 +14,7 @@ import com.java110.report.statistics.IFloorFeeStatistics; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; +import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.ListUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; @@ -81,7 +82,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(5); for (FloorDto floorDto1 : floorDtos) { queryStatisticsDto.setFloorId(floorDto1.getFloorId()); - QueryStatisticsDto tmpQueryStatisticsDto = queryStatisticsDto; + QueryStatisticsDto tmpQueryStatisticsDto = BeanConvertUtil.covertBean(queryStatisticsDto,QueryStatisticsDto.class); java110ThreadPoolFactory.submit(() -> { //todo 欠费户数 List floorDatas = feeStatisticsImpl.getFloorFeeSummary(tmpQueryStatisticsDto); From ade7cb42271e7f831494a185aa193d67bdac8b35 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 10:52:52 +0800 Subject: [PATCH 25/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java index 65b8e04271..fc6fcc6b05 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java @@ -80,7 +80,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso Java110ThreadPoolFactory java110ThreadPoolFactory = null; try { - java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(9); + java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(5); java110ThreadPoolFactory.submit(() -> { //todo 查询历史欠费 double hisOweFee = feeStatisticsImpl.getHisMonthOweFee(queryStatisticsDto); From 8a605a8595ed3896b957d00a597310f373f653fc Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 11:12:14 +0800 Subject: [PATCH 26/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eportFeeStatisticsServiceDaoImplMapper.xml | 88 +------------------ .../QueryReportFloorFeeSummaryCmd.java | 72 +++++++-------- 2 files changed, 37 insertions(+), 123 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index 4858eeaeeb..8327b61f37 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -416,70 +416,6 @@ where b.floor_id = a.floor_id ) feeRoomCount, ( - select ifnull(sum(t.received_amount),0.0) receivedFee - from pay_fee_detail t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - where - 1=1 - and bu.floor_id = a.floor_id - and t.status_cd = '0' - and t.community_id= a.community_id - and t.create_time > #{startDate} - and t.create_time < #{endDate} - - and pf.config_id in - - #{item} - - - - and pf.fee_type_cd = #{feeTypeCd} - - ) receivedFee, - ( - select ifnull(sum(t.received_amount),0.0) preReceivedFee - from pay_fee_detail_month t - where - 1=1 - and t.obj_fpc_id = a.floor_id - and t.status_cd = '0' - and t.community_id= a.community_id - and t.pay_fee_time > #{startDate} - and t.pay_fee_time < #{endDate} - and t.cur_month_time >= #{endDate} - - and t.config_id in - - #{item} - - - - and t.fee_type_cd = #{feeTypeCd} - - ) preReceivedFee, - ( - select ifnull(sum(t.receivable_amount),0.0) hisOweFee - from pay_fee_detail_month t - where - 1=1 - and t.obj_fpc_id = a.floor_id - and t.status_cd = '0' - and t.community_id= a.community_id - and t.detail_id = '-1' - and t.cur_month_time < #{startDate} - - and t.config_id in - - #{item} - - - - and t.fee_type_cd = #{feeTypeCd} - - ) hisOweFee, - ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee from pay_fee_detail_month t where @@ -519,29 +455,7 @@ and t.fee_type_cd = #{feeTypeCd} - ) curReceivedFee, - ( - select ifnull(sum(t.received_amount),0.0) hisReceivedFee - from pay_fee_detail_month t - where - 1=1 - and t.obj_fpc_id = a.floor_id - and t.status_cd = '0' - and t.community_id= a.community_id - and t.pay_fee_time > #{startDate} - and t.pay_fee_time < #{endDate} - and t.cur_month_time < #{startDate} - and t.detail_id != '-1' - - and t.config_id in - - #{item} - - - - and t.fee_type_cd = #{feeTypeCd} - - ) hisReceivedFee + ) curReceivedFee from f_floor a where 1=1 and a.status_cd = '0' diff --git a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java index 0c4e6da240..0cbb8ac8dd 100644 --- a/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java +++ b/service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java @@ -63,45 +63,45 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso } //todo 查询楼栋 - FloorDto floorDto = new FloorDto(); - floorDto.setCommunityId(reqJson.getString("communityId")); - if(reqJson.containsKey("page")) { - floorDto.setPage(reqJson.getIntValue("page")); - floorDto.setRow(reqJson.getIntValue("row")); - } - List floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto); - - if (ListUtil.isNull(floorDtos)) { - context.setResponseEntity(ResultVo.createResponseEntity(new ArrayList<>())); - return; - } - - List datas = new ArrayList<>(); - Java110ThreadPoolFactory java110ThreadPoolFactory = null; - try { - java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(5); - for (FloorDto floorDto1 : floorDtos) { - queryStatisticsDto.setFloorId(floorDto1.getFloorId()); - QueryStatisticsDto tmpQueryStatisticsDto = BeanConvertUtil.covertBean(queryStatisticsDto,QueryStatisticsDto.class); - java110ThreadPoolFactory.submit(() -> { - //todo 欠费户数 - List floorDatas = feeStatisticsImpl.getFloorFeeSummary(tmpQueryStatisticsDto); - if (!ListUtil.isNull(floorDatas)) { - datas.add(floorDatas.get(0)); - } - return datas; - }); - } - java110ThreadPoolFactory.get(); - } finally { - if (java110ThreadPoolFactory != null) { - java110ThreadPoolFactory.stop(); - } - } +// FloorDto floorDto = new FloorDto(); +// floorDto.setCommunityId(reqJson.getString("communityId")); +// if(reqJson.containsKey("page")) { +// floorDto.setPage(reqJson.getIntValue("page")); +// floorDto.setRow(reqJson.getIntValue("row")); +// } +// List floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto); +// +// if (ListUtil.isNull(floorDtos)) { +// context.setResponseEntity(ResultVo.createResponseEntity(new ArrayList<>())); +// return; +// } + +// List datas = new ArrayList<>(); +// Java110ThreadPoolFactory java110ThreadPoolFactory = null; +// try { +// java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(5); +// for (FloorDto floorDto1 : floorDtos) { +// queryStatisticsDto.setFloorId(floorDto1.getFloorId()); +// QueryStatisticsDto tmpQueryStatisticsDto = BeanConvertUtil.covertBean(queryStatisticsDto,QueryStatisticsDto.class); +// java110ThreadPoolFactory.submit(() -> { +// //todo 欠费户数 +// List floorDatas = feeStatisticsImpl.getFloorFeeSummary(tmpQueryStatisticsDto); +// if (!ListUtil.isNull(floorDatas)) { +// datas.add(floorDatas.get(0)); +// } +// return datas; +// }); +// } +// java110ThreadPoolFactory.get(); +// } finally { +// if (java110ThreadPoolFactory != null) { +// java110ThreadPoolFactory.stop(); +// } +// } //todo 拼接数据 - //List datas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); + List datas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto); if (datas == null || datas.size() < 1) { context.setResponseEntity(ResultVo.createResponseEntity(datas)); From b43094848b1f2efe96d95c3506917c308ba01521 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 13:57:49 +0800 Subject: [PATCH 27/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index 8327b61f37..f4e239e73d 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -417,7 +417,7 @@ ) feeRoomCount, ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee - from pay_fee_detail_month t + from pay_fee_detail_month t force index(i_pay_fee_detail_co) where 1=1 and t.obj_fpc_id = a.floor_id @@ -437,7 +437,7 @@ ) curReceivableFee, ( select ifnull(sum(t.receivable_amount),0.0) curReceivedFee - from pay_fee_detail_month t + from pay_fee_detail_month t force index(i_pay_fee_detail_co) where 1=1 and t.obj_fpc_id = a.floor_id From 0ac5016216d02f0b15bf9425bc592494d452a8ae Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 14:22:37 +0800 Subject: [PATCH 28/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index f4e239e73d..8327b61f37 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -417,7 +417,7 @@ ) feeRoomCount, ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee - from pay_fee_detail_month t force index(i_pay_fee_detail_co) + from pay_fee_detail_month t where 1=1 and t.obj_fpc_id = a.floor_id @@ -437,7 +437,7 @@ ) curReceivableFee, ( select ifnull(sum(t.receivable_amount),0.0) curReceivedFee - from pay_fee_detail_month t force index(i_pay_fee_detail_co) + from pay_fee_detail_month t where 1=1 and t.obj_fpc_id = a.floor_id From 4298412d9bedb05235b16192309b74958d0ea783 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 14:38:34 +0800 Subject: [PATCH 29/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eportFeeStatisticsServiceDaoImplMapper.xml | 92 +------------------ 1 file changed, 2 insertions(+), 90 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index 8327b61f37..3510d19e47 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -520,73 +520,7 @@ ) b where b.fee_type_cd = a.status_cd ) feeRoomCount, - ( - select ifnull(sum(t.received_amount),0.0) receivedFee - from pay_fee_detail t - INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' - - LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0' - left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' - - where - 1=1 - - and bu.floor_id = #{floorId} - - and t.status_cd = '0' - and t.community_id= #{communityId} - and t.create_time > #{startDate} - and t.create_time < #{endDate} - - and pf.config_id in - - #{item} - - - and pf.fee_type_cd = a.status_cd - ) receivedFee, - ( - select ifnull(sum(t.received_amount),0.0) preReceivedFee - from pay_fee_detail_month t - where - 1=1 - - and t.obj_fpc_id = #{floorId} - - and t.status_cd = '0' - and t.community_id= #{communityId} - and t.pay_fee_time > #{startDate} - and t.pay_fee_time < #{endDate} - and t.cur_month_time >= #{endDate} - and t.detail_id != '-1' - - and t.config_id in - - #{item} - - - and t.fee_type_cd = a.status_cd - ) preReceivedFee, - ( - select ifnull(sum(t.receivable_amount),0.0) hisOweFee - from pay_fee_detail_month t - where - 1=1 - - and t.obj_fpc_id = #{floorId} - - and t.status_cd = '0' - and t.community_id= #{communityId} - and t.detail_id = '-1' - and t.cur_month_time < #{startDate} - - and t.config_id in - - #{item} - - - and t.fee_type_cd = a.status_cd - ) hisOweFee, + ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee from pay_fee_detail_month t @@ -627,29 +561,7 @@ and t.fee_type_cd = a.status_cd - ) curReceivedFee, - ( - select ifnull(sum(t.received_amount),0.0) hisReceivedFee - from pay_fee_detail_month t - where - 1=1 - - and t.obj_fpc_id = #{floorId} - - and t.status_cd = '0' - and t.community_id= #{communityId} - and t.pay_fee_time > #{startDate} - and t.pay_fee_time < #{endDate} - and t.cur_month_time < #{startDate} - and t.detail_id != '-1' - - and t.config_id in - - #{item} - - - and t.fee_type_cd = a.status_cd - ) hisReceivedFee + ) curReceivedFee from t_dict a where 1=1 and a.table_name = 'pay_fee_config' From bdbe0a7078fec90cc0828cecccbe6c1a0f639e5f Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 15:01:54 +0800 Subject: [PATCH 30/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index 3510d19e47..fea7f8316c 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -523,7 +523,7 @@ ( select ifnull(sum(t.receivable_amount),0.0) curReceivableFee - from pay_fee_detail_month t + from pay_fee_detail_month t force index(i_pay_fee_detail_fc) where 1=1 @@ -543,7 +543,7 @@ ) curReceivableFee, ( select ifnull(sum(t.receivable_amount),0.0) curReceivedFee - from pay_fee_detail_month t + from pay_fee_detail_month t force index(i_pay_fee_detail_fc) where 1=1 From 71972c9a3e400354e94cd7f1babc3542318ec43b Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 17:50:55 +0800 Subject: [PATCH 31/37] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index fea7f8316c..d2a11ff9f8 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -7,7 +7,7 @@ select ifnull(sum(t.receivable_amount),0.0) hisOweFee - from pay_fee_detail_month t + from pay_fee_detail_month t force index(i_pfdm_cur_month_time) where 1=1 From 72e90335e558db173d9bd1e3bd97a83fd3d7fd32 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 17:54:36 +0800 Subject: [PATCH 32/37] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index d2a11ff9f8..fea7f8316c 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -7,7 +7,7 @@ select ifnull(sum(t.receivable_amount),0.0) hisOweFee - from pay_fee_detail_month t force index(i_pfdm_cur_month_time) + from pay_fee_detail_month t where 1=1 From b0162e0b8ed77cf81bd52739e80497edd25abffa Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 23 Feb 2024 18:28:33 +0800 Subject: [PATCH 33/37] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eportFeeStatisticsServiceDaoImplMapper.xml | 85 +++++++++---------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml index fea7f8316c..cbbc791e47 100644 --- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml @@ -469,6 +469,47 @@ select a.name, ( + select ifnull(sum(t.receivable_amount),0.0) curReceivableFee + from pay_fee_detail_month t force index(i_fc) + where + 1=1 + + and t.obj_fpc_id = #{floorId} + + and t.status_cd = '0' + and t.community_id= #{communityId} + and t.cur_month_time >= #{startDate} + and t.cur_month_time < #{endDate} + + and t.config_id in + + #{item} + + + and t.fee_type_cd = a.status_cd + ) curReceivableFee, + ( + select ifnull(sum(t.receivable_amount),0.0) curReceivedFee + from pay_fee_detail_month t force index(i_fc) + where + 1=1 + + and t.obj_fpc_id = #{floorId} + + and t.status_cd = '0' + and t.community_id= #{communityId} + and t.cur_month_time >= #{startDate} + and t.cur_month_time < #{endDate} + and t.detail_id != '-1' + + and t.config_id in + + #{item} + + + and t.fee_type_cd = a.status_cd + ) curReceivedFee, + ( select count(1) from ( select pfc.fee_type_cd,t.payer_obj_id from report_owe_fee t @@ -519,49 +560,7 @@ group by pf.fee_type_cd,t.payer_obj_id ) b where b.fee_type_cd = a.status_cd - ) feeRoomCount, - - ( - select ifnull(sum(t.receivable_amount),0.0) curReceivableFee - from pay_fee_detail_month t force index(i_pay_fee_detail_fc) - where - 1=1 - - and t.obj_fpc_id = #{floorId} - - and t.status_cd = '0' - and t.community_id= #{communityId} - and t.cur_month_time >= #{startDate} - and t.cur_month_time < #{endDate} - - and t.config_id in - - #{item} - - - and t.fee_type_cd = a.status_cd - ) curReceivableFee, - ( - select ifnull(sum(t.receivable_amount),0.0) curReceivedFee - from pay_fee_detail_month t force index(i_pay_fee_detail_fc) - where - 1=1 - - and t.obj_fpc_id = #{floorId} - - and t.status_cd = '0' - and t.community_id= #{communityId} - and t.cur_month_time >= #{startDate} - and t.cur_month_time < #{endDate} - and t.detail_id != '-1' - - and t.config_id in - - #{item} - - - and t.fee_type_cd = a.status_cd - ) curReceivedFee + ) feeRoomCount from t_dict a where 1=1 and a.table_name = 'pay_fee_config' From e511a41acf8f6089ccaf89c7f0068eb888364339 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 29 Feb 2024 11:08:51 +0800 Subject: [PATCH 34/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E7=AB=AF=E5=AE=A2=E6=9C=8D=E6=B2=A1=E6=9C=89=E7=94=B5=E8=AF=9D?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/db/tt.sql | 4 ++-- .../java/com/java110/dto/user/LoginOwnerResDto.java | 12 ++++++++++++ .../com/java110/user/cmd/user/OwnerUserLoginCmd.java | 5 +++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/db/tt.sql b/docs/db/tt.sql index 9fffcc408f..9f86da70c4 100644 --- a/docs/db/tt.sql +++ b/docs/db/tt.sql @@ -28977,8 +28977,8 @@ CREATE TABLE `pay_fee_detail_month` ( KEY `i_pfdm_obj_id` (`obj_id`), KEY `i_pfdm_config_id` (`config_id`), KEY `i_pfdm_owner_id` (`owner_id`), - KEY `i_obj_fac_id` (`obj_fpc_id`), - KEY `i_fee_type_cd` (`fee_type_cd`) + KEY `i_oc_pay_fee_detail_month` (`obj_fpc_id`,`cur_month_time`), + KEY `i_fc_pay_fee_detail_month` (`fee_type_cd`,`cur_month_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 -- ---------------------------- diff --git a/java110-bean/src/main/java/com/java110/dto/user/LoginOwnerResDto.java b/java110-bean/src/main/java/com/java110/dto/user/LoginOwnerResDto.java index eb29c493ee..4cc073720d 100644 --- a/java110-bean/src/main/java/com/java110/dto/user/LoginOwnerResDto.java +++ b/java110-bean/src/main/java/com/java110/dto/user/LoginOwnerResDto.java @@ -23,6 +23,9 @@ public class LoginOwnerResDto implements Serializable { private String communityName; + private String communityTel; + + private String token; private String key; @@ -31,6 +34,7 @@ public class LoginOwnerResDto implements Serializable { private String ownerTypeCd; + public String getUserId() { return userId; } @@ -126,4 +130,12 @@ public String getOwnerTypeCd() { public void setOwnerTypeCd(String ownerTypeCd) { this.ownerTypeCd = ownerTypeCd; } + + public String getCommunityTel() { + return communityTel; + } + + public void setCommunityTel(String communityTel) { + this.communityTel = communityTel; + } } diff --git a/service-user/src/main/java/com/java110/user/cmd/user/OwnerUserLoginCmd.java b/service-user/src/main/java/com/java110/user/cmd/user/OwnerUserLoginCmd.java index ffaa49127a..4d8e95d9e9 100644 --- a/service-user/src/main/java/com/java110/user/cmd/user/OwnerUserLoginCmd.java +++ b/service-user/src/main/java/com/java110/user/cmd/user/OwnerUserLoginCmd.java @@ -128,7 +128,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso // todo 3.0 查询业主是否存在 OwnerDto ownerDto = null; - if (ownerAppUserDtos.get(0).getMemberId().startsWith("-1")){ + if (ownerAppUserDtos.get(0).getMemberId().startsWith("-1")) { //todo 这里考虑游客的情况 ownerDto = new OwnerDto(); ownerDto.setOwnerId(ownerAppUserDtos.get(0).getMemberId()); @@ -136,7 +136,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso ownerDto.setName(ownerAppUserDtos.get(0).getAppUserName()); ownerDto.setLink(ownerAppUserDtos.get(0).getLink()); ownerDto.setCommunityId(ownerAppUserDtos.get(0).getCommunityId()); - }else { + } else { ownerDto = new OwnerDto(); ownerDto.setMemberId(ownerAppUserDtos.get(0).getMemberId()); ownerDto.setCommunityId(ownerAppUserDtos.get(0).getCommunityId()); @@ -169,6 +169,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJso loginOwnerResDto.setOwnerTel(ownerDto.getLink()); loginOwnerResDto.setCommunityId(ownerDto.getCommunityId()); loginOwnerResDto.setCommunityName(communityDtos.get(0).getName()); + loginOwnerResDto.setCommunityTel(communityDtos.get(0).getTel()); loginOwnerResDto.setToken(token); loginOwnerResDto.setKey(newKey); loginOwnerResDto.setOwnerTypeCd(ownerDto.getOwnerTypeCd()); From ff48a8ffc9c7217a0dfce213cb430e338c2521b5 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Wed, 6 Mar 2024 16:13:49 +0800 Subject: [PATCH 35/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BbgNativeQrcodePaymentFactoryAdapt.java | 285 --------------- .../adapt/bbgpay/BbgPaymentFactoryAdapt.java | 331 ------------------ .../adapt/bbgpay/BbgRefundMoneyAdapt.java | 118 ------- .../adapt/bbgpay/EncryptDecryptFactory.java | 65 ---- .../adapt/bbgpay/QrCodeBbgPaymentAdapt.java | 217 ------------ .../payment/adapt/bbgpay/lib/AesEncrypt.java | 175 --------- .../payment/adapt/bbgpay/lib/Base64Util.java | 37 -- .../acct/payment/adapt/bbgpay/lib/CAUtil.java | 184 ---------- .../acct/payment/adapt/bbgpay/lib/GmUtil.java | 311 ---------------- .../adapt/bbgpay/lib/HttpRequestUtil.java | 119 ------- .../payment/adapt/bbgpay/lib/JsonUtil.java | 73 ---- .../payment/adapt/bbgpay/lib/StreamUtil.java | 127 ------- .../payment/adapt/bbgpay/package-info.java | 4 - .../easypay/EasyPaymentFactoryAdapt.java | 3 - .../adapt/easypay/EasyRefundMoneyAdapt.java | 1 - 15 files changed, 2050 deletions(-) delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgNativeQrcodePaymentFactoryAdapt.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgPaymentFactoryAdapt.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java delete mode 100644 service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgNativeQrcodePaymentFactoryAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgNativeQrcodePaymentFactoryAdapt.java deleted file mode 100644 index 2fc213d580..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgNativeQrcodePaymentFactoryAdapt.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.payment.IPaymentFactoryAdapt; -import com.java110.acct.payment.adapt.bbgpay.lib.GmUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.JsonUtil; -import com.java110.core.context.ICmdDataFlowContext; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.factory.WechatFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.app.AppDto; -import com.java110.dto.owner.OwnerAppUserDto; -import com.java110.dto.payment.NotifyPaymentOrderDto; -import com.java110.dto.payment.PaymentOrderDto; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.dto.wechat.SmallWeChatDto; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.store.ISmallWechatV1InnerServiceSMO; -import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; -import com.java110.po.wechat.OnlinePayPo; -import com.java110.utils.cache.MappingCache; -import com.java110.utils.cache.UrlCache; -import com.java110.utils.constant.MappingConstant; -import com.java110.utils.constant.WechatConstant; -import com.java110.utils.util.BeanConvertUtil; -import com.java110.utils.util.PayUtil; -import com.java110.utils.util.StringUtil; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.*; - -/** - * 北部湾银行支付厂家 - * - * // 以下数据先查询是否存在 存在则修改 不存在添加 - * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) - * VALUES ('WECHAT', 'native支付厂家', 'NATIVE_QRCODE_PAYMENT_ADAPT', 'bbgNativeQrcodePaymentFactoryAdapt', '', '2023-02-18 18:47:14', '0'); - - */ -@Service("bbgNativeQrcodePaymentFactoryAdapt") -public class BbgNativeQrcodePaymentFactoryAdapt implements IPaymentFactoryAdapt { - - private static final Logger logger = LoggerFactory.getLogger(BbgNativeQrcodePaymentFactoryAdapt.class); - - - //微信支付 - public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; - // 微信服务商支付开关 - public static final String WECHAT_SERVICE_PAY_SWITCH = "WECHAT_SERVICE_PAY_SWITCH"; - - //开关ON打开 - public static final String WECHAT_SERVICE_PAY_SWITCH_ON = "ON"; - - - private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; - - private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; - - public static final String TRADE_TYPE_NATIVE = "NATIVE"; - public static final String TRADE_TYPE_JSAPI = "JSAPI"; - public static final String TRADE_TYPE_MWEB = "MWEB"; - public static final String TRADE_TYPE_APP = "APP"; - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/getQrcodeLink"; - - @Autowired - private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; - - - @Autowired - private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; - - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - @Override - public Map java110Payment(PaymentOrderDto paymentOrderDto, JSONObject reqJson, ICmdDataFlowContext context) throws Exception { - - SmallWeChatDto smallWeChatDto = getSmallWechat(reqJson); - String paymentPoolId = reqJson.getString("paymentPoolId"); - - String appId = context.getReqHeaders().get("app-id"); - String userId = context.getReqHeaders().get("user-id"); - String tradeType = reqJson.getString("tradeType"); - String notifyUrl = UrlCache.getOwnerUrl() + "/app/payment/notify/nativeWechat/992020011134400001/" + paymentPoolId; - - - logger.debug("【小程序支付】 统一下单开始, 订单编号=" + paymentOrderDto.getOrderId()); - SortedMap resultMap = new TreeMap(); - //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 - double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV"), paymentOrderDto.getMoney()); - //添加或更新支付记录(参数跟进自己业务需求添加) - - Map resMap = null; - resMap = this.java110UnifieldOrder(paymentOrderDto.getName(), - paymentOrderDto.getOrderId(), - payAmount, - smallWeChatDto, - paymentPoolId, - notifyUrl - ); - - - return resMap; - } - - - private Map java110UnifieldOrder(String feeName, String orderNum, - double payAmount, - SmallWeChatDto smallWeChatDto, - String paymentPoolId, - String notifyUrl) throws Exception { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String productNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "productNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - - if (feeName.length() > 127) { - feeName = feeName.substring(0, 126); - } - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("product_no", productNo_SM4);// 产品编号 - params.put("qr_type", "DYNAMIC");// 业务类型 - params.put("txn_type", "0");// 交易类型 0-实时;1-担保 - params.put("tran_no", orderNum);// 商户流水 - params.put("amt", payAmount);// 交易金额 - params.put("ware_name", feeName);// 商品名称 - params.put("ware_describe", "");// 商户数据包 - params.put("trx_trm_no", "");// 交易终端编号 - params.put("trans_source", "09");// 08:商户线下扫码09:商户线上收银10:一案一户缴款11:维修资金缴款12:房屋预售缴款 - params.put("asyn_url", notifyUrl + "?wId=" + WechatFactory.getWId(smallWeChatDto.getAppId()));// 通知地址 - - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, gzhPayUrl, params); - JSONObject paramOut = JSONObject.parseObject(decryParams); - if (!"SUCCESS".equals(paramOut.getString("status")) - || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - if (!"0000".equals(paramOut.getString("return_code")) - && !"0001".equals(paramOut.getString("return_code")) - ) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - SortedMap resultMap = new TreeMap(); - resultMap.put("prepayId", paramOut.getString("tran_no")); - resultMap.put("codeUrl", paramOut.getString("qr_link")); - resultMap.put("code", "0"); - resultMap.put("msg", "下单成功"); - doSaveOnlinePay(smallWeChatDto, "无", orderNum, feeName, payAmount, OnlinePayDto.STATE_WAIT, "待支付",paymentPoolValueDtos.get(0).getPpId()); - - return resultMap; - } - - - @Override - public PaymentOrderDto java110NotifyPayment(NotifyPaymentOrderDto notifyPaymentOrderDto) { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(notifyPaymentOrderDto.getPaymentPoolId()); - paymentPoolValueDto.setCommunityId(notifyPaymentOrderDto.getCommunityId()); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - String privateKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "privateKey_SM4"); - - String resXml = ""; - String param = notifyPaymentOrderDto.getParam(); - PaymentOrderDto paymentOrderDto = new PaymentOrderDto(); - // 开始解密 - Map responseParams = JsonUtil.jsonToMap(param); - if (!responseParams.containsKey("enc_data")) { - System.err.println("通知失败"); - throw new IllegalArgumentException("通知失败"); - } - String decryptStr = (String) responseParams.get("enc_data"); - String messageKey = (String) responseParams.get("message_key"); - String secretKey = GmUtil.decryptSm2(messageKey, privateKey_SM4); - if (secretKey == null) { - System.err.println("解密失败"); - throw new IllegalArgumentException("解密失败"); - } - String decryParams = GmUtil.decryptSm4(decryptStr, secretKey); - - System.out.println("支付结果返回值(解密后):" + decryParams); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - String outTradeNo = paramOut.get("tran_no").toString(); - paymentOrderDto.setOrderId(outTradeNo); - paymentOrderDto.setTransactionId(paramOut.get("txn_no").toString()); - - doUpdateOnlinePay(outTradeNo, OnlinePayDto.STATE_COMPILE, "支付成功"); - - JSONObject resJson = new JSONObject(); - resJson.put("return_code", "SUCCESS"); - resJson.put("return message", "成功"); - - paymentOrderDto.setResponseEntity(new ResponseEntity(resJson.toJSONString(), HttpStatus.OK)); - return paymentOrderDto; - } - - private SmallWeChatDto getSmallWechat(JSONObject paramIn) { - - SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - smallWeChatDto.setAppId(paramIn.getString("appId")); - smallWeChatDto.setPage(1); - smallWeChatDto.setRow(1); - List smallWeChatDtos = smallWechatV1InnerServiceSMOImpl.querySmallWechats(smallWeChatDto); - - if (smallWeChatDtos == null || smallWeChatDtos.size() < 1) { - smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId")); - smallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret")); - smallWeChatDto.setMchId(MappingCache.getValue(MappingConstant.WECHAT_STORE_DOMAIN, "mchId")); - smallWeChatDto.setPayPassword(MappingCache.getValue(MappingConstant.WECHAT_STORE_DOMAIN, "key")); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - - return smallWeChatDto; - } - - return BeanConvertUtil.covertBean(smallWeChatDtos.get(0), SmallWeChatDto.class); - } - - - private void doUpdateOnlinePay(String orderId, String state, String message) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setState(state); - onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); - } - - private void doSaveOnlinePay(SmallWeChatDto smallWeChatDto, String openId, String orderId, String feeName, - double money, String state, String message, - String ppId) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setAppId(smallWeChatDto.getAppId()); - onlinePayPo.setMchId(smallWeChatDto.getMchId()); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOpenId(openId); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setPayId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); - onlinePayPo.setPayName(feeName); - onlinePayPo.setRefundFee("0"); - onlinePayPo.setState(state); - onlinePayPo.setTotalFee(money + ""); - onlinePayPo.setTransactionId(orderId); - onlinePayPo.setPaymentPoolId(ppId); - onlinePayV1InnerServiceSMOImpl.saveOnlinePay(onlinePayPo); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgPaymentFactoryAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgPaymentFactoryAdapt.java deleted file mode 100644 index 1ab1b30bc6..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgPaymentFactoryAdapt.java +++ /dev/null @@ -1,331 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.payment.IPaymentFactoryAdapt; -import com.java110.acct.payment.adapt.bbgpay.lib.*; -import com.java110.core.context.ICmdDataFlowContext; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.factory.WechatFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.app.AppDto; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.dto.owner.OwnerAppUserDto; -import com.java110.dto.payment.NotifyPaymentOrderDto; -import com.java110.dto.payment.PaymentOrderDto; -import com.java110.dto.wechat.SmallWeChatDto; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.store.ISmallWechatV1InnerServiceSMO; -import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; -import com.java110.po.wechat.OnlinePayPo; -import com.java110.utils.cache.MappingCache; -import com.java110.utils.cache.UrlCache; -import com.java110.utils.constant.MappingConstant; -import com.java110.utils.constant.WechatConstant; -import com.java110.utils.util.BeanConvertUtil; -import com.java110.utils.util.PayUtil; -import com.java110.utils.util.StringUtil; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.*; - -/** - * 北部湾银行支付厂家 - * - * 微信官方原生 支付实现类 - * 1.0 sql 配置说明: - * - * INSERT INTO `TT`.`t_dict` ( `status_cd`, `name`, `description`, `create_time`, `table_name`, `table_columns`) - * VALUES ( '9070', '北部湾银行支付', '北部湾银行支付', '2022-08-16 15:51:55', 'community_setting_key', 'setting_type'); - * - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('82', '9070', 'mchtNo_SM4', 'mchtNo_SM4', 'mchtNo_SM4', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('88', '9070', 'productNo_SM4', 'productNo_SM4', 'productNo_SM4', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('83', '9070', 'publicKey_SM4', 'publicKey_SM4', '值请填写 公钥 ', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('84', '9070', 'privateKey_SM4', 'privateKey_SM4', '值请填写 私钥 ', '2021-10-10 21:25:46', '0'); - * // 以下数据先查询是否存在 存在则修改 不存在添加 - * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) - * VALUES ('WECHAT', '被扫支付厂家', 'PAY_QR_ADAPT', 'qrCodeBbgPaymentAdapt', '', '2023-02-18 18:47:14', '0'); - * - * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) - * VALUES ('WECHAT', '线上支付厂家', 'PAYMENT_ADAPT', 'bbgPaymentFactoryAdapt', '', '2023-02-18 18:47:14', '0'); - */ -@Service("bbgPaymentFactoryAdapt") -public class BbgPaymentFactoryAdapt implements IPaymentFactoryAdapt { - - private static final Logger logger = LoggerFactory.getLogger(BbgPaymentFactoryAdapt.class); - - - //微信支付 - public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; - // 微信服务商支付开关 - public static final String WECHAT_SERVICE_PAY_SWITCH = "WECHAT_SERVICE_PAY_SWITCH"; - - //开关ON打开 - public static final String WECHAT_SERVICE_PAY_SWITCH_ON = "ON"; - - - private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; - - private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; - - public static final String TRADE_TYPE_NATIVE = "NATIVE"; - public static final String TRADE_TYPE_JSAPI = "JSAPI"; - public static final String TRADE_TYPE_MWEB = "MWEB"; - public static final String TRADE_TYPE_APP = "APP"; - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/WxGzhPay"; - - @Autowired - private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; - - - @Autowired - private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; - - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - - @Override - public Map java110Payment(PaymentOrderDto paymentOrderDto, JSONObject reqJson, ICmdDataFlowContext context) throws Exception { - - SmallWeChatDto smallWeChatDto = getSmallWechat(reqJson); - String paymentPoolId = reqJson.getString("paymentPoolId"); - - - String appId = context.getReqHeaders().get("app-id"); - String userId = context.getReqHeaders().get("user-id"); - String tradeType = reqJson.getString("tradeType"); - String notifyUrl = UrlCache.getOwnerUrl() + "/app/payment/notify/wechat/992020011134400001/" + paymentPoolId; - - String openId = reqJson.getString("openId"); - - - if (StringUtil.isEmpty(openId)) { - String appType = OwnerAppUserDto.APP_TYPE_WECHAT_MINA; - if (AppDto.WECHAT_OWNER_APP_ID.equals(appId)) { - appType = OwnerAppUserDto.APP_TYPE_WECHAT; - } else if (AppDto.WECHAT_MINA_OWNER_APP_ID.equals(appId)) { - appType = OwnerAppUserDto.APP_TYPE_WECHAT_MINA; - } else { - appType = OwnerAppUserDto.APP_TYPE_APP; - } - - OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); - ownerAppUserDto.setUserId(userId); - ownerAppUserDto.setAppType(appType); - List ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); - - if (ownerAppUserDtos == null || ownerAppUserDtos.size() < 1) { - throw new IllegalArgumentException("未找到开放账号信息"); - } - openId = ownerAppUserDtos.get(0).getOpenId(); - } - - - logger.debug("【小程序支付】 统一下单开始, 订单编号=" + paymentOrderDto.getOrderId()); - SortedMap resultMap = new TreeMap(); - //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 - double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV"), paymentOrderDto.getMoney()); - //添加或更新支付记录(参数跟进自己业务需求添加) - - Map resMap = null; - resMap = this.java110UnifieldOrder(paymentOrderDto.getName(), - paymentOrderDto.getOrderId(), - tradeType, - payAmount, - openId, - smallWeChatDto, - paymentPoolId, - notifyUrl - ); - - - return resMap; - } - - - private Map java110UnifieldOrder(String feeName, String orderNum, - String tradeType, double payAmount, String openid, - SmallWeChatDto smallWeChatDto, - String paymentPoolId, - String notifyUrl) throws Exception { - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String productNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "productNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - - - if (feeName.length() > 127) { - feeName = feeName.substring(0, 126); - } - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("product_no", productNo_SM4);// 产品编号 - params.put("biz_type", "WX_GZH");// 业务类型 - params.put("tran_no", orderNum);// 商户流水 - params.put("code", "");// 授权码 - params.put("openid", openid);// 用户标识id - params.put("appid", smallWeChatDto.getAppId());// 公众号appid - params.put("amt", payAmount);// 交易金额 - params.put("ware_name", feeName);// 商品名称 - params.put("ware_describe", "");// 商户数据包 - params.put("asyn_url", notifyUrl + "?wId=" + WechatFactory.getWId(smallWeChatDto.getAppId()));// 通知地址 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, gzhPayUrl, params); - JSONObject paramOut = JSONObject.parseObject(decryParams); - if (!"SUCCESS".equals(paramOut.getString("status")) - || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - if (!"0000".equals(paramOut.getString("return_code")) - && !"0001".equals(paramOut.getString("return_code")) - ) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - SortedMap resultMap = new TreeMap(); - resultMap.put("appId", paramOut.getString("appId")); - resultMap.put("timeStamp", paramOut.getString("timeStamp")); - resultMap.put("nonceStr", paramOut.getString("nonceStr")); - resultMap.put("package", paramOut.getString("package")); - resultMap.put("signType", paramOut.getString("signType")); - resultMap.put("sign", paramOut.getString("paySign")); - resultMap.put("code", "0"); - resultMap.put("msg", "下单成功"); - doSaveOnlinePay(smallWeChatDto, openid, orderNum, feeName, payAmount, OnlinePayDto.STATE_WAIT, "待支付",paymentPoolValueDtos.get(0).getPpId()); - - return resultMap; - } - - - @Override - public PaymentOrderDto java110NotifyPayment(NotifyPaymentOrderDto notifyPaymentOrderDto) { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(notifyPaymentOrderDto.getPaymentPoolId()); - paymentPoolValueDto.setCommunityId(notifyPaymentOrderDto.getCommunityId()); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - String privateKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "privateKey_SM4"); - - - String resXml = ""; - String param = notifyPaymentOrderDto.getParam(); - PaymentOrderDto paymentOrderDto = new PaymentOrderDto(); - // 开始解密 - Map responseParams = JsonUtil.jsonToMap(param); - if (!responseParams.containsKey("enc_data")) { - System.err.println("通知失败"); - throw new IllegalArgumentException("通知失败"); - } - String decryptStr = (String) responseParams.get("enc_data"); - String messageKey = (String) responseParams.get("message_key"); - String secretKey = GmUtil.decryptSm2(messageKey, privateKey_SM4); - if (secretKey == null) { - System.err.println("解密失败"); - throw new IllegalArgumentException("解密失败"); - } - String decryParams = GmUtil.decryptSm4(decryptStr, secretKey); - - System.out.println("支付结果返回值(解密后):" + decryParams); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - String outTradeNo = paramOut.get("tran_no").toString(); - paymentOrderDto.setOrderId(outTradeNo); - paymentOrderDto.setTransactionId(paramOut.get("txn_no").toString()); - - doUpdateOnlinePay(outTradeNo, OnlinePayDto.STATE_COMPILE, "支付成功"); - - JSONObject resJson = new JSONObject(); - resJson.put("return_code", "SUCCESS"); - resJson.put("return message", "成功"); - - paymentOrderDto.setResponseEntity(new ResponseEntity(resJson.toJSONString(), HttpStatus.OK)); - return paymentOrderDto; - } - - private SmallWeChatDto getSmallWechat(JSONObject paramIn) { - - SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - smallWeChatDto.setAppId(paramIn.getString("appId")); - smallWeChatDto.setPage(1); - smallWeChatDto.setRow(1); - List smallWeChatDtos = smallWechatV1InnerServiceSMOImpl.querySmallWechats(smallWeChatDto); - - if (smallWeChatDtos == null || smallWeChatDtos.size() < 1) { - smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId")); - smallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret")); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - - return smallWeChatDto; - } - - return BeanConvertUtil.covertBean(smallWeChatDtos.get(0), SmallWeChatDto.class); - } - - - private void doUpdateOnlinePay(String orderId, String state, String message) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setState(state); - onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); - } - - private void doSaveOnlinePay(SmallWeChatDto smallWeChatDto, String openId, String orderId, String feeName, - double money, String state, String message, - String ppId) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setAppId(smallWeChatDto.getAppId()); - onlinePayPo.setMchId(smallWeChatDto.getMchId()); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOpenId(openId); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setPayId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); - onlinePayPo.setPayName(feeName); - onlinePayPo.setRefundFee("0"); - onlinePayPo.setState(state); - onlinePayPo.setTotalFee(money + ""); - onlinePayPo.setTransactionId(orderId); - onlinePayPo.setPaymentPoolId(ppId); - onlinePayV1InnerServiceSMOImpl.saveOnlinePay(onlinePayPo); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java deleted file mode 100644 index 4195f0e6d4..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.payment.IRefundMoneyAdapt; -import com.java110.core.client.FtpUploadTemplate; -import com.java110.core.client.OssUploadTemplate; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.factory.PlutusFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.paymentPool.PaymentPoolDto; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.intf.acct.IOnlinePayRefundV1InnerServiceSMO; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.fee.IReturnPayFeeInnerServiceSMO; -import com.java110.intf.order.IOrderInnerServiceSMO; -import com.java110.intf.store.ISmallWechatV1InnerServiceSMO; -import com.java110.utils.util.PayUtil; -import com.java110.vo.ResultVo; -import org.bouncycastle.util.encoders.Base64; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service("bbgRefundMoney") -public class BbgRefundMoneyAdapt implements IRefundMoneyAdapt { - - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String refundUrl = "https://mbank.bankofbbg.com/www/corepaycer/Refund";// 退款地址 - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - @Autowired - private IReturnPayFeeInnerServiceSMO returnPayFeeInnerServiceSMOImpl; - - @Autowired - private IOrderInnerServiceSMO orderInnerServiceSMOImpl; - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Autowired - private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - - private static Logger logger = LoggerFactory.getLogger(BbgRefundMoneyAdapt.class); - - @Autowired - private FtpUploadTemplate ftpUploadTemplate; - - @Autowired - private OssUploadTemplate ossUploadTemplate; - - @Autowired - private IOnlinePayRefundV1InnerServiceSMO onlinePayRefundV1InnerServiceSMOImpl; - - @Override - public ResultVo refund(OnlinePayDto onlinePayDto, PaymentPoolDto paymentPoolDto) throws Exception { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolDto.getPpId()); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String tranNo = GenerateCodeFactory.getGeneratorId("11"); - - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("tran_no", tranNo);// 商户流水 - params.put("org_tran_no", onlinePayDto.getOrderId());// 原平台流水 - params.put("device_ip", "172.0.0.1");// 设备发起交易IP - params.put("amt", onlinePayDto.getRefundFee());// 交易金额 - params.put("ware_name", onlinePayDto.getPayName());// 摘要备注 - - // 对准备加签参数排序 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, refundUrl, params); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - if ( !"SUCCESS".equals(paramOut.getString("status")) || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - return new ResultVo(ResultVo.CODE_ERROR, "退款失败" + paramOut.getString("return_message")); - } - if ( !"0000".equals(paramOut.getString("return_code")) && !"0001".equals(paramOut.getString("return_code"))) { - return new ResultVo(ResultVo.CODE_ERROR, "退款失败" + paramOut.getString("return_message")); - } - if("0001".equals(paramOut.getString("return_code"))){ - return new ResultVo(ResultVo.CODE_OK, paramOut.getString("return_message")); - - } - return new ResultVo(ResultVo.CODE_OK, "退款完成"); - - - } - - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java deleted file mode 100644 index 1babfd803b..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.java110.acct.payment.adapt.bbgpay.lib.GmUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.HttpRequestUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.JsonUtil; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class EncryptDecryptFactory { - - - public static String execute(List paymentPoolValueDtos, String url, Map params){ - String decrypt = ""; - try { - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - // 格式为json - String json = JsonUtil.mapToJson(params); - System.out.println("加密前:" + json); - // 报文加密 - String secretKey = GmUtil.generateSm4Key(); - String encrypt = GmUtil.encryptSm4(json, secretKey); - System.out.println("加密后:" + encrypt); - - Map signParams = new HashMap<>(); - signParams.put("mcht_no", mchtNo_SM4);// 收款商户编号 - signParams.put("sign_type", "SM4"); - signParams.put("message_key", GmUtil.encryptSm2(secretKey, publicKey_SM4));// 密钥加密 - signParams.put("enc_data", encrypt);// 加密后请求参数 - - String requestParams = JsonUtil.mapToJson(signParams); - System.out.println("最终请求参数:" + requestParams); - System.err.println(""); - String returnResult = HttpRequestUtil.httpPost(url, requestParams); - System.out.println("支付结果返回值(原文):" + returnResult); - if (returnResult == null) { - System.err.println("通道响应异常"); - throw new IllegalArgumentException("通道响应异常"); - - } - // 开始解密 - Map responseParams = JsonUtil.jsonToMap(returnResult); - if (!responseParams.containsKey("enc_data")) { - System.err.println("交易失败-->" + responseParams.get("return_code") + ":" + responseParams.get("return_message")); - throw new IllegalArgumentException("交易失败-->" + responseParams.get("return_code") + ":" + responseParams.get("return_message")); - } - String decryptStr = (String) responseParams.get("enc_data"); - - decrypt = GmUtil.decryptSm4(decryptStr, secretKey); - if (decrypt == null) { - System.err.println("解密失败"); - throw new IllegalArgumentException("解密失败"); - } - System.out.println("支付结果返回值(解密后):" + decrypt); - }catch (Exception e){ - e.printStackTrace(); - throw new IllegalArgumentException(e.getMessage()); - } - return decrypt; - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java deleted file mode 100644 index 2f0e953c77..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.smo.IQrCodePaymentSMO; -import com.java110.core.client.RestTemplate; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.dto.wechat.SmallWeChatDto; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.store.ISmallWeChatInnerServiceSMO; -import com.java110.po.wechat.OnlinePayPo; -import com.java110.utils.cache.MappingCache; -import com.java110.utils.constant.MappingConstant; -import com.java110.utils.constant.WechatConstant; -import com.java110.utils.util.PayUtil; -import com.java110.vo.ResultVo; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; - -/** - * 微信支付 - */ -@Service -public class QrCodeBbgPaymentAdapt implements IQrCodePaymentSMO { - private static Logger logger = LoggerFactory.getLogger(QrCodeBbgPaymentAdapt.class); - - //微信支付 - public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; - // 微信服务商支付开关 - public static final String WECHAT_SERVICE_PAY_SWITCH = "WECHAT_SERVICE_PAY_SWITCH"; - - //开关ON打开 - public static final String WECHAT_SERVICE_PAY_SWITCH_ON = "ON"; - - - private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; - - private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/ScanCodePay"; - - private static String queryUrl = "https://mbank.bankofbbg.com/www/corepaycer/QueryTxnInfo";// 交易查询地址 - - @Autowired - private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Override - public ResultVo pay(String communityId, String orderNum, double money, String authCode, String feeName, String paymentPoolId) throws Exception { - logger.info("【小程序支付】 统一下单开始, 订单编号=" + orderNum); - SortedMap resultMap = new TreeMap(); - //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 - double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV"), money); - //添加或更新支付记录(参数跟进自己业务需求添加) - - Map resMap = null; - logger.debug("resMap=" + resMap); - String systemName = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_GOOD_NAME); - SmallWeChatDto shopSmallWeChatDto = null; - SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setObjId(communityId); - List smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); - if (smallWeChatDtos == null && smallWeChatDtos.size() < 1) { - shopSmallWeChatDto = new SmallWeChatDto(); - shopSmallWeChatDto.setObjId(communityId); - shopSmallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId")); - shopSmallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret")); - } else { - shopSmallWeChatDto = smallWeChatDtos.get(0); - } - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String productNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "productNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("product_no", productNo_SM4);// 产品编号 - params.put("tran_no", orderNum);// 商户流水 - params.put("auth_code", authCode);// 码类型 - params.put("amt", payAmount);// 交易金额 - params.put("ware_name", feeName);// 商品名称 - params.put("device_ip", "172.0.0.1");// 商户数据包 - params.put("recog_no", "123123");// 交易终端编号 - doSaveOnlinePay(shopSmallWeChatDto, "-1", orderNum, feeName, payAmount, OnlinePayDto.STATE_WAIT, "待支付",paymentPoolValueDtos.get(0).getPpId()); - - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, gzhPayUrl, params); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - if (!"0000".equals(paramOut.getString("return_code")) - || !"SUCCESS".equals(paramOut.getString("status")) - ) { - return new ResultVo(ResultVo.CODE_ERROR, "支付失败" + paramOut.getString("return_message")); - - } - - if ("FAIL".equals(paramOut.getString("deal_status"))) { - return new ResultVo(ResultVo.CODE_ERROR, "业务失败"); - } - - if ("SUCCESS".equals(paramOut.getString("deal_status"))) { - doUpdateOnlinePay(orderNum, OnlinePayDto.STATE_COMPILE, "支付成功"); - - return new ResultVo(ResultVo.CODE_OK, "成功"); - } else { - return new ResultVo(ResultVo.CODE_ERROR, "等待用户支付中"); - } - } - - public ResultVo checkPayFinish(String communityId, String orderNum, String paymentPoolId) { - Map result = null; - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - paymentPoolValueDto.setCommunityId(communityId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("tran_no", orderNum);// 商户流水 - params.put("txn_no", "");// 支付流水 - - // 对准备加签参数排序 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, queryUrl, params); - - /** - * {"amt":"0.01","deal_status":"PROCESSING","jump_url":"","mcht_name":"广西蓉慧科技有限公司","mcht_no":"MCT2023060100029734", - * "real_amt":"0.01","return_code":"5019","return_message":"用户正在输入密码,请等待","status":"SUCCESS", - * "tran_no":"962023092519710062","txn_date":"20230925", - * "txn_no":"P11082023092523543816778858","txn_time":"235438","ware_name":"云星花园-1栋1单元101室-住宅物业费"} - */ - JSONObject paramOut = JSONObject.parseObject(decryParams); - - if ("PROCESSING".equals(paramOut.getString("deal_status")) && "5019".equals(paramOut.getString("return_code"))) { - return new ResultVo(ResultVo.CODE_WAIT_PAY, "等待支付完成"); - } - - if (!"SUCCESS".equals(paramOut.getString("status")) - || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - - if (!"0000".equals(paramOut.getString("return_code")) - && !"0001".equals(paramOut.getString("return_code")) - ) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - if ("0000".equals(paramOut.getString("return_code"))) { - doUpdateOnlinePay(orderNum, OnlinePayDto.STATE_COMPILE, "支付成功"); - return new ResultVo(ResultVo.CODE_OK, "成功"); - } else { - return new ResultVo(ResultVo.CODE_WAIT_PAY, "等待支付完成"); - } - } - - private void doSaveOnlinePay(SmallWeChatDto smallWeChatDto, String openId, String orderId, String feeName, - double money, String state, String message, - String ppId) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setAppId(smallWeChatDto.getAppId()); - onlinePayPo.setMchId(smallWeChatDto.getMchId()); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOpenId(openId); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setPayId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); - onlinePayPo.setPayName(feeName); - onlinePayPo.setRefundFee("0"); - onlinePayPo.setState(state); - onlinePayPo.setTotalFee(money + ""); - onlinePayPo.setTransactionId(orderId); - onlinePayPo.setPaymentPoolId(ppId); - onlinePayV1InnerServiceSMOImpl.saveOnlinePay(onlinePayPo); - } - - private void doUpdateOnlinePay(String orderId, String state, String message) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setState(state); - onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java deleted file mode 100644 index 788f7c254e..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.security.Security; -import java.security.spec.AlgorithmParameterSpec; - -import javax.crypto.Cipher; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; - -import com.alibaba.fastjson.JSONObject; - -/** - * aes 加解密相关工具类 - * - * @author bbw - * - */ -public class AesEncrypt { - public final static String ivParameter = "0000000000000000"; - private static final String CHARSET_NAME_UTF8 = "UTF-8"; - - static { - Security.addProvider(new BouncyCastleProvider()); - Security.setProperty("crypto.policy", "unlimited"); - } - - public static String encrypt(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return Base64Util.encode(encrypted); - } - - public static byte[] encryptByte(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return encrypted; - } - - public static byte[] encryptByte(String sSrc, String encodingFormat, byte[] raw) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return encrypted; - } - - public static String decrypt(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - try { - byte[] raw = sKey.getBytes("ASCII"); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); - byte[] encrypted1 = Base64Util.decode(sSrc); - byte[] original = cipher.doFinal(encrypted1); - String originalString = new String(original, encodingFormat); - return originalString; - } catch (Exception ex) { - return null; - } - } - - public static byte[] decryptByte(byte[] bt, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - try { - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); - byte[] original = cipher.doFinal(bt); - return original; - } catch (Exception ex) { - return null; - } - } - - public static String parseByte2HexStr(byte buf[]) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < buf.length; i++) { - String hex = Integer.toHexString(buf[i] & 0xFF); - if (hex.length() == 1) { - hex = '0' + hex; - } - sb.append(hex.toUpperCase()); - } - return sb.toString(); - } - - public static byte[] parseHexStr2Byte(String hexStr) { - if (hexStr.length() < 1) - return null; - byte[] result = new byte[hexStr.length() / 2]; - for (int i = 0; i < hexStr.length() / 2; i++) { - int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); - int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); - result[i] = (byte) (high * 16 + low); - } - return result; - } - - // 法院一案一户加密 - public static String ocoaEncrypt(String content, String aesKey, String aesIV) throws Exception { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec keySpec = new SecretKeySpec(aesKey.getBytes(CHARSET_NAME_UTF8), "AES"); - AlgorithmParameterSpec paramSpec = new IvParameterSpec(aesIV.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, keySpec, paramSpec); - byte[] result = cipher.doFinal(content.getBytes(CHARSET_NAME_UTF8)); - return URLEncoder.encode(Base64Util.encode(result), "UTF-8"); - } - - // 法院一案一户解密 - public static String ocoaDecrypt(String content, String aesKey, String aesIV) throws Exception { - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec keySpec = new SecretKeySpec(aesKey.getBytes(CHARSET_NAME_UTF8), "AES"); - AlgorithmParameterSpec paramSpec = new IvParameterSpec(aesIV.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, keySpec, paramSpec); - return new String(cipher.doFinal(Base64Util.decode(URLDecoder.decode(content, "UTF-8"))), CHARSET_NAME_UTF8); - } catch (Exception e) { - e.printStackTrace(); - } - return ""; - } - - /** - * 异或运算 - * - */ - public static String strEncAndDec(String src) { - // 字符串转成字符数组 - char[] c = src.toCharArray(); - // 循环给字符数组加密 - for (int i = 0; i < c.length; i++) { - c[i] = (char) (c[i] ^ 1); - } - return new String(c); - } - - public static void main(String[] args) throws Exception { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("ZH", "0003999"); - jsonObject.put("AH", ""); - String content = JSONObject.toJSONString(jsonObject); - String s1 = ocoaEncrypt(content, "2021YHSYSHYAKXTK", "2021YHSYSHYAKXTV"); - System.out.println("密文:" + s1); - String result = ocoaDecrypt(s1, "2021YHSYSHYAKXTK", "2021YHSYSHYAKXTV"); - System.out.println("解密:" + result); - System.out.println(14584308/16415104f); - - String authCode = "990000003458LBU3133170411108125"; - System.out.println("付款码:" + authCode); - String mchtNo = authCode.substring(12); - System.out.println("第13位开始截取:" + mchtNo); - System.out.println("企业商户号:" + strEncAndDec(mchtNo)); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java deleted file mode 100644 index c8253b6370..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import org.apache.commons.codec.binary.Base64; - -/** - * - * BASE64编码解码工具包 - */ -public class Base64Util { - - /** - * - * BASE64字符串解码为二进制数据 - * - * - * @param base64 - * @return - * @throws Exception - */ - public static byte[] decode(String base64) throws Exception { - return Base64.decodeBase64(base64.getBytes()); - } - - /** - * - * 二进制数据编码为BASE64字符串 - * - * - * @param bytes - * @return - * @throws Exception - */ - public static String encode(byte[] bytes) throws Exception { - return new String(Base64.encodeBase64(bytes)); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java deleted file mode 100644 index 6b7dda6233..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.security.KeyFactory; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.Signature; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.Enumeration; - -import org.apache.commons.codec.binary.Base64; - -/** - * 验证证书公共类 - * - */ -public class CAUtil { - private static final String DEFAULT_CHARSET = "UTF-8"; - private static final String KEY_ALGORITHM = "RSA"; - private static final String SIGNATURE_ALGORITHM = "SHA256withRSA"; - - /** - * 判断字符串是否为null或空 true为空 - */ - public static boolean isNullOrEmpty(String str) { - return (str == null || str.length() == 0); - } - - // 获取私钥 - public static PrivateKey getPrivateKey(InputStream is, String privateKeyPwd) throws Exception { - KeyStore ks; - try { - ks = KeyStore.getInstance("PKCS12"); - char[] nPassword = null; - if (isNullOrEmpty(privateKeyPwd)) { - privateKeyPwd = null; - } else { - nPassword = privateKeyPwd.toCharArray(); - } - ks.load(is, nPassword); - is.close(); - Enumeration> enumas = ks.aliases(); - String keyAlias = null; - if (enumas.hasMoreElements()) { - keyAlias = (String) enumas.nextElement(); - } - PrivateKey prikey = (PrivateKey) ks.getKey(keyAlias, nPassword); - return prikey; - } catch (KeyStoreException e) { - throw new Exception("获取KeyStore失败"); - } catch (FileNotFoundException e) { - throw new Exception("无效的私钥地址"); - } catch (NoSuchAlgorithmException e) { - throw new Exception("读取私钥失败"); - } catch (CertificateException e) { - throw new Exception("加载证书失败"); - } catch (IOException e) { - throw new Exception("读取证书失败"); - } catch (UnrecoverableKeyException e) { - throw new Exception("获取私钥失败"); - } - } - - // 获取公钥 - public static PublicKey getPublicKey(String publicKeyAddr) throws Exception { - try { - CertificateFactory certificatefactory = CertificateFactory.getInstance("X.509"); - FileInputStream bais = new FileInputStream(publicKeyAddr); - X509Certificate Cert = (X509Certificate) certificatefactory.generateCertificate(bais); - bais.close(); - PublicKey pk = Cert.getPublicKey(); - return pk; - } catch (CertificateException e) { - throw new Exception("获取公钥失败"); - } - } - - /** - * RSA签名 - * - * @param localPrivKey - * 私钥 - * @param plaintext - * 需要签名的信息 - * @return byte[] - * @throws Exception - */ - public static byte[] signRSA(byte[] plainBytes, boolean useBase64Code, PrivateKey privKey) throws Exception { - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initSign(privKey); - signature.update(plainBytes); - // 如果是Base64编码的话,需要对签名后的数组以Base64编码 - if (useBase64Code) { - return Base64.encodeBase64(signature.sign()); - } else { - return signature.sign(); - } - } - - /** - * 验签操作 - * - * @param peerPubKey - * 公钥 - * @param plainBytes - * 需要验签的信息 - * @param signBytes - * 签名信息 - * @return boolean - */ - public static boolean verifyRSA(byte[] plainBytes, byte[] signBytes, boolean useBase64Code, PublicKey pubKey) throws Exception { - boolean isValid = false; - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initVerify(pubKey); - signature.update(plainBytes); - // 如果是Base64编码的话,需要对验签的数组以Base64解码 - if (useBase64Code) { - isValid = signature.verify(Base64.decodeBase64(signBytes)); - } else { - isValid = signature.verify(signBytes); - } - return isValid; - } - - /** - * SHA256withRSA签名(RSA2) - * - */ - public static String rsa256Sign(String content, String charset, String privateKey) throws Exception { - if (isNullOrEmpty(charset)) { - charset = DEFAULT_CHARSET; - } - if (isNullOrEmpty(privateKey)) { - return null; - } - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - byte[] encodedKey = StreamUtil.readText(new ByteArrayInputStream(privateKey.getBytes())).getBytes(); - encodedKey = Base64.decodeBase64(encodedKey); - PrivateKey priKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(encodedKey)); - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initSign(priKey); - if (isNullOrEmpty(charset)) { - signature.update(content.getBytes()); - } else { - signature.update(content.getBytes(charset)); - } - byte[] signed = signature.sign(); - return new String(Base64.encodeBase64(signed)); - } - - /** - * SHA256withRSA验签(RSA2) - * - */ - public static boolean rsa256Verify(byte[] content, String sign, String publicKey) throws Exception { - if (isNullOrEmpty(publicKey)) { - return false; - } - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - StringWriter writer = new StringWriter(); - StreamUtil.io(new InputStreamReader(new ByteArrayInputStream(publicKey.getBytes())), writer); - byte[] encodedKey = writer.toString().getBytes(); - encodedKey = Base64.decodeBase64(encodedKey); - PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initVerify(pubKey); - signature.update(content); - return signature.verify(Base64.decodeBase64(sign.getBytes())); - } -} \ No newline at end of file diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java deleted file mode 100644 index c85b4f2c68..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java +++ /dev/null @@ -1,311 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import javax.crypto.Cipher; -import javax.crypto.KeyGenerator; -import javax.crypto.spec.SecretKeySpec; - -import java.math.BigInteger; -import java.security.Key; -import java.security.KeyFactory; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.SecureRandom; -import java.security.Security; -import java.security.Signature; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; - -import org.bouncycastle.asn1.gm.GMNamedCurves; -import org.bouncycastle.asn1.gm.GMObjectIdentifiers; -import org.bouncycastle.asn1.x9.X9ECParameters; -import org.bouncycastle.crypto.engines.SM2Engine; -import org.bouncycastle.crypto.params.ECDomainParameters; -import org.bouncycastle.crypto.params.ECPrivateKeyParameters; -import org.bouncycastle.crypto.params.ECPublicKeyParameters; -import org.bouncycastle.crypto.params.ParametersWithRandom; -import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey; -import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.jce.spec.ECParameterSpec; -import org.bouncycastle.jce.spec.ECPrivateKeySpec; -import org.bouncycastle.jce.spec.ECPublicKeySpec; -import org.bouncycastle.util.encoders.Hex; - -/** - * 国密加密算法 - */ -public class GmUtil { - private static final String DEFAULT_CHARSET = "UTF-8"; - public static final String ALGORITHM_NAME = "SM4"; - // 加密算法/分组加密模式/分组填充方式 - // PKCS5Padding-以8个字节为一组进行分组加密 - // 定义分组加密模式使用:PKCS5Padding - public static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS7Padding"; - // 128-32位16进制;256-64位16进制 - public static final int DEFAULT_KEY_SIZE = 128; - // 椭圆曲线ECParameters ASN.1 结构 - private static X9ECParameters x9ECParameters = GMNamedCurves.getByName("sm2p256v1"); - // 椭圆曲线公钥或私钥的基本域参数。 - private static ECParameterSpec ecDomainParameters = new ECParameterSpec(x9ECParameters.getCurve(), x9ECParameters.getG(), x9ECParameters.getN()); - - static { - Security.addProvider(new BouncyCastleProvider()); - } - - /** - * 将Base64转码的公钥串,转化为公钥对象 - * - */ - public static PublicKey createPublicKey(String publicKey) { - PublicKey publickey = null; - try { - X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(Base64Util.decode(publicKey)); - KeyFactory keyFactory = KeyFactory.getInstance("EC", new BouncyCastleProvider()); - publickey = keyFactory.generatePublic(publicKeySpec); - } catch (Exception e) { - e.printStackTrace(); - } - return publickey; - } - - /** - * 将Base64转码的私钥串,转化为私钥对象 - * - */ - public static PrivateKey createPrivateKey(String privateKey) { - PrivateKey publickey = null; - try { - PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64Util.decode(privateKey)); - KeyFactory keyFactory = KeyFactory.getInstance("EC", new BouncyCastleProvider()); - publickey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); - } catch (Exception e) { - e.printStackTrace(); - } - return publickey; - } - - /** - * 根据publicKey对原始数据data,使用SM2加密 - */ - public static byte[] encrypt(byte[] data, PublicKey publicKey) { - ECPublicKeyParameters localECPublicKeyParameters = null; - - if (publicKey instanceof BCECPublicKey) { - BCECPublicKey localECPublicKey = (BCECPublicKey) publicKey; - ECParameterSpec localECParameterSpec = localECPublicKey.getParameters(); - ECDomainParameters localECDomainParameters = new ECDomainParameters(localECParameterSpec.getCurve(), localECParameterSpec.getG(), localECParameterSpec.getN()); - localECPublicKeyParameters = new ECPublicKeyParameters(localECPublicKey.getQ(), localECDomainParameters); - } - SM2Engine localSM2Engine = new SM2Engine(); - localSM2Engine.init(true, new ParametersWithRandom(localECPublicKeyParameters, new SecureRandom())); - byte[] arrayOfByte2; - try { - arrayOfByte2 = localSM2Engine.processBlock(data, 0, data.length); - return arrayOfByte2; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 根据privateKey对加密数据encodedata,使用SM2解密 - */ - public static byte[] decrypt(byte[] encodedata, PrivateKey privateKey) { - SM2Engine localSM2Engine = new SM2Engine(); - BCECPrivateKey sm2PriK = (BCECPrivateKey) privateKey; - ECParameterSpec localECParameterSpec = sm2PriK.getParameters(); - ECDomainParameters localECDomainParameters = new ECDomainParameters(localECParameterSpec.getCurve(), localECParameterSpec.getG(), localECParameterSpec.getN()); - ECPrivateKeyParameters localECPrivateKeyParameters = new ECPrivateKeyParameters(sm2PriK.getD(), localECDomainParameters); - localSM2Engine.init(false, localECPrivateKeyParameters); - try { - byte[] arrayOfByte3 = localSM2Engine.processBlock(encodedata, 0, encodedata.length); - return arrayOfByte3; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 私钥签名 - */ - public static byte[] signByPrivateKey(byte[] data, PrivateKey privateKey) throws Exception { - Signature sig = Signature.getInstance(GMObjectIdentifiers.sm2sign_with_sm3.toString(), BouncyCastleProvider.PROVIDER_NAME); - sig.initSign(privateKey); - sig.update(data); - return sig.sign(); - } - - /** - * 公钥验签 - */ - public static boolean verifyByPublicKey(byte[] data, PublicKey publicKey, byte[] signature) throws Exception { - Signature sig = Signature.getInstance(GMObjectIdentifiers.sm2sign_with_sm3.toString(), BouncyCastleProvider.PROVIDER_NAME); - sig.initVerify(publicKey); - sig.update(data); - return sig.verify(signature); - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * @Description 公钥字符串转换为 BCECPublicKey 公钥对象 - * @param pubKeyHex - * 64字节十六进制公钥字符串(如果公钥字符串为65字节首个字节为0x04:表示该公钥为非压缩格式,操作时需要删除) - * @return BCECPublicKey SM2公钥对象 - */ - private static BCECPublicKey getECPublicKeyByPublicKeyHex(String pubKeyHex) { - // 截取64字节有效的SM2公钥(如果公钥首个字节为0x04) - if (pubKeyHex.length() > 128) { - pubKeyHex = pubKeyHex.substring(pubKeyHex.length() - 128); - } - // 将公钥拆分为x,y分量(各32字节) - String stringX = pubKeyHex.substring(0, 64); - String stringY = pubKeyHex.substring(stringX.length()); - // 将公钥x、y分量转换为BigInteger类型 - BigInteger x = new BigInteger(stringX, 16); - BigInteger y = new BigInteger(stringY, 16); - // 通过公钥x、y分量创建椭圆曲线公钥规范 - ECPublicKeySpec ecPublicKeySpec = new ECPublicKeySpec(x9ECParameters.getCurve().createPoint(x, y), ecDomainParameters); - // 通过椭圆曲线公钥规范,创建出椭圆曲线公钥对象(可用于SM2加密及验签) - return new BCECPublicKey("EC", ecPublicKeySpec, BouncyCastleProvider.CONFIGURATION); - } - - /** - * @Description 私钥字符串转换为 BCECPrivateKey 私钥对象 - * @param privateKeyHex - * 32字节十六进制私钥字符串 - * @return BCECPrivateKey SM2私钥对象 - */ - private static BCECPrivateKey getBCECPrivateKeyByPrivateKeyHex(String privateKeyHex) { - // 将十六进制私钥字符串转换为BigInteger对象 - BigInteger d = new BigInteger(privateKeyHex, 16); - // 通过私钥和私钥域参数集创建椭圆曲线私钥规范 - ECPrivateKeySpec ecPrivateKeySpec = new ECPrivateKeySpec(d, ecDomainParameters); - // 通过椭圆曲线私钥规范,创建出椭圆曲线私钥对象(可用于SM2解密和签名) - return new BCECPrivateKey("EC", ecPrivateKeySpec, BouncyCastleProvider.CONFIGURATION); - } - - /** - * @Description 公钥加密 - */ - public static String encryptSm2(String data, String publicKeyHex) { - BCECPublicKey publicKey = getECPublicKeyByPublicKeyHex(publicKeyHex); - // 加密模式 - SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2; - // 通过公钥对象获取公钥的基本域参数。 - ECParameterSpec ecParameterSpec = publicKey.getParameters(); - ECDomainParameters ecDomainParameters = new ECDomainParameters(ecParameterSpec.getCurve(), ecParameterSpec.getG(), ecParameterSpec.getN()); - // 通过公钥值和公钥基本参数创建公钥参数对象 - ECPublicKeyParameters ecPublicKeyParameters = new ECPublicKeyParameters(publicKey.getQ(), ecDomainParameters); - // 根据加密模式实例化SM2公钥加密引擎 - SM2Engine sm2Engine = new SM2Engine(mode); - // 初始化加密引擎 - sm2Engine.init(true, new ParametersWithRandom(ecPublicKeyParameters, new SecureRandom())); - byte[] arrayOfBytes = null; - try { - // 将明文字符串转换为指定编码的字节串 - byte[] in = Hex.decode(data); - // 通过加密引擎对字节数串行加密 - arrayOfBytes = sm2Engine.processBlock(in, 0, in.length); - } catch (Exception e) { - e.printStackTrace(); - } - // 将加密后的字节串转换为十六进制字符串 - return Hex.toHexString(arrayOfBytes).toUpperCase(); - } - - /** - * @Description 私钥解密 - */ - public static String decryptSm2(String cipherData, String privateKeyHex) { - BCECPrivateKey privateKey = getBCECPrivateKeyByPrivateKeyHex(privateKeyHex); - // 解密模式 - SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2; - // 将十六进制字符串密文转换为字节数组(需要与加密一致,加密是:加密后的字节数组转换为了十六进制字符串) - byte[] cipherDataByte = Hex.decode(cipherData); - // 通过私钥对象获取私钥的基本域参数。 - ECParameterSpec ecParameterSpec = privateKey.getParameters(); - ECDomainParameters ecDomainParameters = new ECDomainParameters(ecParameterSpec.getCurve(), ecParameterSpec.getG(), ecParameterSpec.getN()); - // 通过私钥值和私钥钥基本参数创建私钥参数对象 - ECPrivateKeyParameters ecPrivateKeyParameters = new ECPrivateKeyParameters(privateKey.getD(), ecDomainParameters); - // 通过解密模式创建解密引擎并初始化 - SM2Engine sm2Engine = new SM2Engine(mode); - sm2Engine.init(false, ecPrivateKeyParameters); - String result = null; - try { - // 通过解密引擎对密文字节串进行解密 - byte[] arrayOfBytes = sm2Engine.processBlock(cipherDataByte, 0, cipherDataByte.length); - result = new String(arrayOfBytes, "utf-8"); - } catch (Exception e) { - e.printStackTrace(); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * 自动生成sm4密钥 - * - */ - public static String generateSm4Key() throws Exception { - KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM_NAME, BouncyCastleProvider.PROVIDER_NAME); - kg.init(DEFAULT_KEY_SIZE, new SecureRandom()); - byte[] sm4Key = kg.generateKey().getEncoded(); - return new String(Hex.encode(sm4Key)).toUpperCase(); - } - - /** - * 生成ECB暗号 - * - */ - private static Cipher generateSm4Cipher(String algorithmName, int mode, byte[] key) throws Exception { - Cipher cipher = Cipher.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME); - Key sm4Key = new SecretKeySpec(key, ALGORITHM_NAME); - cipher.init(mode, sm4Key); - return cipher; - } - - /** - * sm4加密 - * - */ - public static String encryptSm4(String data, String hexKey) { - try { - // 16进制字符串-->byte[] - byte[] keyData = Hex.decode(hexKey); - // String-->byte[] - byte[] srcData = data.getBytes(DEFAULT_CHARSET); - // 加密后的数组 - Cipher cipher = generateSm4Cipher(ALGORITHM_NAME_ECB_PADDING, Cipher.ENCRYPT_MODE, keyData); - byte[] cipherArray = cipher.doFinal(srcData); - // byte[]-->hexString - return Hex.toHexString(cipherArray).toUpperCase(); - } catch (Exception e) { - return null; - } - } - - /** - * sm4解密 - * - */ - public static String decryptSm4(String cipherText, String hexKey) { - // 用于接收解密后的字符串 - String decryptStr = null; - // hexString-->byte[] - byte[] keyData = Hex.decode(hexKey); - // hexString-->byte[] - byte[] cipherData = Hex.decode(cipherText); - try { - // 解密 - Cipher cipher = generateSm4Cipher(ALGORITHM_NAME_ECB_PADDING, Cipher.DECRYPT_MODE, keyData); - byte[] srcData = cipher.doFinal(cipherData); - decryptStr = new String(srcData, DEFAULT_CHARSET); - } catch (Exception e) { - e.printStackTrace(); - } - return decryptStr; - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java deleted file mode 100644 index ce4ce009a5..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLDecoder; - -import org.apache.http.HttpHost; -import org.apache.http.HttpResponse; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; - -/** - * http请求工具类 - * - * @author lizhongfu - * - */ -public class HttpRequestUtil { - private final static int connectTimeOut = 30000;// 连接超时时间 - private final static int readTimeOut = 30000;// 读超时时间 - - /** - * httpPost - * - * @param url 路径 - * @param jsonParam 参数 - * @return - */ - public static String httpPost(String url, String jsonParam) throws Exception { - return httpPost(url, jsonParam, false); - } - - /** - * post请求 - * - * @return - */ - public static String httpPost(String url, String jsonParam, boolean bUseProxy) throws Exception { - // post请求返回结果 - CloseableHttpClient client = HttpClients.createDefault(); - HttpPost method = new HttpPost(url); - String str = ""; - try { - RequestConfig config1 = null; - // 是否采用代理 - if (bUseProxy) { - // HttpHost proxy = new HttpHost("代理服务器IP", 代理服务器端口); - HttpHost proxy = new HttpHost("127.0.0.1", 8828); - config1 = RequestConfig.custom().setProxy(proxy).setConnectTimeout(connectTimeOut).setSocketTimeout(readTimeOut).build(); - } else { - config1 = RequestConfig.custom().setConnectTimeout(connectTimeOut).setSocketTimeout(readTimeOut).build(); - } - method.setConfig(config1); - if (null != jsonParam) { - // 解决中文乱码问题 - StringEntity entity = new StringEntity(jsonParam, "utf-8"); - entity.setContentEncoding("UTF-8"); - entity.setContentType("application/json"); - // entity.setContentType("application/x-www-form-urlencoded"); - method.setEntity(entity); - } - HttpResponse result = client.execute(method); - url = URLDecoder.decode(url, "UTF-8"); - /** 请求发送成功,并得到响应 **/ - if (result.getStatusLine().getStatusCode() == 200) { - /** 读取服务器返回过来的json字符串数据 **/ - // str = EntityUtils.toString(result.getEntity()); - str = EntityUtils.toString(result.getEntity(), "UTF-8"); - } - } catch (IOException e) { - System.err.println("网络异常:" + e.getMessage()); - // 网络异常 - throw e; - } catch (Exception e) { - System.err.println("系统错误:" + e.getMessage()); - throw e; - } - return str; - } - - /** - * 获取到下载的outputstream - * - * @param url - * @return - * @throws Exception - */ - public static ByteArrayOutputStream httpGetToStream(String url) throws Exception { - InputStream input = null; - CloseableHttpClient client = null; - try { - client = HttpClients.createDefault(); - // 发送get请求 - HttpGet request = new HttpGet(url); - HttpResponse response = client.execute(request); - input = response.getEntity().getContent(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buff = new byte[1024]; - int len; - while ((len = input.read(buff)) > -1) { - baos.write(buff, 0, len); - } - baos.flush(); - return baos; - } catch (Exception e) { - System.err.println("系统错误:" + e.getMessage()); - return null; - } finally { - input.close(); - client.close(); - } - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java deleted file mode 100644 index 45489939c2..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.TypeReference; -import com.alibaba.fastjson.parser.Feature; -import com.alibaba.fastjson.serializer.SerializerFeature; - -public class JsonUtil { - /** - * 将json转化成map - * - * @param json - * @return - */ - public static Map jsonToMap(String json) { - try { - return JSON.parseObject(json, new TypeReference>() { - }, Feature.OrderedField); - } catch (Exception e) { - return new HashMap<>(); - } - - } - - /** - * 将map转化成json - * - * @param map - * @return - */ - public static String mapToJson(Map map) { - return JSON.toJSONString(map, SerializerFeature.WriteMapNullValue); - } - - public static String mapToJson2(Map map) throws Exception { - return JSON.toJSONString(map, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty); - } - - /** - * Json转Object - * - * @return - */ - public static T jsonToObject(Class clazz, String json) { - return JSON.parseObject(json, clazz); - } - - /** - * 对map 进行排序 - * - * @param map - * @return - */ - public static Map sortMapByKey(Map map) { - if (map == null || map.isEmpty()) { - return null; - } - Map sortMap = new TreeMap(new Comparator() { - - @Override - public int compare(String str0, String str1) { - return str0.compareTo(str1); - } - }); - sortMap.putAll(map); - return sortMap; - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java deleted file mode 100644 index 80405cdd80..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; - -public class StreamUtil { - - public StreamUtil() { - - } - - public static void io(InputStream in, OutputStream out) throws IOException { - io((InputStream) in, (OutputStream) out, -1); - } - - public static void io(InputStream in, OutputStream out, int bufferSize) throws IOException { - if (bufferSize == -1) { - bufferSize = 8192; - } - - byte[] buffer = new byte[bufferSize]; - - int amount; - while ((amount = in.read(buffer)) >= 0) { - out.write(buffer, 0, amount); - } - - } - - public static void io(Reader in, Writer out) throws IOException { - io((Reader) in, (Writer) out, -1); - } - - public static void io(Reader in, Writer out, int bufferSize) throws IOException { - if (bufferSize == -1) { - bufferSize = 4096; - } - - char[] buffer = new char[bufferSize]; - - int amount; - while ((amount = in.read(buffer)) >= 0) { - out.write(buffer, 0, amount); - } - - } - - public static OutputStream synchronizedOutputStream(OutputStream out) { - return new SynchronizedOutputStream(out); - } - - public static OutputStream synchronizedOutputStream(OutputStream out, Object lock) { - return new SynchronizedOutputStream(out, lock); - } - - public static String readText(InputStream in) throws IOException { - return readText(in, (String) null, -1); - } - - public static String readText(InputStream in, String encoding) throws IOException { - return readText(in, encoding, -1); - } - - public static String readText(InputStream in, String encoding, int bufferSize) throws IOException { - Reader reader = encoding == null ? new InputStreamReader(in) : new InputStreamReader(in, encoding); - return readText(reader, bufferSize); - } - - public static String readText(Reader reader) throws IOException { - return readText(reader, -1); - } - - public static String readText(Reader reader, int bufferSize) throws IOException { - StringWriter writer = new StringWriter(); - io((Reader) reader, (Writer) writer, bufferSize); - return writer.toString(); - } - - private static class SynchronizedOutputStream extends OutputStream { - private OutputStream out; - private Object lock; - - SynchronizedOutputStream(OutputStream out) { - this(out, out); - } - - SynchronizedOutputStream(OutputStream out, Object lock) { - this.out = out; - this.lock = lock; - } - - public void write(int datum) throws IOException { - synchronized (this.lock) { - this.out.write(datum); - } - } - - public void write(byte[] data) throws IOException { - synchronized (this.lock) { - this.out.write(data); - } - } - - public void write(byte[] data, int offset, int length) throws IOException { - synchronized (this.lock) { - this.out.write(data, offset, length); - } - } - - public void flush() throws IOException { - synchronized (this.lock) { - this.out.flush(); - } - } - - public void close() throws IOException { - synchronized (this.lock) { - this.out.close(); - } - } - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java deleted file mode 100644 index a2c231d3a4..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 该目录下存放北部湾银行 支付相关内容 - */ -package com.java110.acct.payment.adapt.bbgpay; \ No newline at end of file diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java index 071d043cf7..c981cc0a85 100644 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java +++ b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java @@ -2,9 +2,6 @@ import com.alibaba.fastjson.JSONObject; import com.java110.acct.payment.IPaymentFactoryAdapt; -import com.java110.acct.payment.adapt.bbgpay.EncryptDecryptFactory; -import com.java110.acct.payment.adapt.bbgpay.lib.GmUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.JsonUtil; import com.java110.acct.payment.adapt.easypay.utils.HttpConnectUtils; import com.java110.core.context.ICmdDataFlowContext; import com.java110.core.factory.GenerateCodeFactory; diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java index 7b9d31e50b..a0a5426ad6 100644 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java +++ b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java @@ -2,7 +2,6 @@ import com.alibaba.fastjson.JSONObject; import com.java110.acct.payment.IRefundMoneyAdapt; -import com.java110.acct.payment.adapt.bbgpay.EncryptDecryptFactory; import com.java110.acct.payment.adapt.easypay.utils.HttpConnectUtils; import com.java110.core.client.FtpUploadTemplate; import com.java110.core.client.OssUploadTemplate; From 0cf28cc0d41d154a6a9de3ff1a35664c2e0686a7 Mon Sep 17 00:00:00 2001 From: xuegao8848 Date: Mon, 2 Dec 2024 11:45:26 +0800 Subject: [PATCH 36/37] =?UTF-8?q?[fix]readcn=E4=B8=AD=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme_cn.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme_cn.md b/Readme_cn.md index 6e43eb0ac7..29bf48a717 100644 --- a/Readme_cn.md +++ b/Readme_cn.md @@ -2,8 +2,8 @@ ## 说明 HC小区管理系统是一套saas物业管理的系统,包括 房产、业主、 费用 (可以线上缴费)、报修(可以线上报修)、投诉建议、采购、巡检、停车、门径、道闸、监控、工作流、问卷和公告等功能。 -目前很多地方商用超过一年半时间 欢饮直接使用或者推广使用 - + 当前,众多地区已进入商用阶段达一年半之久,其应用成效已获充分验证,欢迎各界直接采用或广泛推广,携手共创更大价值与更优效益。 + 相关代码: 1、[物业系统前端](https://gitee.com/java110/MicroCommunityWeb) : 物业员工使用电脑端 2、[物业系统后端](https://gitee.com/wuxw7/MicroCommunity): 核心业务处理端 From 96f9d12c7e74054cfed1027c1ed38109e1ab2fc7 Mon Sep 17 00:00:00 2001 From: jxfzzzt <1160490625@qq.com> Date: Fri, 13 Dec 2024 21:02:15 +0800 Subject: [PATCH 37/37] update `com.alibaba:fastjson` from 1.2.83 to 2.0.53 and fix break change. --- pom.xml | 2 +- .../com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java | 4 ++-- .../java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java | 2 +- .../com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 52fc6432b7..fe4795911e 100755 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,7 @@ com.alibaba fastjson - 1.2.83 + 2.0.53 org.mybatis.spring.boot diff --git a/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java index c6693e88ed..36931f3da8 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java @@ -204,7 +204,7 @@ private BigDecimal computeFeeDetail(JSONObject reqJson, List } FeeDetailDto feeDetailDto = new FeeDetailDto(); - feeDetailDto.setDetailIds(detailIds.toArray(new String[detailIds.size()])); + feeDetailDto.setDetailIds((String[]) detailIds.toArray(new String[detailIds.size()])); feeDetailDto.setCommunityId(reqJson.getString("communityId")); List feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto); @@ -263,7 +263,7 @@ private BigDecimal computeAcctDetail(JSONObject reqJson, List accountReceiptDtos = accountReceiptV1InnerServiceSMOImpl.queryAccountReceipts(accountReceiptDto); if (accountReceiptDtos == null || accountReceiptDtos.isEmpty()) { diff --git a/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java index f6efd4eebc..43b129e6ef 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java @@ -149,7 +149,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONOb } JSONArray configIds = reqJson.getJSONArray("configIds"); FeeConfigDto feeConfigDto = new FeeConfigDto(); - feeConfigDto.setConfigIds(configIds.toArray(new String[configIds.size()])); + feeConfigDto.setConfigIds((String[]) configIds.toArray(new String[configIds.size()])); feeConfigDto.setCommunityId(reqJson.getString("communityId")); List feeConfigDtos = payFeeConfigV1InnerServiceSMOImpl.queryPayFeeConfigs(feeConfigDto); diff --git a/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java index bd1527f63a..8cb9414da8 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java @@ -139,7 +139,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONOb } JSONArray configIds = reqJson.getJSONArray("configIds"); FeeConfigDto feeConfigDto = new FeeConfigDto(); - feeConfigDto.setConfigIds(configIds.toArray(new String[configIds.size()])); + feeConfigDto.setConfigIds((String[]) configIds.toArray(new String[configIds.size()])); feeConfigDto.setCommunityId(reqJson.getString("communityId")); List feeConfigDtos = payFeeConfigV1InnerServiceSMOImpl.queryPayFeeConfigs(feeConfigDto);
查询小区楼信息
- * // 以下数据先查询是否存在 存在则修改 不存在添加 - * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) - * VALUES ('WECHAT', 'native支付厂家', 'NATIVE_QRCODE_PAYMENT_ADAPT', 'bbgNativeQrcodePaymentFactoryAdapt', '', '2023-02-18 18:47:14', '0'); - - */ -@Service("bbgNativeQrcodePaymentFactoryAdapt") -public class BbgNativeQrcodePaymentFactoryAdapt implements IPaymentFactoryAdapt { - - private static final Logger logger = LoggerFactory.getLogger(BbgNativeQrcodePaymentFactoryAdapt.class); - - - //微信支付 - public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; - // 微信服务商支付开关 - public static final String WECHAT_SERVICE_PAY_SWITCH = "WECHAT_SERVICE_PAY_SWITCH"; - - //开关ON打开 - public static final String WECHAT_SERVICE_PAY_SWITCH_ON = "ON"; - - - private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; - - private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; - - public static final String TRADE_TYPE_NATIVE = "NATIVE"; - public static final String TRADE_TYPE_JSAPI = "JSAPI"; - public static final String TRADE_TYPE_MWEB = "MWEB"; - public static final String TRADE_TYPE_APP = "APP"; - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/getQrcodeLink"; - - @Autowired - private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; - - - @Autowired - private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; - - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - @Override - public Map java110Payment(PaymentOrderDto paymentOrderDto, JSONObject reqJson, ICmdDataFlowContext context) throws Exception { - - SmallWeChatDto smallWeChatDto = getSmallWechat(reqJson); - String paymentPoolId = reqJson.getString("paymentPoolId"); - - String appId = context.getReqHeaders().get("app-id"); - String userId = context.getReqHeaders().get("user-id"); - String tradeType = reqJson.getString("tradeType"); - String notifyUrl = UrlCache.getOwnerUrl() + "/app/payment/notify/nativeWechat/992020011134400001/" + paymentPoolId; - - - logger.debug("【小程序支付】 统一下单开始, 订单编号=" + paymentOrderDto.getOrderId()); - SortedMap resultMap = new TreeMap(); - //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 - double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV"), paymentOrderDto.getMoney()); - //添加或更新支付记录(参数跟进自己业务需求添加) - - Map resMap = null; - resMap = this.java110UnifieldOrder(paymentOrderDto.getName(), - paymentOrderDto.getOrderId(), - payAmount, - smallWeChatDto, - paymentPoolId, - notifyUrl - ); - - - return resMap; - } - - - private Map java110UnifieldOrder(String feeName, String orderNum, - double payAmount, - SmallWeChatDto smallWeChatDto, - String paymentPoolId, - String notifyUrl) throws Exception { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String productNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "productNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - - if (feeName.length() > 127) { - feeName = feeName.substring(0, 126); - } - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("product_no", productNo_SM4);// 产品编号 - params.put("qr_type", "DYNAMIC");// 业务类型 - params.put("txn_type", "0");// 交易类型 0-实时;1-担保 - params.put("tran_no", orderNum);// 商户流水 - params.put("amt", payAmount);// 交易金额 - params.put("ware_name", feeName);// 商品名称 - params.put("ware_describe", "");// 商户数据包 - params.put("trx_trm_no", "");// 交易终端编号 - params.put("trans_source", "09");// 08:商户线下扫码09:商户线上收银10:一案一户缴款11:维修资金缴款12:房屋预售缴款 - params.put("asyn_url", notifyUrl + "?wId=" + WechatFactory.getWId(smallWeChatDto.getAppId()));// 通知地址 - - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, gzhPayUrl, params); - JSONObject paramOut = JSONObject.parseObject(decryParams); - if (!"SUCCESS".equals(paramOut.getString("status")) - || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - if (!"0000".equals(paramOut.getString("return_code")) - && !"0001".equals(paramOut.getString("return_code")) - ) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - SortedMap resultMap = new TreeMap(); - resultMap.put("prepayId", paramOut.getString("tran_no")); - resultMap.put("codeUrl", paramOut.getString("qr_link")); - resultMap.put("code", "0"); - resultMap.put("msg", "下单成功"); - doSaveOnlinePay(smallWeChatDto, "无", orderNum, feeName, payAmount, OnlinePayDto.STATE_WAIT, "待支付",paymentPoolValueDtos.get(0).getPpId()); - - return resultMap; - } - - - @Override - public PaymentOrderDto java110NotifyPayment(NotifyPaymentOrderDto notifyPaymentOrderDto) { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(notifyPaymentOrderDto.getPaymentPoolId()); - paymentPoolValueDto.setCommunityId(notifyPaymentOrderDto.getCommunityId()); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - String privateKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "privateKey_SM4"); - - String resXml = ""; - String param = notifyPaymentOrderDto.getParam(); - PaymentOrderDto paymentOrderDto = new PaymentOrderDto(); - // 开始解密 - Map responseParams = JsonUtil.jsonToMap(param); - if (!responseParams.containsKey("enc_data")) { - System.err.println("通知失败"); - throw new IllegalArgumentException("通知失败"); - } - String decryptStr = (String) responseParams.get("enc_data"); - String messageKey = (String) responseParams.get("message_key"); - String secretKey = GmUtil.decryptSm2(messageKey, privateKey_SM4); - if (secretKey == null) { - System.err.println("解密失败"); - throw new IllegalArgumentException("解密失败"); - } - String decryParams = GmUtil.decryptSm4(decryptStr, secretKey); - - System.out.println("支付结果返回值(解密后):" + decryParams); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - String outTradeNo = paramOut.get("tran_no").toString(); - paymentOrderDto.setOrderId(outTradeNo); - paymentOrderDto.setTransactionId(paramOut.get("txn_no").toString()); - - doUpdateOnlinePay(outTradeNo, OnlinePayDto.STATE_COMPILE, "支付成功"); - - JSONObject resJson = new JSONObject(); - resJson.put("return_code", "SUCCESS"); - resJson.put("return message", "成功"); - - paymentOrderDto.setResponseEntity(new ResponseEntity(resJson.toJSONString(), HttpStatus.OK)); - return paymentOrderDto; - } - - private SmallWeChatDto getSmallWechat(JSONObject paramIn) { - - SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - smallWeChatDto.setAppId(paramIn.getString("appId")); - smallWeChatDto.setPage(1); - smallWeChatDto.setRow(1); - List smallWeChatDtos = smallWechatV1InnerServiceSMOImpl.querySmallWechats(smallWeChatDto); - - if (smallWeChatDtos == null || smallWeChatDtos.size() < 1) { - smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId")); - smallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret")); - smallWeChatDto.setMchId(MappingCache.getValue(MappingConstant.WECHAT_STORE_DOMAIN, "mchId")); - smallWeChatDto.setPayPassword(MappingCache.getValue(MappingConstant.WECHAT_STORE_DOMAIN, "key")); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - - return smallWeChatDto; - } - - return BeanConvertUtil.covertBean(smallWeChatDtos.get(0), SmallWeChatDto.class); - } - - - private void doUpdateOnlinePay(String orderId, String state, String message) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setState(state); - onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); - } - - private void doSaveOnlinePay(SmallWeChatDto smallWeChatDto, String openId, String orderId, String feeName, - double money, String state, String message, - String ppId) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setAppId(smallWeChatDto.getAppId()); - onlinePayPo.setMchId(smallWeChatDto.getMchId()); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOpenId(openId); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setPayId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); - onlinePayPo.setPayName(feeName); - onlinePayPo.setRefundFee("0"); - onlinePayPo.setState(state); - onlinePayPo.setTotalFee(money + ""); - onlinePayPo.setTransactionId(orderId); - onlinePayPo.setPaymentPoolId(ppId); - onlinePayV1InnerServiceSMOImpl.saveOnlinePay(onlinePayPo); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgPaymentFactoryAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgPaymentFactoryAdapt.java deleted file mode 100644 index 1ab1b30bc6..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgPaymentFactoryAdapt.java +++ /dev/null @@ -1,331 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.payment.IPaymentFactoryAdapt; -import com.java110.acct.payment.adapt.bbgpay.lib.*; -import com.java110.core.context.ICmdDataFlowContext; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.factory.WechatFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.app.AppDto; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.dto.owner.OwnerAppUserDto; -import com.java110.dto.payment.NotifyPaymentOrderDto; -import com.java110.dto.payment.PaymentOrderDto; -import com.java110.dto.wechat.SmallWeChatDto; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.store.ISmallWechatV1InnerServiceSMO; -import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; -import com.java110.po.wechat.OnlinePayPo; -import com.java110.utils.cache.MappingCache; -import com.java110.utils.cache.UrlCache; -import com.java110.utils.constant.MappingConstant; -import com.java110.utils.constant.WechatConstant; -import com.java110.utils.util.BeanConvertUtil; -import com.java110.utils.util.PayUtil; -import com.java110.utils.util.StringUtil; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.*; - -/** - * 北部湾银行支付厂家 - * - * 微信官方原生 支付实现类 - * 1.0 sql 配置说明: - * - * INSERT INTO `TT`.`t_dict` ( `status_cd`, `name`, `description`, `create_time`, `table_name`, `table_columns`) - * VALUES ( '9070', '北部湾银行支付', '北部湾银行支付', '2022-08-16 15:51:55', 'community_setting_key', 'setting_type'); - * - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('82', '9070', 'mchtNo_SM4', 'mchtNo_SM4', 'mchtNo_SM4', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('88', '9070', 'productNo_SM4', 'productNo_SM4', 'productNo_SM4', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('83', '9070', 'publicKey_SM4', 'publicKey_SM4', '值请填写 公钥 ', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('84', '9070', 'privateKey_SM4', 'privateKey_SM4', '值请填写 私钥 ', '2021-10-10 21:25:46', '0'); - * // 以下数据先查询是否存在 存在则修改 不存在添加 - * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) - * VALUES ('WECHAT', '被扫支付厂家', 'PAY_QR_ADAPT', 'qrCodeBbgPaymentAdapt', '', '2023-02-18 18:47:14', '0'); - * - * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) - * VALUES ('WECHAT', '线上支付厂家', 'PAYMENT_ADAPT', 'bbgPaymentFactoryAdapt', '', '2023-02-18 18:47:14', '0'); - */ -@Service("bbgPaymentFactoryAdapt") -public class BbgPaymentFactoryAdapt implements IPaymentFactoryAdapt { - - private static final Logger logger = LoggerFactory.getLogger(BbgPaymentFactoryAdapt.class); - - - //微信支付 - public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; - // 微信服务商支付开关 - public static final String WECHAT_SERVICE_PAY_SWITCH = "WECHAT_SERVICE_PAY_SWITCH"; - - //开关ON打开 - public static final String WECHAT_SERVICE_PAY_SWITCH_ON = "ON"; - - - private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; - - private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; - - public static final String TRADE_TYPE_NATIVE = "NATIVE"; - public static final String TRADE_TYPE_JSAPI = "JSAPI"; - public static final String TRADE_TYPE_MWEB = "MWEB"; - public static final String TRADE_TYPE_APP = "APP"; - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/WxGzhPay"; - - @Autowired - private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; - - - @Autowired - private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; - - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - - @Override - public Map java110Payment(PaymentOrderDto paymentOrderDto, JSONObject reqJson, ICmdDataFlowContext context) throws Exception { - - SmallWeChatDto smallWeChatDto = getSmallWechat(reqJson); - String paymentPoolId = reqJson.getString("paymentPoolId"); - - - String appId = context.getReqHeaders().get("app-id"); - String userId = context.getReqHeaders().get("user-id"); - String tradeType = reqJson.getString("tradeType"); - String notifyUrl = UrlCache.getOwnerUrl() + "/app/payment/notify/wechat/992020011134400001/" + paymentPoolId; - - String openId = reqJson.getString("openId"); - - - if (StringUtil.isEmpty(openId)) { - String appType = OwnerAppUserDto.APP_TYPE_WECHAT_MINA; - if (AppDto.WECHAT_OWNER_APP_ID.equals(appId)) { - appType = OwnerAppUserDto.APP_TYPE_WECHAT; - } else if (AppDto.WECHAT_MINA_OWNER_APP_ID.equals(appId)) { - appType = OwnerAppUserDto.APP_TYPE_WECHAT_MINA; - } else { - appType = OwnerAppUserDto.APP_TYPE_APP; - } - - OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); - ownerAppUserDto.setUserId(userId); - ownerAppUserDto.setAppType(appType); - List ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); - - if (ownerAppUserDtos == null || ownerAppUserDtos.size() < 1) { - throw new IllegalArgumentException("未找到开放账号信息"); - } - openId = ownerAppUserDtos.get(0).getOpenId(); - } - - - logger.debug("【小程序支付】 统一下单开始, 订单编号=" + paymentOrderDto.getOrderId()); - SortedMap resultMap = new TreeMap(); - //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 - double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV"), paymentOrderDto.getMoney()); - //添加或更新支付记录(参数跟进自己业务需求添加) - - Map resMap = null; - resMap = this.java110UnifieldOrder(paymentOrderDto.getName(), - paymentOrderDto.getOrderId(), - tradeType, - payAmount, - openId, - smallWeChatDto, - paymentPoolId, - notifyUrl - ); - - - return resMap; - } - - - private Map java110UnifieldOrder(String feeName, String orderNum, - String tradeType, double payAmount, String openid, - SmallWeChatDto smallWeChatDto, - String paymentPoolId, - String notifyUrl) throws Exception { - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String productNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "productNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - - - if (feeName.length() > 127) { - feeName = feeName.substring(0, 126); - } - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("product_no", productNo_SM4);// 产品编号 - params.put("biz_type", "WX_GZH");// 业务类型 - params.put("tran_no", orderNum);// 商户流水 - params.put("code", "");// 授权码 - params.put("openid", openid);// 用户标识id - params.put("appid", smallWeChatDto.getAppId());// 公众号appid - params.put("amt", payAmount);// 交易金额 - params.put("ware_name", feeName);// 商品名称 - params.put("ware_describe", "");// 商户数据包 - params.put("asyn_url", notifyUrl + "?wId=" + WechatFactory.getWId(smallWeChatDto.getAppId()));// 通知地址 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, gzhPayUrl, params); - JSONObject paramOut = JSONObject.parseObject(decryParams); - if (!"SUCCESS".equals(paramOut.getString("status")) - || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - if (!"0000".equals(paramOut.getString("return_code")) - && !"0001".equals(paramOut.getString("return_code")) - ) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - SortedMap resultMap = new TreeMap(); - resultMap.put("appId", paramOut.getString("appId")); - resultMap.put("timeStamp", paramOut.getString("timeStamp")); - resultMap.put("nonceStr", paramOut.getString("nonceStr")); - resultMap.put("package", paramOut.getString("package")); - resultMap.put("signType", paramOut.getString("signType")); - resultMap.put("sign", paramOut.getString("paySign")); - resultMap.put("code", "0"); - resultMap.put("msg", "下单成功"); - doSaveOnlinePay(smallWeChatDto, openid, orderNum, feeName, payAmount, OnlinePayDto.STATE_WAIT, "待支付",paymentPoolValueDtos.get(0).getPpId()); - - return resultMap; - } - - - @Override - public PaymentOrderDto java110NotifyPayment(NotifyPaymentOrderDto notifyPaymentOrderDto) { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(notifyPaymentOrderDto.getPaymentPoolId()); - paymentPoolValueDto.setCommunityId(notifyPaymentOrderDto.getCommunityId()); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - String privateKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "privateKey_SM4"); - - - String resXml = ""; - String param = notifyPaymentOrderDto.getParam(); - PaymentOrderDto paymentOrderDto = new PaymentOrderDto(); - // 开始解密 - Map responseParams = JsonUtil.jsonToMap(param); - if (!responseParams.containsKey("enc_data")) { - System.err.println("通知失败"); - throw new IllegalArgumentException("通知失败"); - } - String decryptStr = (String) responseParams.get("enc_data"); - String messageKey = (String) responseParams.get("message_key"); - String secretKey = GmUtil.decryptSm2(messageKey, privateKey_SM4); - if (secretKey == null) { - System.err.println("解密失败"); - throw new IllegalArgumentException("解密失败"); - } - String decryParams = GmUtil.decryptSm4(decryptStr, secretKey); - - System.out.println("支付结果返回值(解密后):" + decryParams); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - String outTradeNo = paramOut.get("tran_no").toString(); - paymentOrderDto.setOrderId(outTradeNo); - paymentOrderDto.setTransactionId(paramOut.get("txn_no").toString()); - - doUpdateOnlinePay(outTradeNo, OnlinePayDto.STATE_COMPILE, "支付成功"); - - JSONObject resJson = new JSONObject(); - resJson.put("return_code", "SUCCESS"); - resJson.put("return message", "成功"); - - paymentOrderDto.setResponseEntity(new ResponseEntity(resJson.toJSONString(), HttpStatus.OK)); - return paymentOrderDto; - } - - private SmallWeChatDto getSmallWechat(JSONObject paramIn) { - - SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - smallWeChatDto.setAppId(paramIn.getString("appId")); - smallWeChatDto.setPage(1); - smallWeChatDto.setRow(1); - List smallWeChatDtos = smallWechatV1InnerServiceSMOImpl.querySmallWechats(smallWeChatDto); - - if (smallWeChatDtos == null || smallWeChatDtos.size() < 1) { - smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId")); - smallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret")); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - - return smallWeChatDto; - } - - return BeanConvertUtil.covertBean(smallWeChatDtos.get(0), SmallWeChatDto.class); - } - - - private void doUpdateOnlinePay(String orderId, String state, String message) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setState(state); - onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); - } - - private void doSaveOnlinePay(SmallWeChatDto smallWeChatDto, String openId, String orderId, String feeName, - double money, String state, String message, - String ppId) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setAppId(smallWeChatDto.getAppId()); - onlinePayPo.setMchId(smallWeChatDto.getMchId()); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOpenId(openId); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setPayId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); - onlinePayPo.setPayName(feeName); - onlinePayPo.setRefundFee("0"); - onlinePayPo.setState(state); - onlinePayPo.setTotalFee(money + ""); - onlinePayPo.setTransactionId(orderId); - onlinePayPo.setPaymentPoolId(ppId); - onlinePayV1InnerServiceSMOImpl.saveOnlinePay(onlinePayPo); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java deleted file mode 100644 index 4195f0e6d4..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.payment.IRefundMoneyAdapt; -import com.java110.core.client.FtpUploadTemplate; -import com.java110.core.client.OssUploadTemplate; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.factory.PlutusFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.paymentPool.PaymentPoolDto; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.intf.acct.IOnlinePayRefundV1InnerServiceSMO; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.fee.IReturnPayFeeInnerServiceSMO; -import com.java110.intf.order.IOrderInnerServiceSMO; -import com.java110.intf.store.ISmallWechatV1InnerServiceSMO; -import com.java110.utils.util.PayUtil; -import com.java110.vo.ResultVo; -import org.bouncycastle.util.encoders.Base64; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service("bbgRefundMoney") -public class BbgRefundMoneyAdapt implements IRefundMoneyAdapt { - - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String refundUrl = "https://mbank.bankofbbg.com/www/corepaycer/Refund";// 退款地址 - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - @Autowired - private IReturnPayFeeInnerServiceSMO returnPayFeeInnerServiceSMOImpl; - - @Autowired - private IOrderInnerServiceSMO orderInnerServiceSMOImpl; - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Autowired - private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - - private static Logger logger = LoggerFactory.getLogger(BbgRefundMoneyAdapt.class); - - @Autowired - private FtpUploadTemplate ftpUploadTemplate; - - @Autowired - private OssUploadTemplate ossUploadTemplate; - - @Autowired - private IOnlinePayRefundV1InnerServiceSMO onlinePayRefundV1InnerServiceSMOImpl; - - @Override - public ResultVo refund(OnlinePayDto onlinePayDto, PaymentPoolDto paymentPoolDto) throws Exception { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolDto.getPpId()); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String tranNo = GenerateCodeFactory.getGeneratorId("11"); - - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("tran_no", tranNo);// 商户流水 - params.put("org_tran_no", onlinePayDto.getOrderId());// 原平台流水 - params.put("device_ip", "172.0.0.1");// 设备发起交易IP - params.put("amt", onlinePayDto.getRefundFee());// 交易金额 - params.put("ware_name", onlinePayDto.getPayName());// 摘要备注 - - // 对准备加签参数排序 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, refundUrl, params); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - if ( !"SUCCESS".equals(paramOut.getString("status")) || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - return new ResultVo(ResultVo.CODE_ERROR, "退款失败" + paramOut.getString("return_message")); - } - if ( !"0000".equals(paramOut.getString("return_code")) && !"0001".equals(paramOut.getString("return_code"))) { - return new ResultVo(ResultVo.CODE_ERROR, "退款失败" + paramOut.getString("return_message")); - } - if("0001".equals(paramOut.getString("return_code"))){ - return new ResultVo(ResultVo.CODE_OK, paramOut.getString("return_message")); - - } - return new ResultVo(ResultVo.CODE_OK, "退款完成"); - - - } - - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java deleted file mode 100644 index 1babfd803b..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.java110.acct.payment.adapt.bbgpay.lib.GmUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.HttpRequestUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.JsonUtil; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class EncryptDecryptFactory { - - - public static String execute(List paymentPoolValueDtos, String url, Map params){ - String decrypt = ""; - try { - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - // 格式为json - String json = JsonUtil.mapToJson(params); - System.out.println("加密前:" + json); - // 报文加密 - String secretKey = GmUtil.generateSm4Key(); - String encrypt = GmUtil.encryptSm4(json, secretKey); - System.out.println("加密后:" + encrypt); - - Map signParams = new HashMap<>(); - signParams.put("mcht_no", mchtNo_SM4);// 收款商户编号 - signParams.put("sign_type", "SM4"); - signParams.put("message_key", GmUtil.encryptSm2(secretKey, publicKey_SM4));// 密钥加密 - signParams.put("enc_data", encrypt);// 加密后请求参数 - - String requestParams = JsonUtil.mapToJson(signParams); - System.out.println("最终请求参数:" + requestParams); - System.err.println(""); - String returnResult = HttpRequestUtil.httpPost(url, requestParams); - System.out.println("支付结果返回值(原文):" + returnResult); - if (returnResult == null) { - System.err.println("通道响应异常"); - throw new IllegalArgumentException("通道响应异常"); - - } - // 开始解密 - Map responseParams = JsonUtil.jsonToMap(returnResult); - if (!responseParams.containsKey("enc_data")) { - System.err.println("交易失败-->" + responseParams.get("return_code") + ":" + responseParams.get("return_message")); - throw new IllegalArgumentException("交易失败-->" + responseParams.get("return_code") + ":" + responseParams.get("return_message")); - } - String decryptStr = (String) responseParams.get("enc_data"); - - decrypt = GmUtil.decryptSm4(decryptStr, secretKey); - if (decrypt == null) { - System.err.println("解密失败"); - throw new IllegalArgumentException("解密失败"); - } - System.out.println("支付结果返回值(解密后):" + decrypt); - }catch (Exception e){ - e.printStackTrace(); - throw new IllegalArgumentException(e.getMessage()); - } - return decrypt; - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java deleted file mode 100644 index 2f0e953c77..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.smo.IQrCodePaymentSMO; -import com.java110.core.client.RestTemplate; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.dto.wechat.SmallWeChatDto; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.store.ISmallWeChatInnerServiceSMO; -import com.java110.po.wechat.OnlinePayPo; -import com.java110.utils.cache.MappingCache; -import com.java110.utils.constant.MappingConstant; -import com.java110.utils.constant.WechatConstant; -import com.java110.utils.util.PayUtil; -import com.java110.vo.ResultVo; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; - -/** - * 微信支付 - */ -@Service -public class QrCodeBbgPaymentAdapt implements IQrCodePaymentSMO { - private static Logger logger = LoggerFactory.getLogger(QrCodeBbgPaymentAdapt.class); - - //微信支付 - public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; - // 微信服务商支付开关 - public static final String WECHAT_SERVICE_PAY_SWITCH = "WECHAT_SERVICE_PAY_SWITCH"; - - //开关ON打开 - public static final String WECHAT_SERVICE_PAY_SWITCH_ON = "ON"; - - - private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; - - private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/ScanCodePay"; - - private static String queryUrl = "https://mbank.bankofbbg.com/www/corepaycer/QueryTxnInfo";// 交易查询地址 - - @Autowired - private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Override - public ResultVo pay(String communityId, String orderNum, double money, String authCode, String feeName, String paymentPoolId) throws Exception { - logger.info("【小程序支付】 统一下单开始, 订单编号=" + orderNum); - SortedMap resultMap = new TreeMap(); - //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 - double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV"), money); - //添加或更新支付记录(参数跟进自己业务需求添加) - - Map resMap = null; - logger.debug("resMap=" + resMap); - String systemName = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_GOOD_NAME); - SmallWeChatDto shopSmallWeChatDto = null; - SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setObjId(communityId); - List smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); - if (smallWeChatDtos == null && smallWeChatDtos.size() < 1) { - shopSmallWeChatDto = new SmallWeChatDto(); - shopSmallWeChatDto.setObjId(communityId); - shopSmallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId")); - shopSmallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret")); - } else { - shopSmallWeChatDto = smallWeChatDtos.get(0); - } - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String productNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "productNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("product_no", productNo_SM4);// 产品编号 - params.put("tran_no", orderNum);// 商户流水 - params.put("auth_code", authCode);// 码类型 - params.put("amt", payAmount);// 交易金额 - params.put("ware_name", feeName);// 商品名称 - params.put("device_ip", "172.0.0.1");// 商户数据包 - params.put("recog_no", "123123");// 交易终端编号 - doSaveOnlinePay(shopSmallWeChatDto, "-1", orderNum, feeName, payAmount, OnlinePayDto.STATE_WAIT, "待支付",paymentPoolValueDtos.get(0).getPpId()); - - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, gzhPayUrl, params); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - if (!"0000".equals(paramOut.getString("return_code")) - || !"SUCCESS".equals(paramOut.getString("status")) - ) { - return new ResultVo(ResultVo.CODE_ERROR, "支付失败" + paramOut.getString("return_message")); - - } - - if ("FAIL".equals(paramOut.getString("deal_status"))) { - return new ResultVo(ResultVo.CODE_ERROR, "业务失败"); - } - - if ("SUCCESS".equals(paramOut.getString("deal_status"))) { - doUpdateOnlinePay(orderNum, OnlinePayDto.STATE_COMPILE, "支付成功"); - - return new ResultVo(ResultVo.CODE_OK, "成功"); - } else { - return new ResultVo(ResultVo.CODE_ERROR, "等待用户支付中"); - } - } - - public ResultVo checkPayFinish(String communityId, String orderNum, String paymentPoolId) { - Map result = null; - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - paymentPoolValueDto.setCommunityId(communityId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("tran_no", orderNum);// 商户流水 - params.put("txn_no", "");// 支付流水 - - // 对准备加签参数排序 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, queryUrl, params); - - /** - * {"amt":"0.01","deal_status":"PROCESSING","jump_url":"","mcht_name":"广西蓉慧科技有限公司","mcht_no":"MCT2023060100029734", - * "real_amt":"0.01","return_code":"5019","return_message":"用户正在输入密码,请等待","status":"SUCCESS", - * "tran_no":"962023092519710062","txn_date":"20230925", - * "txn_no":"P11082023092523543816778858","txn_time":"235438","ware_name":"云星花园-1栋1单元101室-住宅物业费"} - */ - JSONObject paramOut = JSONObject.parseObject(decryParams); - - if ("PROCESSING".equals(paramOut.getString("deal_status")) && "5019".equals(paramOut.getString("return_code"))) { - return new ResultVo(ResultVo.CODE_WAIT_PAY, "等待支付完成"); - } - - if (!"SUCCESS".equals(paramOut.getString("status")) - || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - - if (!"0000".equals(paramOut.getString("return_code")) - && !"0001".equals(paramOut.getString("return_code")) - ) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - if ("0000".equals(paramOut.getString("return_code"))) { - doUpdateOnlinePay(orderNum, OnlinePayDto.STATE_COMPILE, "支付成功"); - return new ResultVo(ResultVo.CODE_OK, "成功"); - } else { - return new ResultVo(ResultVo.CODE_WAIT_PAY, "等待支付完成"); - } - } - - private void doSaveOnlinePay(SmallWeChatDto smallWeChatDto, String openId, String orderId, String feeName, - double money, String state, String message, - String ppId) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setAppId(smallWeChatDto.getAppId()); - onlinePayPo.setMchId(smallWeChatDto.getMchId()); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOpenId(openId); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setPayId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); - onlinePayPo.setPayName(feeName); - onlinePayPo.setRefundFee("0"); - onlinePayPo.setState(state); - onlinePayPo.setTotalFee(money + ""); - onlinePayPo.setTransactionId(orderId); - onlinePayPo.setPaymentPoolId(ppId); - onlinePayV1InnerServiceSMOImpl.saveOnlinePay(onlinePayPo); - } - - private void doUpdateOnlinePay(String orderId, String state, String message) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setState(state); - onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java deleted file mode 100644 index 788f7c254e..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.security.Security; -import java.security.spec.AlgorithmParameterSpec; - -import javax.crypto.Cipher; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; - -import com.alibaba.fastjson.JSONObject; - -/** - * aes 加解密相关工具类 - * - * @author bbw - * - */ -public class AesEncrypt { - public final static String ivParameter = "0000000000000000"; - private static final String CHARSET_NAME_UTF8 = "UTF-8"; - - static { - Security.addProvider(new BouncyCastleProvider()); - Security.setProperty("crypto.policy", "unlimited"); - } - - public static String encrypt(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return Base64Util.encode(encrypted); - } - - public static byte[] encryptByte(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return encrypted; - } - - public static byte[] encryptByte(String sSrc, String encodingFormat, byte[] raw) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return encrypted; - } - - public static String decrypt(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - try { - byte[] raw = sKey.getBytes("ASCII"); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); - byte[] encrypted1 = Base64Util.decode(sSrc); - byte[] original = cipher.doFinal(encrypted1); - String originalString = new String(original, encodingFormat); - return originalString; - } catch (Exception ex) { - return null; - } - } - - public static byte[] decryptByte(byte[] bt, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - try { - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); - byte[] original = cipher.doFinal(bt); - return original; - } catch (Exception ex) { - return null; - } - } - - public static String parseByte2HexStr(byte buf[]) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < buf.length; i++) { - String hex = Integer.toHexString(buf[i] & 0xFF); - if (hex.length() == 1) { - hex = '0' + hex; - } - sb.append(hex.toUpperCase()); - } - return sb.toString(); - } - - public static byte[] parseHexStr2Byte(String hexStr) { - if (hexStr.length() < 1) - return null; - byte[] result = new byte[hexStr.length() / 2]; - for (int i = 0; i < hexStr.length() / 2; i++) { - int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); - int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); - result[i] = (byte) (high * 16 + low); - } - return result; - } - - // 法院一案一户加密 - public static String ocoaEncrypt(String content, String aesKey, String aesIV) throws Exception { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec keySpec = new SecretKeySpec(aesKey.getBytes(CHARSET_NAME_UTF8), "AES"); - AlgorithmParameterSpec paramSpec = new IvParameterSpec(aesIV.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, keySpec, paramSpec); - byte[] result = cipher.doFinal(content.getBytes(CHARSET_NAME_UTF8)); - return URLEncoder.encode(Base64Util.encode(result), "UTF-8"); - } - - // 法院一案一户解密 - public static String ocoaDecrypt(String content, String aesKey, String aesIV) throws Exception { - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec keySpec = new SecretKeySpec(aesKey.getBytes(CHARSET_NAME_UTF8), "AES"); - AlgorithmParameterSpec paramSpec = new IvParameterSpec(aesIV.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, keySpec, paramSpec); - return new String(cipher.doFinal(Base64Util.decode(URLDecoder.decode(content, "UTF-8"))), CHARSET_NAME_UTF8); - } catch (Exception e) { - e.printStackTrace(); - } - return ""; - } - - /** - * 异或运算 - * - */ - public static String strEncAndDec(String src) { - // 字符串转成字符数组 - char[] c = src.toCharArray(); - // 循环给字符数组加密 - for (int i = 0; i < c.length; i++) { - c[i] = (char) (c[i] ^ 1); - } - return new String(c); - } - - public static void main(String[] args) throws Exception { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("ZH", "0003999"); - jsonObject.put("AH", ""); - String content = JSONObject.toJSONString(jsonObject); - String s1 = ocoaEncrypt(content, "2021YHSYSHYAKXTK", "2021YHSYSHYAKXTV"); - System.out.println("密文:" + s1); - String result = ocoaDecrypt(s1, "2021YHSYSHYAKXTK", "2021YHSYSHYAKXTV"); - System.out.println("解密:" + result); - System.out.println(14584308/16415104f); - - String authCode = "990000003458LBU3133170411108125"; - System.out.println("付款码:" + authCode); - String mchtNo = authCode.substring(12); - System.out.println("第13位开始截取:" + mchtNo); - System.out.println("企业商户号:" + strEncAndDec(mchtNo)); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java deleted file mode 100644 index c8253b6370..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import org.apache.commons.codec.binary.Base64; - -/** - * - * BASE64编码解码工具包 - */ -public class Base64Util { - - /** - * - * BASE64字符串解码为二进制数据 - * - * - * @param base64 - * @return - * @throws Exception - */ - public static byte[] decode(String base64) throws Exception { - return Base64.decodeBase64(base64.getBytes()); - } - - /** - * - * 二进制数据编码为BASE64字符串 - * - * - * @param bytes - * @return - * @throws Exception - */ - public static String encode(byte[] bytes) throws Exception { - return new String(Base64.encodeBase64(bytes)); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java deleted file mode 100644 index 6b7dda6233..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.security.KeyFactory; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.Signature; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.Enumeration; - -import org.apache.commons.codec.binary.Base64; - -/** - * 验证证书公共类 - * - */ -public class CAUtil { - private static final String DEFAULT_CHARSET = "UTF-8"; - private static final String KEY_ALGORITHM = "RSA"; - private static final String SIGNATURE_ALGORITHM = "SHA256withRSA"; - - /** - * 判断字符串是否为null或空 true为空 - */ - public static boolean isNullOrEmpty(String str) { - return (str == null || str.length() == 0); - } - - // 获取私钥 - public static PrivateKey getPrivateKey(InputStream is, String privateKeyPwd) throws Exception { - KeyStore ks; - try { - ks = KeyStore.getInstance("PKCS12"); - char[] nPassword = null; - if (isNullOrEmpty(privateKeyPwd)) { - privateKeyPwd = null; - } else { - nPassword = privateKeyPwd.toCharArray(); - } - ks.load(is, nPassword); - is.close(); - Enumeration> enumas = ks.aliases(); - String keyAlias = null; - if (enumas.hasMoreElements()) { - keyAlias = (String) enumas.nextElement(); - } - PrivateKey prikey = (PrivateKey) ks.getKey(keyAlias, nPassword); - return prikey; - } catch (KeyStoreException e) { - throw new Exception("获取KeyStore失败"); - } catch (FileNotFoundException e) { - throw new Exception("无效的私钥地址"); - } catch (NoSuchAlgorithmException e) { - throw new Exception("读取私钥失败"); - } catch (CertificateException e) { - throw new Exception("加载证书失败"); - } catch (IOException e) { - throw new Exception("读取证书失败"); - } catch (UnrecoverableKeyException e) { - throw new Exception("获取私钥失败"); - } - } - - // 获取公钥 - public static PublicKey getPublicKey(String publicKeyAddr) throws Exception { - try { - CertificateFactory certificatefactory = CertificateFactory.getInstance("X.509"); - FileInputStream bais = new FileInputStream(publicKeyAddr); - X509Certificate Cert = (X509Certificate) certificatefactory.generateCertificate(bais); - bais.close(); - PublicKey pk = Cert.getPublicKey(); - return pk; - } catch (CertificateException e) { - throw new Exception("获取公钥失败"); - } - } - - /** - * RSA签名 - * - * @param localPrivKey - * 私钥 - * @param plaintext - * 需要签名的信息 - * @return byte[] - * @throws Exception - */ - public static byte[] signRSA(byte[] plainBytes, boolean useBase64Code, PrivateKey privKey) throws Exception { - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initSign(privKey); - signature.update(plainBytes); - // 如果是Base64编码的话,需要对签名后的数组以Base64编码 - if (useBase64Code) { - return Base64.encodeBase64(signature.sign()); - } else { - return signature.sign(); - } - } - - /** - * 验签操作 - * - * @param peerPubKey - * 公钥 - * @param plainBytes - * 需要验签的信息 - * @param signBytes - * 签名信息 - * @return boolean - */ - public static boolean verifyRSA(byte[] plainBytes, byte[] signBytes, boolean useBase64Code, PublicKey pubKey) throws Exception { - boolean isValid = false; - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initVerify(pubKey); - signature.update(plainBytes); - // 如果是Base64编码的话,需要对验签的数组以Base64解码 - if (useBase64Code) { - isValid = signature.verify(Base64.decodeBase64(signBytes)); - } else { - isValid = signature.verify(signBytes); - } - return isValid; - } - - /** - * SHA256withRSA签名(RSA2) - * - */ - public static String rsa256Sign(String content, String charset, String privateKey) throws Exception { - if (isNullOrEmpty(charset)) { - charset = DEFAULT_CHARSET; - } - if (isNullOrEmpty(privateKey)) { - return null; - } - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - byte[] encodedKey = StreamUtil.readText(new ByteArrayInputStream(privateKey.getBytes())).getBytes(); - encodedKey = Base64.decodeBase64(encodedKey); - PrivateKey priKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(encodedKey)); - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initSign(priKey); - if (isNullOrEmpty(charset)) { - signature.update(content.getBytes()); - } else { - signature.update(content.getBytes(charset)); - } - byte[] signed = signature.sign(); - return new String(Base64.encodeBase64(signed)); - } - - /** - * SHA256withRSA验签(RSA2) - * - */ - public static boolean rsa256Verify(byte[] content, String sign, String publicKey) throws Exception { - if (isNullOrEmpty(publicKey)) { - return false; - } - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - StringWriter writer = new StringWriter(); - StreamUtil.io(new InputStreamReader(new ByteArrayInputStream(publicKey.getBytes())), writer); - byte[] encodedKey = writer.toString().getBytes(); - encodedKey = Base64.decodeBase64(encodedKey); - PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initVerify(pubKey); - signature.update(content); - return signature.verify(Base64.decodeBase64(sign.getBytes())); - } -} \ No newline at end of file diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java deleted file mode 100644 index c85b4f2c68..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java +++ /dev/null @@ -1,311 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import javax.crypto.Cipher; -import javax.crypto.KeyGenerator; -import javax.crypto.spec.SecretKeySpec; - -import java.math.BigInteger; -import java.security.Key; -import java.security.KeyFactory; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.SecureRandom; -import java.security.Security; -import java.security.Signature; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; - -import org.bouncycastle.asn1.gm.GMNamedCurves; -import org.bouncycastle.asn1.gm.GMObjectIdentifiers; -import org.bouncycastle.asn1.x9.X9ECParameters; -import org.bouncycastle.crypto.engines.SM2Engine; -import org.bouncycastle.crypto.params.ECDomainParameters; -import org.bouncycastle.crypto.params.ECPrivateKeyParameters; -import org.bouncycastle.crypto.params.ECPublicKeyParameters; -import org.bouncycastle.crypto.params.ParametersWithRandom; -import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey; -import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.jce.spec.ECParameterSpec; -import org.bouncycastle.jce.spec.ECPrivateKeySpec; -import org.bouncycastle.jce.spec.ECPublicKeySpec; -import org.bouncycastle.util.encoders.Hex; - -/** - * 国密加密算法 - */ -public class GmUtil { - private static final String DEFAULT_CHARSET = "UTF-8"; - public static final String ALGORITHM_NAME = "SM4"; - // 加密算法/分组加密模式/分组填充方式 - // PKCS5Padding-以8个字节为一组进行分组加密 - // 定义分组加密模式使用:PKCS5Padding - public static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS7Padding"; - // 128-32位16进制;256-64位16进制 - public static final int DEFAULT_KEY_SIZE = 128; - // 椭圆曲线ECParameters ASN.1 结构 - private static X9ECParameters x9ECParameters = GMNamedCurves.getByName("sm2p256v1"); - // 椭圆曲线公钥或私钥的基本域参数。 - private static ECParameterSpec ecDomainParameters = new ECParameterSpec(x9ECParameters.getCurve(), x9ECParameters.getG(), x9ECParameters.getN()); - - static { - Security.addProvider(new BouncyCastleProvider()); - } - - /** - * 将Base64转码的公钥串,转化为公钥对象 - * - */ - public static PublicKey createPublicKey(String publicKey) { - PublicKey publickey = null; - try { - X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(Base64Util.decode(publicKey)); - KeyFactory keyFactory = KeyFactory.getInstance("EC", new BouncyCastleProvider()); - publickey = keyFactory.generatePublic(publicKeySpec); - } catch (Exception e) { - e.printStackTrace(); - } - return publickey; - } - - /** - * 将Base64转码的私钥串,转化为私钥对象 - * - */ - public static PrivateKey createPrivateKey(String privateKey) { - PrivateKey publickey = null; - try { - PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64Util.decode(privateKey)); - KeyFactory keyFactory = KeyFactory.getInstance("EC", new BouncyCastleProvider()); - publickey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); - } catch (Exception e) { - e.printStackTrace(); - } - return publickey; - } - - /** - * 根据publicKey对原始数据data,使用SM2加密 - */ - public static byte[] encrypt(byte[] data, PublicKey publicKey) { - ECPublicKeyParameters localECPublicKeyParameters = null; - - if (publicKey instanceof BCECPublicKey) { - BCECPublicKey localECPublicKey = (BCECPublicKey) publicKey; - ECParameterSpec localECParameterSpec = localECPublicKey.getParameters(); - ECDomainParameters localECDomainParameters = new ECDomainParameters(localECParameterSpec.getCurve(), localECParameterSpec.getG(), localECParameterSpec.getN()); - localECPublicKeyParameters = new ECPublicKeyParameters(localECPublicKey.getQ(), localECDomainParameters); - } - SM2Engine localSM2Engine = new SM2Engine(); - localSM2Engine.init(true, new ParametersWithRandom(localECPublicKeyParameters, new SecureRandom())); - byte[] arrayOfByte2; - try { - arrayOfByte2 = localSM2Engine.processBlock(data, 0, data.length); - return arrayOfByte2; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 根据privateKey对加密数据encodedata,使用SM2解密 - */ - public static byte[] decrypt(byte[] encodedata, PrivateKey privateKey) { - SM2Engine localSM2Engine = new SM2Engine(); - BCECPrivateKey sm2PriK = (BCECPrivateKey) privateKey; - ECParameterSpec localECParameterSpec = sm2PriK.getParameters(); - ECDomainParameters localECDomainParameters = new ECDomainParameters(localECParameterSpec.getCurve(), localECParameterSpec.getG(), localECParameterSpec.getN()); - ECPrivateKeyParameters localECPrivateKeyParameters = new ECPrivateKeyParameters(sm2PriK.getD(), localECDomainParameters); - localSM2Engine.init(false, localECPrivateKeyParameters); - try { - byte[] arrayOfByte3 = localSM2Engine.processBlock(encodedata, 0, encodedata.length); - return arrayOfByte3; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 私钥签名 - */ - public static byte[] signByPrivateKey(byte[] data, PrivateKey privateKey) throws Exception { - Signature sig = Signature.getInstance(GMObjectIdentifiers.sm2sign_with_sm3.toString(), BouncyCastleProvider.PROVIDER_NAME); - sig.initSign(privateKey); - sig.update(data); - return sig.sign(); - } - - /** - * 公钥验签 - */ - public static boolean verifyByPublicKey(byte[] data, PublicKey publicKey, byte[] signature) throws Exception { - Signature sig = Signature.getInstance(GMObjectIdentifiers.sm2sign_with_sm3.toString(), BouncyCastleProvider.PROVIDER_NAME); - sig.initVerify(publicKey); - sig.update(data); - return sig.verify(signature); - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * @Description 公钥字符串转换为 BCECPublicKey 公钥对象 - * @param pubKeyHex - * 64字节十六进制公钥字符串(如果公钥字符串为65字节首个字节为0x04:表示该公钥为非压缩格式,操作时需要删除) - * @return BCECPublicKey SM2公钥对象 - */ - private static BCECPublicKey getECPublicKeyByPublicKeyHex(String pubKeyHex) { - // 截取64字节有效的SM2公钥(如果公钥首个字节为0x04) - if (pubKeyHex.length() > 128) { - pubKeyHex = pubKeyHex.substring(pubKeyHex.length() - 128); - } - // 将公钥拆分为x,y分量(各32字节) - String stringX = pubKeyHex.substring(0, 64); - String stringY = pubKeyHex.substring(stringX.length()); - // 将公钥x、y分量转换为BigInteger类型 - BigInteger x = new BigInteger(stringX, 16); - BigInteger y = new BigInteger(stringY, 16); - // 通过公钥x、y分量创建椭圆曲线公钥规范 - ECPublicKeySpec ecPublicKeySpec = new ECPublicKeySpec(x9ECParameters.getCurve().createPoint(x, y), ecDomainParameters); - // 通过椭圆曲线公钥规范,创建出椭圆曲线公钥对象(可用于SM2加密及验签) - return new BCECPublicKey("EC", ecPublicKeySpec, BouncyCastleProvider.CONFIGURATION); - } - - /** - * @Description 私钥字符串转换为 BCECPrivateKey 私钥对象 - * @param privateKeyHex - * 32字节十六进制私钥字符串 - * @return BCECPrivateKey SM2私钥对象 - */ - private static BCECPrivateKey getBCECPrivateKeyByPrivateKeyHex(String privateKeyHex) { - // 将十六进制私钥字符串转换为BigInteger对象 - BigInteger d = new BigInteger(privateKeyHex, 16); - // 通过私钥和私钥域参数集创建椭圆曲线私钥规范 - ECPrivateKeySpec ecPrivateKeySpec = new ECPrivateKeySpec(d, ecDomainParameters); - // 通过椭圆曲线私钥规范,创建出椭圆曲线私钥对象(可用于SM2解密和签名) - return new BCECPrivateKey("EC", ecPrivateKeySpec, BouncyCastleProvider.CONFIGURATION); - } - - /** - * @Description 公钥加密 - */ - public static String encryptSm2(String data, String publicKeyHex) { - BCECPublicKey publicKey = getECPublicKeyByPublicKeyHex(publicKeyHex); - // 加密模式 - SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2; - // 通过公钥对象获取公钥的基本域参数。 - ECParameterSpec ecParameterSpec = publicKey.getParameters(); - ECDomainParameters ecDomainParameters = new ECDomainParameters(ecParameterSpec.getCurve(), ecParameterSpec.getG(), ecParameterSpec.getN()); - // 通过公钥值和公钥基本参数创建公钥参数对象 - ECPublicKeyParameters ecPublicKeyParameters = new ECPublicKeyParameters(publicKey.getQ(), ecDomainParameters); - // 根据加密模式实例化SM2公钥加密引擎 - SM2Engine sm2Engine = new SM2Engine(mode); - // 初始化加密引擎 - sm2Engine.init(true, new ParametersWithRandom(ecPublicKeyParameters, new SecureRandom())); - byte[] arrayOfBytes = null; - try { - // 将明文字符串转换为指定编码的字节串 - byte[] in = Hex.decode(data); - // 通过加密引擎对字节数串行加密 - arrayOfBytes = sm2Engine.processBlock(in, 0, in.length); - } catch (Exception e) { - e.printStackTrace(); - } - // 将加密后的字节串转换为十六进制字符串 - return Hex.toHexString(arrayOfBytes).toUpperCase(); - } - - /** - * @Description 私钥解密 - */ - public static String decryptSm2(String cipherData, String privateKeyHex) { - BCECPrivateKey privateKey = getBCECPrivateKeyByPrivateKeyHex(privateKeyHex); - // 解密模式 - SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2; - // 将十六进制字符串密文转换为字节数组(需要与加密一致,加密是:加密后的字节数组转换为了十六进制字符串) - byte[] cipherDataByte = Hex.decode(cipherData); - // 通过私钥对象获取私钥的基本域参数。 - ECParameterSpec ecParameterSpec = privateKey.getParameters(); - ECDomainParameters ecDomainParameters = new ECDomainParameters(ecParameterSpec.getCurve(), ecParameterSpec.getG(), ecParameterSpec.getN()); - // 通过私钥值和私钥钥基本参数创建私钥参数对象 - ECPrivateKeyParameters ecPrivateKeyParameters = new ECPrivateKeyParameters(privateKey.getD(), ecDomainParameters); - // 通过解密模式创建解密引擎并初始化 - SM2Engine sm2Engine = new SM2Engine(mode); - sm2Engine.init(false, ecPrivateKeyParameters); - String result = null; - try { - // 通过解密引擎对密文字节串进行解密 - byte[] arrayOfBytes = sm2Engine.processBlock(cipherDataByte, 0, cipherDataByte.length); - result = new String(arrayOfBytes, "utf-8"); - } catch (Exception e) { - e.printStackTrace(); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * 自动生成sm4密钥 - * - */ - public static String generateSm4Key() throws Exception { - KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM_NAME, BouncyCastleProvider.PROVIDER_NAME); - kg.init(DEFAULT_KEY_SIZE, new SecureRandom()); - byte[] sm4Key = kg.generateKey().getEncoded(); - return new String(Hex.encode(sm4Key)).toUpperCase(); - } - - /** - * 生成ECB暗号 - * - */ - private static Cipher generateSm4Cipher(String algorithmName, int mode, byte[] key) throws Exception { - Cipher cipher = Cipher.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME); - Key sm4Key = new SecretKeySpec(key, ALGORITHM_NAME); - cipher.init(mode, sm4Key); - return cipher; - } - - /** - * sm4加密 - * - */ - public static String encryptSm4(String data, String hexKey) { - try { - // 16进制字符串-->byte[] - byte[] keyData = Hex.decode(hexKey); - // String-->byte[] - byte[] srcData = data.getBytes(DEFAULT_CHARSET); - // 加密后的数组 - Cipher cipher = generateSm4Cipher(ALGORITHM_NAME_ECB_PADDING, Cipher.ENCRYPT_MODE, keyData); - byte[] cipherArray = cipher.doFinal(srcData); - // byte[]-->hexString - return Hex.toHexString(cipherArray).toUpperCase(); - } catch (Exception e) { - return null; - } - } - - /** - * sm4解密 - * - */ - public static String decryptSm4(String cipherText, String hexKey) { - // 用于接收解密后的字符串 - String decryptStr = null; - // hexString-->byte[] - byte[] keyData = Hex.decode(hexKey); - // hexString-->byte[] - byte[] cipherData = Hex.decode(cipherText); - try { - // 解密 - Cipher cipher = generateSm4Cipher(ALGORITHM_NAME_ECB_PADDING, Cipher.DECRYPT_MODE, keyData); - byte[] srcData = cipher.doFinal(cipherData); - decryptStr = new String(srcData, DEFAULT_CHARSET); - } catch (Exception e) { - e.printStackTrace(); - } - return decryptStr; - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java deleted file mode 100644 index ce4ce009a5..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLDecoder; - -import org.apache.http.HttpHost; -import org.apache.http.HttpResponse; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; - -/** - * http请求工具类 - * - * @author lizhongfu - * - */ -public class HttpRequestUtil { - private final static int connectTimeOut = 30000;// 连接超时时间 - private final static int readTimeOut = 30000;// 读超时时间 - - /** - * httpPost - * - * @param url 路径 - * @param jsonParam 参数 - * @return - */ - public static String httpPost(String url, String jsonParam) throws Exception { - return httpPost(url, jsonParam, false); - } - - /** - * post请求 - * - * @return - */ - public static String httpPost(String url, String jsonParam, boolean bUseProxy) throws Exception { - // post请求返回结果 - CloseableHttpClient client = HttpClients.createDefault(); - HttpPost method = new HttpPost(url); - String str = ""; - try { - RequestConfig config1 = null; - // 是否采用代理 - if (bUseProxy) { - // HttpHost proxy = new HttpHost("代理服务器IP", 代理服务器端口); - HttpHost proxy = new HttpHost("127.0.0.1", 8828); - config1 = RequestConfig.custom().setProxy(proxy).setConnectTimeout(connectTimeOut).setSocketTimeout(readTimeOut).build(); - } else { - config1 = RequestConfig.custom().setConnectTimeout(connectTimeOut).setSocketTimeout(readTimeOut).build(); - } - method.setConfig(config1); - if (null != jsonParam) { - // 解决中文乱码问题 - StringEntity entity = new StringEntity(jsonParam, "utf-8"); - entity.setContentEncoding("UTF-8"); - entity.setContentType("application/json"); - // entity.setContentType("application/x-www-form-urlencoded"); - method.setEntity(entity); - } - HttpResponse result = client.execute(method); - url = URLDecoder.decode(url, "UTF-8"); - /** 请求发送成功,并得到响应 **/ - if (result.getStatusLine().getStatusCode() == 200) { - /** 读取服务器返回过来的json字符串数据 **/ - // str = EntityUtils.toString(result.getEntity()); - str = EntityUtils.toString(result.getEntity(), "UTF-8"); - } - } catch (IOException e) { - System.err.println("网络异常:" + e.getMessage()); - // 网络异常 - throw e; - } catch (Exception e) { - System.err.println("系统错误:" + e.getMessage()); - throw e; - } - return str; - } - - /** - * 获取到下载的outputstream - * - * @param url - * @return - * @throws Exception - */ - public static ByteArrayOutputStream httpGetToStream(String url) throws Exception { - InputStream input = null; - CloseableHttpClient client = null; - try { - client = HttpClients.createDefault(); - // 发送get请求 - HttpGet request = new HttpGet(url); - HttpResponse response = client.execute(request); - input = response.getEntity().getContent(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buff = new byte[1024]; - int len; - while ((len = input.read(buff)) > -1) { - baos.write(buff, 0, len); - } - baos.flush(); - return baos; - } catch (Exception e) { - System.err.println("系统错误:" + e.getMessage()); - return null; - } finally { - input.close(); - client.close(); - } - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java deleted file mode 100644 index 45489939c2..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.TypeReference; -import com.alibaba.fastjson.parser.Feature; -import com.alibaba.fastjson.serializer.SerializerFeature; - -public class JsonUtil { - /** - * 将json转化成map - * - * @param json - * @return - */ - public static Map jsonToMap(String json) { - try { - return JSON.parseObject(json, new TypeReference>() { - }, Feature.OrderedField); - } catch (Exception e) { - return new HashMap<>(); - } - - } - - /** - * 将map转化成json - * - * @param map - * @return - */ - public static String mapToJson(Map map) { - return JSON.toJSONString(map, SerializerFeature.WriteMapNullValue); - } - - public static String mapToJson2(Map map) throws Exception { - return JSON.toJSONString(map, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty); - } - - /** - * Json转Object - * - * @return - */ - public static T jsonToObject(Class clazz, String json) { - return JSON.parseObject(json, clazz); - } - - /** - * 对map 进行排序 - * - * @param map - * @return - */ - public static Map sortMapByKey(Map map) { - if (map == null || map.isEmpty()) { - return null; - } - Map sortMap = new TreeMap(new Comparator() { - - @Override - public int compare(String str0, String str1) { - return str0.compareTo(str1); - } - }); - sortMap.putAll(map); - return sortMap; - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java deleted file mode 100644 index 80405cdd80..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; - -public class StreamUtil { - - public StreamUtil() { - - } - - public static void io(InputStream in, OutputStream out) throws IOException { - io((InputStream) in, (OutputStream) out, -1); - } - - public static void io(InputStream in, OutputStream out, int bufferSize) throws IOException { - if (bufferSize == -1) { - bufferSize = 8192; - } - - byte[] buffer = new byte[bufferSize]; - - int amount; - while ((amount = in.read(buffer)) >= 0) { - out.write(buffer, 0, amount); - } - - } - - public static void io(Reader in, Writer out) throws IOException { - io((Reader) in, (Writer) out, -1); - } - - public static void io(Reader in, Writer out, int bufferSize) throws IOException { - if (bufferSize == -1) { - bufferSize = 4096; - } - - char[] buffer = new char[bufferSize]; - - int amount; - while ((amount = in.read(buffer)) >= 0) { - out.write(buffer, 0, amount); - } - - } - - public static OutputStream synchronizedOutputStream(OutputStream out) { - return new SynchronizedOutputStream(out); - } - - public static OutputStream synchronizedOutputStream(OutputStream out, Object lock) { - return new SynchronizedOutputStream(out, lock); - } - - public static String readText(InputStream in) throws IOException { - return readText(in, (String) null, -1); - } - - public static String readText(InputStream in, String encoding) throws IOException { - return readText(in, encoding, -1); - } - - public static String readText(InputStream in, String encoding, int bufferSize) throws IOException { - Reader reader = encoding == null ? new InputStreamReader(in) : new InputStreamReader(in, encoding); - return readText(reader, bufferSize); - } - - public static String readText(Reader reader) throws IOException { - return readText(reader, -1); - } - - public static String readText(Reader reader, int bufferSize) throws IOException { - StringWriter writer = new StringWriter(); - io((Reader) reader, (Writer) writer, bufferSize); - return writer.toString(); - } - - private static class SynchronizedOutputStream extends OutputStream { - private OutputStream out; - private Object lock; - - SynchronizedOutputStream(OutputStream out) { - this(out, out); - } - - SynchronizedOutputStream(OutputStream out, Object lock) { - this.out = out; - this.lock = lock; - } - - public void write(int datum) throws IOException { - synchronized (this.lock) { - this.out.write(datum); - } - } - - public void write(byte[] data) throws IOException { - synchronized (this.lock) { - this.out.write(data); - } - } - - public void write(byte[] data, int offset, int length) throws IOException { - synchronized (this.lock) { - this.out.write(data, offset, length); - } - } - - public void flush() throws IOException { - synchronized (this.lock) { - this.out.flush(); - } - } - - public void close() throws IOException { - synchronized (this.lock) { - this.out.close(); - } - } - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java deleted file mode 100644 index a2c231d3a4..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 该目录下存放北部湾银行 支付相关内容 - */ -package com.java110.acct.payment.adapt.bbgpay; \ No newline at end of file diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java index 071d043cf7..c981cc0a85 100644 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java +++ b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java @@ -2,9 +2,6 @@ import com.alibaba.fastjson.JSONObject; import com.java110.acct.payment.IPaymentFactoryAdapt; -import com.java110.acct.payment.adapt.bbgpay.EncryptDecryptFactory; -import com.java110.acct.payment.adapt.bbgpay.lib.GmUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.JsonUtil; import com.java110.acct.payment.adapt.easypay.utils.HttpConnectUtils; import com.java110.core.context.ICmdDataFlowContext; import com.java110.core.factory.GenerateCodeFactory; diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java index 7b9d31e50b..a0a5426ad6 100644 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java +++ b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java @@ -2,7 +2,6 @@ import com.alibaba.fastjson.JSONObject; import com.java110.acct.payment.IRefundMoneyAdapt; -import com.java110.acct.payment.adapt.bbgpay.EncryptDecryptFactory; import com.java110.acct.payment.adapt.easypay.utils.HttpConnectUtils; import com.java110.core.client.FtpUploadTemplate; import com.java110.core.client.OssUploadTemplate; From 0cf28cc0d41d154a6a9de3ff1a35664c2e0686a7 Mon Sep 17 00:00:00 2001 From: xuegao8848 Date: Mon, 2 Dec 2024 11:45:26 +0800 Subject: [PATCH 36/37] =?UTF-8?q?[fix]readcn=E4=B8=AD=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme_cn.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme_cn.md b/Readme_cn.md index 6e43eb0ac7..29bf48a717 100644 --- a/Readme_cn.md +++ b/Readme_cn.md @@ -2,8 +2,8 @@ ## 说明 HC小区管理系统是一套saas物业管理的系统,包括 房产、业主、 费用 (可以线上缴费)、报修(可以线上报修)、投诉建议、采购、巡检、停车、门径、道闸、监控、工作流、问卷和公告等功能。 -目前很多地方商用超过一年半时间 欢饮直接使用或者推广使用 - + 当前,众多地区已进入商用阶段达一年半之久,其应用成效已获充分验证,欢迎各界直接采用或广泛推广,携手共创更大价值与更优效益。 + 相关代码: 1、[物业系统前端](https://gitee.com/java110/MicroCommunityWeb) : 物业员工使用电脑端 2、[物业系统后端](https://gitee.com/wuxw7/MicroCommunity): 核心业务处理端 From 96f9d12c7e74054cfed1027c1ed38109e1ab2fc7 Mon Sep 17 00:00:00 2001 From: jxfzzzt <1160490625@qq.com> Date: Fri, 13 Dec 2024 21:02:15 +0800 Subject: [PATCH 37/37] update `com.alibaba:fastjson` from 1.2.83 to 2.0.53 and fix break change. --- pom.xml | 2 +- .../com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java | 4 ++-- .../java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java | 2 +- .../com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 52fc6432b7..fe4795911e 100755 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,7 @@ com.alibaba fastjson - 1.2.83 + 2.0.53 org.mybatis.spring.boot diff --git a/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java index c6693e88ed..36931f3da8 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java @@ -204,7 +204,7 @@ private BigDecimal computeFeeDetail(JSONObject reqJson, List } FeeDetailDto feeDetailDto = new FeeDetailDto(); - feeDetailDto.setDetailIds(detailIds.toArray(new String[detailIds.size()])); + feeDetailDto.setDetailIds((String[]) detailIds.toArray(new String[detailIds.size()])); feeDetailDto.setCommunityId(reqJson.getString("communityId")); List feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto); @@ -263,7 +263,7 @@ private BigDecimal computeAcctDetail(JSONObject reqJson, List accountReceiptDtos = accountReceiptV1InnerServiceSMOImpl.queryAccountReceipts(accountReceiptDto); if (accountReceiptDtos == null || accountReceiptDtos.isEmpty()) { diff --git a/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java index f6efd4eebc..43b129e6ef 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java @@ -149,7 +149,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONOb } JSONArray configIds = reqJson.getJSONArray("configIds"); FeeConfigDto feeConfigDto = new FeeConfigDto(); - feeConfigDto.setConfigIds(configIds.toArray(new String[configIds.size()])); + feeConfigDto.setConfigIds((String[]) configIds.toArray(new String[configIds.size()])); feeConfigDto.setCommunityId(reqJson.getString("communityId")); List feeConfigDtos = payFeeConfigV1InnerServiceSMOImpl.queryPayFeeConfigs(feeConfigDto); diff --git a/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java index bd1527f63a..8cb9414da8 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java @@ -139,7 +139,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONOb } JSONArray configIds = reqJson.getJSONArray("configIds"); FeeConfigDto feeConfigDto = new FeeConfigDto(); - feeConfigDto.setConfigIds(configIds.toArray(new String[configIds.size()])); + feeConfigDto.setConfigIds((String[]) configIds.toArray(new String[configIds.size()])); feeConfigDto.setCommunityId(reqJson.getString("communityId")); List feeConfigDtos = payFeeConfigV1InnerServiceSMOImpl.queryPayFeeConfigs(feeConfigDto);
- * 微信官方原生 支付实现类 - * 1.0 sql 配置说明: - *
- * INSERT INTO `TT`.`t_dict` ( `status_cd`, `name`, `description`, `create_time`, `table_name`, `table_columns`) - * VALUES ( '9070', '北部湾银行支付', '北部湾银行支付', '2022-08-16 15:51:55', 'community_setting_key', 'setting_type'); - *
- * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('82', '9070', 'mchtNo_SM4', 'mchtNo_SM4', 'mchtNo_SM4', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('88', '9070', 'productNo_SM4', 'productNo_SM4', 'productNo_SM4', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('83', '9070', 'publicKey_SM4', 'publicKey_SM4', '值请填写 公钥 ', '2021-10-10 21:25:46', '0'); - * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) - * VALUES ('84', '9070', 'privateKey_SM4', 'privateKey_SM4', '值请填写 私钥 ', '2021-10-10 21:25:46', '0'); - * // 以下数据先查询是否存在 存在则修改 不存在添加 - * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) - * VALUES ('WECHAT', '被扫支付厂家', 'PAY_QR_ADAPT', 'qrCodeBbgPaymentAdapt', '', '2023-02-18 18:47:14', '0'); - *
- * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) - * VALUES ('WECHAT', '线上支付厂家', 'PAYMENT_ADAPT', 'bbgPaymentFactoryAdapt', '', '2023-02-18 18:47:14', '0'); - */ -@Service("bbgPaymentFactoryAdapt") -public class BbgPaymentFactoryAdapt implements IPaymentFactoryAdapt { - - private static final Logger logger = LoggerFactory.getLogger(BbgPaymentFactoryAdapt.class); - - - //微信支付 - public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; - // 微信服务商支付开关 - public static final String WECHAT_SERVICE_PAY_SWITCH = "WECHAT_SERVICE_PAY_SWITCH"; - - //开关ON打开 - public static final String WECHAT_SERVICE_PAY_SWITCH_ON = "ON"; - - - private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; - - private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; - - public static final String TRADE_TYPE_NATIVE = "NATIVE"; - public static final String TRADE_TYPE_JSAPI = "JSAPI"; - public static final String TRADE_TYPE_MWEB = "MWEB"; - public static final String TRADE_TYPE_APP = "APP"; - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/WxGzhPay"; - - @Autowired - private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; - - - @Autowired - private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; - - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - - @Override - public Map java110Payment(PaymentOrderDto paymentOrderDto, JSONObject reqJson, ICmdDataFlowContext context) throws Exception { - - SmallWeChatDto smallWeChatDto = getSmallWechat(reqJson); - String paymentPoolId = reqJson.getString("paymentPoolId"); - - - String appId = context.getReqHeaders().get("app-id"); - String userId = context.getReqHeaders().get("user-id"); - String tradeType = reqJson.getString("tradeType"); - String notifyUrl = UrlCache.getOwnerUrl() + "/app/payment/notify/wechat/992020011134400001/" + paymentPoolId; - - String openId = reqJson.getString("openId"); - - - if (StringUtil.isEmpty(openId)) { - String appType = OwnerAppUserDto.APP_TYPE_WECHAT_MINA; - if (AppDto.WECHAT_OWNER_APP_ID.equals(appId)) { - appType = OwnerAppUserDto.APP_TYPE_WECHAT; - } else if (AppDto.WECHAT_MINA_OWNER_APP_ID.equals(appId)) { - appType = OwnerAppUserDto.APP_TYPE_WECHAT_MINA; - } else { - appType = OwnerAppUserDto.APP_TYPE_APP; - } - - OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); - ownerAppUserDto.setUserId(userId); - ownerAppUserDto.setAppType(appType); - List ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); - - if (ownerAppUserDtos == null || ownerAppUserDtos.size() < 1) { - throw new IllegalArgumentException("未找到开放账号信息"); - } - openId = ownerAppUserDtos.get(0).getOpenId(); - } - - - logger.debug("【小程序支付】 统一下单开始, 订单编号=" + paymentOrderDto.getOrderId()); - SortedMap resultMap = new TreeMap(); - //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 - double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV"), paymentOrderDto.getMoney()); - //添加或更新支付记录(参数跟进自己业务需求添加) - - Map resMap = null; - resMap = this.java110UnifieldOrder(paymentOrderDto.getName(), - paymentOrderDto.getOrderId(), - tradeType, - payAmount, - openId, - smallWeChatDto, - paymentPoolId, - notifyUrl - ); - - - return resMap; - } - - - private Map java110UnifieldOrder(String feeName, String orderNum, - String tradeType, double payAmount, String openid, - SmallWeChatDto smallWeChatDto, - String paymentPoolId, - String notifyUrl) throws Exception { - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String productNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "productNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - - - if (feeName.length() > 127) { - feeName = feeName.substring(0, 126); - } - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("product_no", productNo_SM4);// 产品编号 - params.put("biz_type", "WX_GZH");// 业务类型 - params.put("tran_no", orderNum);// 商户流水 - params.put("code", "");// 授权码 - params.put("openid", openid);// 用户标识id - params.put("appid", smallWeChatDto.getAppId());// 公众号appid - params.put("amt", payAmount);// 交易金额 - params.put("ware_name", feeName);// 商品名称 - params.put("ware_describe", "");// 商户数据包 - params.put("asyn_url", notifyUrl + "?wId=" + WechatFactory.getWId(smallWeChatDto.getAppId()));// 通知地址 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, gzhPayUrl, params); - JSONObject paramOut = JSONObject.parseObject(decryParams); - if (!"SUCCESS".equals(paramOut.getString("status")) - || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - if (!"0000".equals(paramOut.getString("return_code")) - && !"0001".equals(paramOut.getString("return_code")) - ) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - SortedMap resultMap = new TreeMap(); - resultMap.put("appId", paramOut.getString("appId")); - resultMap.put("timeStamp", paramOut.getString("timeStamp")); - resultMap.put("nonceStr", paramOut.getString("nonceStr")); - resultMap.put("package", paramOut.getString("package")); - resultMap.put("signType", paramOut.getString("signType")); - resultMap.put("sign", paramOut.getString("paySign")); - resultMap.put("code", "0"); - resultMap.put("msg", "下单成功"); - doSaveOnlinePay(smallWeChatDto, openid, orderNum, feeName, payAmount, OnlinePayDto.STATE_WAIT, "待支付",paymentPoolValueDtos.get(0).getPpId()); - - return resultMap; - } - - - @Override - public PaymentOrderDto java110NotifyPayment(NotifyPaymentOrderDto notifyPaymentOrderDto) { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(notifyPaymentOrderDto.getPaymentPoolId()); - paymentPoolValueDto.setCommunityId(notifyPaymentOrderDto.getCommunityId()); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - String privateKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "privateKey_SM4"); - - - String resXml = ""; - String param = notifyPaymentOrderDto.getParam(); - PaymentOrderDto paymentOrderDto = new PaymentOrderDto(); - // 开始解密 - Map responseParams = JsonUtil.jsonToMap(param); - if (!responseParams.containsKey("enc_data")) { - System.err.println("通知失败"); - throw new IllegalArgumentException("通知失败"); - } - String decryptStr = (String) responseParams.get("enc_data"); - String messageKey = (String) responseParams.get("message_key"); - String secretKey = GmUtil.decryptSm2(messageKey, privateKey_SM4); - if (secretKey == null) { - System.err.println("解密失败"); - throw new IllegalArgumentException("解密失败"); - } - String decryParams = GmUtil.decryptSm4(decryptStr, secretKey); - - System.out.println("支付结果返回值(解密后):" + decryParams); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - String outTradeNo = paramOut.get("tran_no").toString(); - paymentOrderDto.setOrderId(outTradeNo); - paymentOrderDto.setTransactionId(paramOut.get("txn_no").toString()); - - doUpdateOnlinePay(outTradeNo, OnlinePayDto.STATE_COMPILE, "支付成功"); - - JSONObject resJson = new JSONObject(); - resJson.put("return_code", "SUCCESS"); - resJson.put("return message", "成功"); - - paymentOrderDto.setResponseEntity(new ResponseEntity(resJson.toJSONString(), HttpStatus.OK)); - return paymentOrderDto; - } - - private SmallWeChatDto getSmallWechat(JSONObject paramIn) { - - SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - smallWeChatDto.setAppId(paramIn.getString("appId")); - smallWeChatDto.setPage(1); - smallWeChatDto.setRow(1); - List smallWeChatDtos = smallWechatV1InnerServiceSMOImpl.querySmallWechats(smallWeChatDto); - - if (smallWeChatDtos == null || smallWeChatDtos.size() < 1) { - smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId")); - smallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret")); - smallWeChatDto.setObjId(paramIn.getString("communityId")); - - return smallWeChatDto; - } - - return BeanConvertUtil.covertBean(smallWeChatDtos.get(0), SmallWeChatDto.class); - } - - - private void doUpdateOnlinePay(String orderId, String state, String message) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setState(state); - onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); - } - - private void doSaveOnlinePay(SmallWeChatDto smallWeChatDto, String openId, String orderId, String feeName, - double money, String state, String message, - String ppId) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setAppId(smallWeChatDto.getAppId()); - onlinePayPo.setMchId(smallWeChatDto.getMchId()); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOpenId(openId); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setPayId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); - onlinePayPo.setPayName(feeName); - onlinePayPo.setRefundFee("0"); - onlinePayPo.setState(state); - onlinePayPo.setTotalFee(money + ""); - onlinePayPo.setTransactionId(orderId); - onlinePayPo.setPaymentPoolId(ppId); - onlinePayV1InnerServiceSMOImpl.saveOnlinePay(onlinePayPo); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java deleted file mode 100644 index 4195f0e6d4..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/BbgRefundMoneyAdapt.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.payment.IRefundMoneyAdapt; -import com.java110.core.client.FtpUploadTemplate; -import com.java110.core.client.OssUploadTemplate; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.factory.PlutusFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.paymentPool.PaymentPoolDto; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.intf.acct.IOnlinePayRefundV1InnerServiceSMO; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.fee.IReturnPayFeeInnerServiceSMO; -import com.java110.intf.order.IOrderInnerServiceSMO; -import com.java110.intf.store.ISmallWechatV1InnerServiceSMO; -import com.java110.utils.util.PayUtil; -import com.java110.vo.ResultVo; -import org.bouncycastle.util.encoders.Base64; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service("bbgRefundMoney") -public class BbgRefundMoneyAdapt implements IRefundMoneyAdapt { - - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String refundUrl = "https://mbank.bankofbbg.com/www/corepaycer/Refund";// 退款地址 - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - @Autowired - private IReturnPayFeeInnerServiceSMO returnPayFeeInnerServiceSMOImpl; - - @Autowired - private IOrderInnerServiceSMO orderInnerServiceSMOImpl; - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Autowired - private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - - private static Logger logger = LoggerFactory.getLogger(BbgRefundMoneyAdapt.class); - - @Autowired - private FtpUploadTemplate ftpUploadTemplate; - - @Autowired - private OssUploadTemplate ossUploadTemplate; - - @Autowired - private IOnlinePayRefundV1InnerServiceSMO onlinePayRefundV1InnerServiceSMOImpl; - - @Override - public ResultVo refund(OnlinePayDto onlinePayDto, PaymentPoolDto paymentPoolDto) throws Exception { - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolDto.getPpId()); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String tranNo = GenerateCodeFactory.getGeneratorId("11"); - - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("tran_no", tranNo);// 商户流水 - params.put("org_tran_no", onlinePayDto.getOrderId());// 原平台流水 - params.put("device_ip", "172.0.0.1");// 设备发起交易IP - params.put("amt", onlinePayDto.getRefundFee());// 交易金额 - params.put("ware_name", onlinePayDto.getPayName());// 摘要备注 - - // 对准备加签参数排序 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, refundUrl, params); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - if ( !"SUCCESS".equals(paramOut.getString("status")) || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - return new ResultVo(ResultVo.CODE_ERROR, "退款失败" + paramOut.getString("return_message")); - } - if ( !"0000".equals(paramOut.getString("return_code")) && !"0001".equals(paramOut.getString("return_code"))) { - return new ResultVo(ResultVo.CODE_ERROR, "退款失败" + paramOut.getString("return_message")); - } - if("0001".equals(paramOut.getString("return_code"))){ - return new ResultVo(ResultVo.CODE_OK, paramOut.getString("return_message")); - - } - return new ResultVo(ResultVo.CODE_OK, "退款完成"); - - - } - - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java deleted file mode 100644 index 1babfd803b..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/EncryptDecryptFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.java110.acct.payment.adapt.bbgpay.lib.GmUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.HttpRequestUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.JsonUtil; -import com.java110.core.factory.CommunitySettingFactory; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class EncryptDecryptFactory { - - - public static String execute(List paymentPoolValueDtos, String url, Map params){ - String decrypt = ""; - try { - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - // 格式为json - String json = JsonUtil.mapToJson(params); - System.out.println("加密前:" + json); - // 报文加密 - String secretKey = GmUtil.generateSm4Key(); - String encrypt = GmUtil.encryptSm4(json, secretKey); - System.out.println("加密后:" + encrypt); - - Map signParams = new HashMap<>(); - signParams.put("mcht_no", mchtNo_SM4);// 收款商户编号 - signParams.put("sign_type", "SM4"); - signParams.put("message_key", GmUtil.encryptSm2(secretKey, publicKey_SM4));// 密钥加密 - signParams.put("enc_data", encrypt);// 加密后请求参数 - - String requestParams = JsonUtil.mapToJson(signParams); - System.out.println("最终请求参数:" + requestParams); - System.err.println(""); - String returnResult = HttpRequestUtil.httpPost(url, requestParams); - System.out.println("支付结果返回值(原文):" + returnResult); - if (returnResult == null) { - System.err.println("通道响应异常"); - throw new IllegalArgumentException("通道响应异常"); - - } - // 开始解密 - Map responseParams = JsonUtil.jsonToMap(returnResult); - if (!responseParams.containsKey("enc_data")) { - System.err.println("交易失败-->" + responseParams.get("return_code") + ":" + responseParams.get("return_message")); - throw new IllegalArgumentException("交易失败-->" + responseParams.get("return_code") + ":" + responseParams.get("return_message")); - } - String decryptStr = (String) responseParams.get("enc_data"); - - decrypt = GmUtil.decryptSm4(decryptStr, secretKey); - if (decrypt == null) { - System.err.println("解密失败"); - throw new IllegalArgumentException("解密失败"); - } - System.out.println("支付结果返回值(解密后):" + decrypt); - }catch (Exception e){ - e.printStackTrace(); - throw new IllegalArgumentException(e.getMessage()); - } - return decrypt; - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java deleted file mode 100644 index 2f0e953c77..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/QrCodeBbgPaymentAdapt.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay; - -import com.alibaba.fastjson.JSONObject; -import com.java110.acct.smo.IQrCodePaymentSMO; -import com.java110.core.client.RestTemplate; -import com.java110.core.factory.GenerateCodeFactory; -import com.java110.core.log.LoggerFactory; -import com.java110.dto.paymentPoolValue.PaymentPoolValueDto; -import com.java110.dto.wechat.OnlinePayDto; -import com.java110.dto.wechat.SmallWeChatDto; -import com.java110.intf.acct.IOnlinePayV1InnerServiceSMO; -import com.java110.intf.acct.IPaymentPoolValueV1InnerServiceSMO; -import com.java110.intf.store.ISmallWeChatInnerServiceSMO; -import com.java110.po.wechat.OnlinePayPo; -import com.java110.utils.cache.MappingCache; -import com.java110.utils.constant.MappingConstant; -import com.java110.utils.constant.WechatConstant; -import com.java110.utils.util.PayUtil; -import com.java110.vo.ResultVo; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; - -/** - * 微信支付 - */ -@Service -public class QrCodeBbgPaymentAdapt implements IQrCodePaymentSMO { - private static Logger logger = LoggerFactory.getLogger(QrCodeBbgPaymentAdapt.class); - - //微信支付 - public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; - // 微信服务商支付开关 - public static final String WECHAT_SERVICE_PAY_SWITCH = "WECHAT_SERVICE_PAY_SWITCH"; - - //开关ON打开 - public static final String WECHAT_SERVICE_PAY_SWITCH_ON = "ON"; - - - private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; - - private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; - - private static String VERSION = "1.0"; - - private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 - - private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/ScanCodePay"; - - private static String queryUrl = "https://mbank.bankofbbg.com/www/corepaycer/QueryTxnInfo";// 交易查询地址 - - @Autowired - private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl; - - @Autowired - private RestTemplate outRestTemplate; - - @Autowired - private IPaymentPoolValueV1InnerServiceSMO paymentPoolValueV1InnerServiceSMOImpl; - - @Autowired - private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; - - @Override - public ResultVo pay(String communityId, String orderNum, double money, String authCode, String feeName, String paymentPoolId) throws Exception { - logger.info("【小程序支付】 统一下单开始, 订单编号=" + orderNum); - SortedMap resultMap = new TreeMap(); - //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 - double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV"), money); - //添加或更新支付记录(参数跟进自己业务需求添加) - - Map resMap = null; - logger.debug("resMap=" + resMap); - String systemName = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_GOOD_NAME); - SmallWeChatDto shopSmallWeChatDto = null; - SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); - smallWeChatDto.setObjId(communityId); - List smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); - if (smallWeChatDtos == null && smallWeChatDtos.size() < 1) { - shopSmallWeChatDto = new SmallWeChatDto(); - shopSmallWeChatDto.setObjId(communityId); - shopSmallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId")); - shopSmallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret")); - } else { - shopSmallWeChatDto = smallWeChatDtos.get(0); - } - - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - String productNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "productNo_SM4"); - String publicKey_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "publicKey_SM4"); - - - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("product_no", productNo_SM4);// 产品编号 - params.put("tran_no", orderNum);// 商户流水 - params.put("auth_code", authCode);// 码类型 - params.put("amt", payAmount);// 交易金额 - params.put("ware_name", feeName);// 商品名称 - params.put("device_ip", "172.0.0.1");// 商户数据包 - params.put("recog_no", "123123");// 交易终端编号 - doSaveOnlinePay(shopSmallWeChatDto, "-1", orderNum, feeName, payAmount, OnlinePayDto.STATE_WAIT, "待支付",paymentPoolValueDtos.get(0).getPpId()); - - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, gzhPayUrl, params); - - JSONObject paramOut = JSONObject.parseObject(decryParams); - if (!"0000".equals(paramOut.getString("return_code")) - || !"SUCCESS".equals(paramOut.getString("status")) - ) { - return new ResultVo(ResultVo.CODE_ERROR, "支付失败" + paramOut.getString("return_message")); - - } - - if ("FAIL".equals(paramOut.getString("deal_status"))) { - return new ResultVo(ResultVo.CODE_ERROR, "业务失败"); - } - - if ("SUCCESS".equals(paramOut.getString("deal_status"))) { - doUpdateOnlinePay(orderNum, OnlinePayDto.STATE_COMPILE, "支付成功"); - - return new ResultVo(ResultVo.CODE_OK, "成功"); - } else { - return new ResultVo(ResultVo.CODE_ERROR, "等待用户支付中"); - } - } - - public ResultVo checkPayFinish(String communityId, String orderNum, String paymentPoolId) { - Map result = null; - PaymentPoolValueDto paymentPoolValueDto = new PaymentPoolValueDto(); - paymentPoolValueDto.setPpId(paymentPoolId); - paymentPoolValueDto.setCommunityId(communityId); - List paymentPoolValueDtos = paymentPoolValueV1InnerServiceSMOImpl.queryPaymentPoolValues(paymentPoolValueDto); - - - if (paymentPoolValueDtos == null || paymentPoolValueDtos.isEmpty()) { - throw new IllegalArgumentException("配置错误,未配置参数"); - } - String mchtNo_SM4 = PaymentPoolValueDto.getValue(paymentPoolValueDtos, "mchtNo_SM4"); - Map params = new HashMap<>(); - params.put("version", VERSION);// 版本号 1.0 - params.put("mcht_no", mchtNo_SM4);// 收款商户编号 - params.put("tran_no", orderNum);// 商户流水 - params.put("txn_no", "");// 支付流水 - - // 对准备加签参数排序 - String decryParams = EncryptDecryptFactory.execute(paymentPoolValueDtos, queryUrl, params); - - /** - * {"amt":"0.01","deal_status":"PROCESSING","jump_url":"","mcht_name":"广西蓉慧科技有限公司","mcht_no":"MCT2023060100029734", - * "real_amt":"0.01","return_code":"5019","return_message":"用户正在输入密码,请等待","status":"SUCCESS", - * "tran_no":"962023092519710062","txn_date":"20230925", - * "txn_no":"P11082023092523543816778858","txn_time":"235438","ware_name":"云星花园-1栋1单元101室-住宅物业费"} - */ - JSONObject paramOut = JSONObject.parseObject(decryParams); - - if ("PROCESSING".equals(paramOut.getString("deal_status")) && "5019".equals(paramOut.getString("return_code"))) { - return new ResultVo(ResultVo.CODE_WAIT_PAY, "等待支付完成"); - } - - if (!"SUCCESS".equals(paramOut.getString("status")) - || !"SUCCESS".equals(paramOut.getString("deal_status"))) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - - if (!"0000".equals(paramOut.getString("return_code")) - && !"0001".equals(paramOut.getString("return_code")) - ) { - throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); - } - - if ("0000".equals(paramOut.getString("return_code"))) { - doUpdateOnlinePay(orderNum, OnlinePayDto.STATE_COMPILE, "支付成功"); - return new ResultVo(ResultVo.CODE_OK, "成功"); - } else { - return new ResultVo(ResultVo.CODE_WAIT_PAY, "等待支付完成"); - } - } - - private void doSaveOnlinePay(SmallWeChatDto smallWeChatDto, String openId, String orderId, String feeName, - double money, String state, String message, - String ppId) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setAppId(smallWeChatDto.getAppId()); - onlinePayPo.setMchId(smallWeChatDto.getMchId()); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOpenId(openId); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setPayId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); - onlinePayPo.setPayName(feeName); - onlinePayPo.setRefundFee("0"); - onlinePayPo.setState(state); - onlinePayPo.setTotalFee(money + ""); - onlinePayPo.setTransactionId(orderId); - onlinePayPo.setPaymentPoolId(ppId); - onlinePayV1InnerServiceSMOImpl.saveOnlinePay(onlinePayPo); - } - - private void doUpdateOnlinePay(String orderId, String state, String message) { - OnlinePayPo onlinePayPo = new OnlinePayPo(); - onlinePayPo.setMessage(message.length() > 1000 ? message.substring(0, 1000) : message); - onlinePayPo.setOrderId(orderId); - onlinePayPo.setState(state); - onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java deleted file mode 100644 index 788f7c254e..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/AesEncrypt.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.security.Security; -import java.security.spec.AlgorithmParameterSpec; - -import javax.crypto.Cipher; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; - -import com.alibaba.fastjson.JSONObject; - -/** - * aes 加解密相关工具类 - * - * @author bbw - * - */ -public class AesEncrypt { - public final static String ivParameter = "0000000000000000"; - private static final String CHARSET_NAME_UTF8 = "UTF-8"; - - static { - Security.addProvider(new BouncyCastleProvider()); - Security.setProperty("crypto.policy", "unlimited"); - } - - public static String encrypt(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return Base64Util.encode(encrypted); - } - - public static byte[] encryptByte(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return encrypted; - } - - public static byte[] encryptByte(String sSrc, String encodingFormat, byte[] raw) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes(encodingFormat)); - return encrypted; - } - - public static String decrypt(String sSrc, String encodingFormat, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - try { - byte[] raw = sKey.getBytes("ASCII"); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); - byte[] encrypted1 = Base64Util.decode(sSrc); - byte[] original = cipher.doFinal(encrypted1); - String originalString = new String(original, encodingFormat); - return originalString; - } catch (Exception ex) { - return null; - } - } - - public static byte[] decryptByte(byte[] bt, String sKey) throws Exception { - Security.addProvider(new BouncyCastleProvider()); - try { - byte[] raw = sKey.getBytes(); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); - byte[] original = cipher.doFinal(bt); - return original; - } catch (Exception ex) { - return null; - } - } - - public static String parseByte2HexStr(byte buf[]) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < buf.length; i++) { - String hex = Integer.toHexString(buf[i] & 0xFF); - if (hex.length() == 1) { - hex = '0' + hex; - } - sb.append(hex.toUpperCase()); - } - return sb.toString(); - } - - public static byte[] parseHexStr2Byte(String hexStr) { - if (hexStr.length() < 1) - return null; - byte[] result = new byte[hexStr.length() / 2]; - for (int i = 0; i < hexStr.length() / 2; i++) { - int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); - int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); - result[i] = (byte) (high * 16 + low); - } - return result; - } - - // 法院一案一户加密 - public static String ocoaEncrypt(String content, String aesKey, String aesIV) throws Exception { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec keySpec = new SecretKeySpec(aesKey.getBytes(CHARSET_NAME_UTF8), "AES"); - AlgorithmParameterSpec paramSpec = new IvParameterSpec(aesIV.getBytes()); - cipher.init(Cipher.ENCRYPT_MODE, keySpec, paramSpec); - byte[] result = cipher.doFinal(content.getBytes(CHARSET_NAME_UTF8)); - return URLEncoder.encode(Base64Util.encode(result), "UTF-8"); - } - - // 法院一案一户解密 - public static String ocoaDecrypt(String content, String aesKey, String aesIV) throws Exception { - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - SecretKeySpec keySpec = new SecretKeySpec(aesKey.getBytes(CHARSET_NAME_UTF8), "AES"); - AlgorithmParameterSpec paramSpec = new IvParameterSpec(aesIV.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, keySpec, paramSpec); - return new String(cipher.doFinal(Base64Util.decode(URLDecoder.decode(content, "UTF-8"))), CHARSET_NAME_UTF8); - } catch (Exception e) { - e.printStackTrace(); - } - return ""; - } - - /** - * 异或运算 - * - */ - public static String strEncAndDec(String src) { - // 字符串转成字符数组 - char[] c = src.toCharArray(); - // 循环给字符数组加密 - for (int i = 0; i < c.length; i++) { - c[i] = (char) (c[i] ^ 1); - } - return new String(c); - } - - public static void main(String[] args) throws Exception { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("ZH", "0003999"); - jsonObject.put("AH", ""); - String content = JSONObject.toJSONString(jsonObject); - String s1 = ocoaEncrypt(content, "2021YHSYSHYAKXTK", "2021YHSYSHYAKXTV"); - System.out.println("密文:" + s1); - String result = ocoaDecrypt(s1, "2021YHSYSHYAKXTK", "2021YHSYSHYAKXTV"); - System.out.println("解密:" + result); - System.out.println(14584308/16415104f); - - String authCode = "990000003458LBU3133170411108125"; - System.out.println("付款码:" + authCode); - String mchtNo = authCode.substring(12); - System.out.println("第13位开始截取:" + mchtNo); - System.out.println("企业商户号:" + strEncAndDec(mchtNo)); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java deleted file mode 100644 index c8253b6370..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/Base64Util.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import org.apache.commons.codec.binary.Base64; - -/** - * - * BASE64编码解码工具包 - */ -public class Base64Util { - - /** - * - * BASE64字符串解码为二进制数据 - * - * - * @param base64 - * @return - * @throws Exception - */ - public static byte[] decode(String base64) throws Exception { - return Base64.decodeBase64(base64.getBytes()); - } - - /** - * - * 二进制数据编码为BASE64字符串 - * - * - * @param bytes - * @return - * @throws Exception - */ - public static String encode(byte[] bytes) throws Exception { - return new String(Base64.encodeBase64(bytes)); - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java deleted file mode 100644 index 6b7dda6233..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/CAUtil.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.security.KeyFactory; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.Signature; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.Enumeration; - -import org.apache.commons.codec.binary.Base64; - -/** - * 验证证书公共类 - * - */ -public class CAUtil { - private static final String DEFAULT_CHARSET = "UTF-8"; - private static final String KEY_ALGORITHM = "RSA"; - private static final String SIGNATURE_ALGORITHM = "SHA256withRSA"; - - /** - * 判断字符串是否为null或空 true为空 - */ - public static boolean isNullOrEmpty(String str) { - return (str == null || str.length() == 0); - } - - // 获取私钥 - public static PrivateKey getPrivateKey(InputStream is, String privateKeyPwd) throws Exception { - KeyStore ks; - try { - ks = KeyStore.getInstance("PKCS12"); - char[] nPassword = null; - if (isNullOrEmpty(privateKeyPwd)) { - privateKeyPwd = null; - } else { - nPassword = privateKeyPwd.toCharArray(); - } - ks.load(is, nPassword); - is.close(); - Enumeration> enumas = ks.aliases(); - String keyAlias = null; - if (enumas.hasMoreElements()) { - keyAlias = (String) enumas.nextElement(); - } - PrivateKey prikey = (PrivateKey) ks.getKey(keyAlias, nPassword); - return prikey; - } catch (KeyStoreException e) { - throw new Exception("获取KeyStore失败"); - } catch (FileNotFoundException e) { - throw new Exception("无效的私钥地址"); - } catch (NoSuchAlgorithmException e) { - throw new Exception("读取私钥失败"); - } catch (CertificateException e) { - throw new Exception("加载证书失败"); - } catch (IOException e) { - throw new Exception("读取证书失败"); - } catch (UnrecoverableKeyException e) { - throw new Exception("获取私钥失败"); - } - } - - // 获取公钥 - public static PublicKey getPublicKey(String publicKeyAddr) throws Exception { - try { - CertificateFactory certificatefactory = CertificateFactory.getInstance("X.509"); - FileInputStream bais = new FileInputStream(publicKeyAddr); - X509Certificate Cert = (X509Certificate) certificatefactory.generateCertificate(bais); - bais.close(); - PublicKey pk = Cert.getPublicKey(); - return pk; - } catch (CertificateException e) { - throw new Exception("获取公钥失败"); - } - } - - /** - * RSA签名 - * - * @param localPrivKey - * 私钥 - * @param plaintext - * 需要签名的信息 - * @return byte[] - * @throws Exception - */ - public static byte[] signRSA(byte[] plainBytes, boolean useBase64Code, PrivateKey privKey) throws Exception { - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initSign(privKey); - signature.update(plainBytes); - // 如果是Base64编码的话,需要对签名后的数组以Base64编码 - if (useBase64Code) { - return Base64.encodeBase64(signature.sign()); - } else { - return signature.sign(); - } - } - - /** - * 验签操作 - * - * @param peerPubKey - * 公钥 - * @param plainBytes - * 需要验签的信息 - * @param signBytes - * 签名信息 - * @return boolean - */ - public static boolean verifyRSA(byte[] plainBytes, byte[] signBytes, boolean useBase64Code, PublicKey pubKey) throws Exception { - boolean isValid = false; - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initVerify(pubKey); - signature.update(plainBytes); - // 如果是Base64编码的话,需要对验签的数组以Base64解码 - if (useBase64Code) { - isValid = signature.verify(Base64.decodeBase64(signBytes)); - } else { - isValid = signature.verify(signBytes); - } - return isValid; - } - - /** - * SHA256withRSA签名(RSA2) - * - */ - public static String rsa256Sign(String content, String charset, String privateKey) throws Exception { - if (isNullOrEmpty(charset)) { - charset = DEFAULT_CHARSET; - } - if (isNullOrEmpty(privateKey)) { - return null; - } - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - byte[] encodedKey = StreamUtil.readText(new ByteArrayInputStream(privateKey.getBytes())).getBytes(); - encodedKey = Base64.decodeBase64(encodedKey); - PrivateKey priKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(encodedKey)); - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initSign(priKey); - if (isNullOrEmpty(charset)) { - signature.update(content.getBytes()); - } else { - signature.update(content.getBytes(charset)); - } - byte[] signed = signature.sign(); - return new String(Base64.encodeBase64(signed)); - } - - /** - * SHA256withRSA验签(RSA2) - * - */ - public static boolean rsa256Verify(byte[] content, String sign, String publicKey) throws Exception { - if (isNullOrEmpty(publicKey)) { - return false; - } - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - StringWriter writer = new StringWriter(); - StreamUtil.io(new InputStreamReader(new ByteArrayInputStream(publicKey.getBytes())), writer); - byte[] encodedKey = writer.toString().getBytes(); - encodedKey = Base64.decodeBase64(encodedKey); - PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initVerify(pubKey); - signature.update(content); - return signature.verify(Base64.decodeBase64(sign.getBytes())); - } -} \ No newline at end of file diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java deleted file mode 100644 index c85b4f2c68..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/GmUtil.java +++ /dev/null @@ -1,311 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import javax.crypto.Cipher; -import javax.crypto.KeyGenerator; -import javax.crypto.spec.SecretKeySpec; - -import java.math.BigInteger; -import java.security.Key; -import java.security.KeyFactory; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.SecureRandom; -import java.security.Security; -import java.security.Signature; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; - -import org.bouncycastle.asn1.gm.GMNamedCurves; -import org.bouncycastle.asn1.gm.GMObjectIdentifiers; -import org.bouncycastle.asn1.x9.X9ECParameters; -import org.bouncycastle.crypto.engines.SM2Engine; -import org.bouncycastle.crypto.params.ECDomainParameters; -import org.bouncycastle.crypto.params.ECPrivateKeyParameters; -import org.bouncycastle.crypto.params.ECPublicKeyParameters; -import org.bouncycastle.crypto.params.ParametersWithRandom; -import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey; -import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.jce.spec.ECParameterSpec; -import org.bouncycastle.jce.spec.ECPrivateKeySpec; -import org.bouncycastle.jce.spec.ECPublicKeySpec; -import org.bouncycastle.util.encoders.Hex; - -/** - * 国密加密算法 - */ -public class GmUtil { - private static final String DEFAULT_CHARSET = "UTF-8"; - public static final String ALGORITHM_NAME = "SM4"; - // 加密算法/分组加密模式/分组填充方式 - // PKCS5Padding-以8个字节为一组进行分组加密 - // 定义分组加密模式使用:PKCS5Padding - public static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS7Padding"; - // 128-32位16进制;256-64位16进制 - public static final int DEFAULT_KEY_SIZE = 128; - // 椭圆曲线ECParameters ASN.1 结构 - private static X9ECParameters x9ECParameters = GMNamedCurves.getByName("sm2p256v1"); - // 椭圆曲线公钥或私钥的基本域参数。 - private static ECParameterSpec ecDomainParameters = new ECParameterSpec(x9ECParameters.getCurve(), x9ECParameters.getG(), x9ECParameters.getN()); - - static { - Security.addProvider(new BouncyCastleProvider()); - } - - /** - * 将Base64转码的公钥串,转化为公钥对象 - * - */ - public static PublicKey createPublicKey(String publicKey) { - PublicKey publickey = null; - try { - X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(Base64Util.decode(publicKey)); - KeyFactory keyFactory = KeyFactory.getInstance("EC", new BouncyCastleProvider()); - publickey = keyFactory.generatePublic(publicKeySpec); - } catch (Exception e) { - e.printStackTrace(); - } - return publickey; - } - - /** - * 将Base64转码的私钥串,转化为私钥对象 - * - */ - public static PrivateKey createPrivateKey(String privateKey) { - PrivateKey publickey = null; - try { - PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64Util.decode(privateKey)); - KeyFactory keyFactory = KeyFactory.getInstance("EC", new BouncyCastleProvider()); - publickey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); - } catch (Exception e) { - e.printStackTrace(); - } - return publickey; - } - - /** - * 根据publicKey对原始数据data,使用SM2加密 - */ - public static byte[] encrypt(byte[] data, PublicKey publicKey) { - ECPublicKeyParameters localECPublicKeyParameters = null; - - if (publicKey instanceof BCECPublicKey) { - BCECPublicKey localECPublicKey = (BCECPublicKey) publicKey; - ECParameterSpec localECParameterSpec = localECPublicKey.getParameters(); - ECDomainParameters localECDomainParameters = new ECDomainParameters(localECParameterSpec.getCurve(), localECParameterSpec.getG(), localECParameterSpec.getN()); - localECPublicKeyParameters = new ECPublicKeyParameters(localECPublicKey.getQ(), localECDomainParameters); - } - SM2Engine localSM2Engine = new SM2Engine(); - localSM2Engine.init(true, new ParametersWithRandom(localECPublicKeyParameters, new SecureRandom())); - byte[] arrayOfByte2; - try { - arrayOfByte2 = localSM2Engine.processBlock(data, 0, data.length); - return arrayOfByte2; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 根据privateKey对加密数据encodedata,使用SM2解密 - */ - public static byte[] decrypt(byte[] encodedata, PrivateKey privateKey) { - SM2Engine localSM2Engine = new SM2Engine(); - BCECPrivateKey sm2PriK = (BCECPrivateKey) privateKey; - ECParameterSpec localECParameterSpec = sm2PriK.getParameters(); - ECDomainParameters localECDomainParameters = new ECDomainParameters(localECParameterSpec.getCurve(), localECParameterSpec.getG(), localECParameterSpec.getN()); - ECPrivateKeyParameters localECPrivateKeyParameters = new ECPrivateKeyParameters(sm2PriK.getD(), localECDomainParameters); - localSM2Engine.init(false, localECPrivateKeyParameters); - try { - byte[] arrayOfByte3 = localSM2Engine.processBlock(encodedata, 0, encodedata.length); - return arrayOfByte3; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 私钥签名 - */ - public static byte[] signByPrivateKey(byte[] data, PrivateKey privateKey) throws Exception { - Signature sig = Signature.getInstance(GMObjectIdentifiers.sm2sign_with_sm3.toString(), BouncyCastleProvider.PROVIDER_NAME); - sig.initSign(privateKey); - sig.update(data); - return sig.sign(); - } - - /** - * 公钥验签 - */ - public static boolean verifyByPublicKey(byte[] data, PublicKey publicKey, byte[] signature) throws Exception { - Signature sig = Signature.getInstance(GMObjectIdentifiers.sm2sign_with_sm3.toString(), BouncyCastleProvider.PROVIDER_NAME); - sig.initVerify(publicKey); - sig.update(data); - return sig.verify(signature); - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * @Description 公钥字符串转换为 BCECPublicKey 公钥对象 - * @param pubKeyHex - * 64字节十六进制公钥字符串(如果公钥字符串为65字节首个字节为0x04:表示该公钥为非压缩格式,操作时需要删除) - * @return BCECPublicKey SM2公钥对象 - */ - private static BCECPublicKey getECPublicKeyByPublicKeyHex(String pubKeyHex) { - // 截取64字节有效的SM2公钥(如果公钥首个字节为0x04) - if (pubKeyHex.length() > 128) { - pubKeyHex = pubKeyHex.substring(pubKeyHex.length() - 128); - } - // 将公钥拆分为x,y分量(各32字节) - String stringX = pubKeyHex.substring(0, 64); - String stringY = pubKeyHex.substring(stringX.length()); - // 将公钥x、y分量转换为BigInteger类型 - BigInteger x = new BigInteger(stringX, 16); - BigInteger y = new BigInteger(stringY, 16); - // 通过公钥x、y分量创建椭圆曲线公钥规范 - ECPublicKeySpec ecPublicKeySpec = new ECPublicKeySpec(x9ECParameters.getCurve().createPoint(x, y), ecDomainParameters); - // 通过椭圆曲线公钥规范,创建出椭圆曲线公钥对象(可用于SM2加密及验签) - return new BCECPublicKey("EC", ecPublicKeySpec, BouncyCastleProvider.CONFIGURATION); - } - - /** - * @Description 私钥字符串转换为 BCECPrivateKey 私钥对象 - * @param privateKeyHex - * 32字节十六进制私钥字符串 - * @return BCECPrivateKey SM2私钥对象 - */ - private static BCECPrivateKey getBCECPrivateKeyByPrivateKeyHex(String privateKeyHex) { - // 将十六进制私钥字符串转换为BigInteger对象 - BigInteger d = new BigInteger(privateKeyHex, 16); - // 通过私钥和私钥域参数集创建椭圆曲线私钥规范 - ECPrivateKeySpec ecPrivateKeySpec = new ECPrivateKeySpec(d, ecDomainParameters); - // 通过椭圆曲线私钥规范,创建出椭圆曲线私钥对象(可用于SM2解密和签名) - return new BCECPrivateKey("EC", ecPrivateKeySpec, BouncyCastleProvider.CONFIGURATION); - } - - /** - * @Description 公钥加密 - */ - public static String encryptSm2(String data, String publicKeyHex) { - BCECPublicKey publicKey = getECPublicKeyByPublicKeyHex(publicKeyHex); - // 加密模式 - SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2; - // 通过公钥对象获取公钥的基本域参数。 - ECParameterSpec ecParameterSpec = publicKey.getParameters(); - ECDomainParameters ecDomainParameters = new ECDomainParameters(ecParameterSpec.getCurve(), ecParameterSpec.getG(), ecParameterSpec.getN()); - // 通过公钥值和公钥基本参数创建公钥参数对象 - ECPublicKeyParameters ecPublicKeyParameters = new ECPublicKeyParameters(publicKey.getQ(), ecDomainParameters); - // 根据加密模式实例化SM2公钥加密引擎 - SM2Engine sm2Engine = new SM2Engine(mode); - // 初始化加密引擎 - sm2Engine.init(true, new ParametersWithRandom(ecPublicKeyParameters, new SecureRandom())); - byte[] arrayOfBytes = null; - try { - // 将明文字符串转换为指定编码的字节串 - byte[] in = Hex.decode(data); - // 通过加密引擎对字节数串行加密 - arrayOfBytes = sm2Engine.processBlock(in, 0, in.length); - } catch (Exception e) { - e.printStackTrace(); - } - // 将加密后的字节串转换为十六进制字符串 - return Hex.toHexString(arrayOfBytes).toUpperCase(); - } - - /** - * @Description 私钥解密 - */ - public static String decryptSm2(String cipherData, String privateKeyHex) { - BCECPrivateKey privateKey = getBCECPrivateKeyByPrivateKeyHex(privateKeyHex); - // 解密模式 - SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2; - // 将十六进制字符串密文转换为字节数组(需要与加密一致,加密是:加密后的字节数组转换为了十六进制字符串) - byte[] cipherDataByte = Hex.decode(cipherData); - // 通过私钥对象获取私钥的基本域参数。 - ECParameterSpec ecParameterSpec = privateKey.getParameters(); - ECDomainParameters ecDomainParameters = new ECDomainParameters(ecParameterSpec.getCurve(), ecParameterSpec.getG(), ecParameterSpec.getN()); - // 通过私钥值和私钥钥基本参数创建私钥参数对象 - ECPrivateKeyParameters ecPrivateKeyParameters = new ECPrivateKeyParameters(privateKey.getD(), ecDomainParameters); - // 通过解密模式创建解密引擎并初始化 - SM2Engine sm2Engine = new SM2Engine(mode); - sm2Engine.init(false, ecPrivateKeyParameters); - String result = null; - try { - // 通过解密引擎对密文字节串进行解密 - byte[] arrayOfBytes = sm2Engine.processBlock(cipherDataByte, 0, cipherDataByte.length); - result = new String(arrayOfBytes, "utf-8"); - } catch (Exception e) { - e.printStackTrace(); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * 自动生成sm4密钥 - * - */ - public static String generateSm4Key() throws Exception { - KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM_NAME, BouncyCastleProvider.PROVIDER_NAME); - kg.init(DEFAULT_KEY_SIZE, new SecureRandom()); - byte[] sm4Key = kg.generateKey().getEncoded(); - return new String(Hex.encode(sm4Key)).toUpperCase(); - } - - /** - * 生成ECB暗号 - * - */ - private static Cipher generateSm4Cipher(String algorithmName, int mode, byte[] key) throws Exception { - Cipher cipher = Cipher.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME); - Key sm4Key = new SecretKeySpec(key, ALGORITHM_NAME); - cipher.init(mode, sm4Key); - return cipher; - } - - /** - * sm4加密 - * - */ - public static String encryptSm4(String data, String hexKey) { - try { - // 16进制字符串-->byte[] - byte[] keyData = Hex.decode(hexKey); - // String-->byte[] - byte[] srcData = data.getBytes(DEFAULT_CHARSET); - // 加密后的数组 - Cipher cipher = generateSm4Cipher(ALGORITHM_NAME_ECB_PADDING, Cipher.ENCRYPT_MODE, keyData); - byte[] cipherArray = cipher.doFinal(srcData); - // byte[]-->hexString - return Hex.toHexString(cipherArray).toUpperCase(); - } catch (Exception e) { - return null; - } - } - - /** - * sm4解密 - * - */ - public static String decryptSm4(String cipherText, String hexKey) { - // 用于接收解密后的字符串 - String decryptStr = null; - // hexString-->byte[] - byte[] keyData = Hex.decode(hexKey); - // hexString-->byte[] - byte[] cipherData = Hex.decode(cipherText); - try { - // 解密 - Cipher cipher = generateSm4Cipher(ALGORITHM_NAME_ECB_PADDING, Cipher.DECRYPT_MODE, keyData); - byte[] srcData = cipher.doFinal(cipherData); - decryptStr = new String(srcData, DEFAULT_CHARSET); - } catch (Exception e) { - e.printStackTrace(); - } - return decryptStr; - } - -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java deleted file mode 100644 index ce4ce009a5..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/HttpRequestUtil.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLDecoder; - -import org.apache.http.HttpHost; -import org.apache.http.HttpResponse; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; - -/** - * http请求工具类 - * - * @author lizhongfu - * - */ -public class HttpRequestUtil { - private final static int connectTimeOut = 30000;// 连接超时时间 - private final static int readTimeOut = 30000;// 读超时时间 - - /** - * httpPost - * - * @param url 路径 - * @param jsonParam 参数 - * @return - */ - public static String httpPost(String url, String jsonParam) throws Exception { - return httpPost(url, jsonParam, false); - } - - /** - * post请求 - * - * @return - */ - public static String httpPost(String url, String jsonParam, boolean bUseProxy) throws Exception { - // post请求返回结果 - CloseableHttpClient client = HttpClients.createDefault(); - HttpPost method = new HttpPost(url); - String str = ""; - try { - RequestConfig config1 = null; - // 是否采用代理 - if (bUseProxy) { - // HttpHost proxy = new HttpHost("代理服务器IP", 代理服务器端口); - HttpHost proxy = new HttpHost("127.0.0.1", 8828); - config1 = RequestConfig.custom().setProxy(proxy).setConnectTimeout(connectTimeOut).setSocketTimeout(readTimeOut).build(); - } else { - config1 = RequestConfig.custom().setConnectTimeout(connectTimeOut).setSocketTimeout(readTimeOut).build(); - } - method.setConfig(config1); - if (null != jsonParam) { - // 解决中文乱码问题 - StringEntity entity = new StringEntity(jsonParam, "utf-8"); - entity.setContentEncoding("UTF-8"); - entity.setContentType("application/json"); - // entity.setContentType("application/x-www-form-urlencoded"); - method.setEntity(entity); - } - HttpResponse result = client.execute(method); - url = URLDecoder.decode(url, "UTF-8"); - /** 请求发送成功,并得到响应 **/ - if (result.getStatusLine().getStatusCode() == 200) { - /** 读取服务器返回过来的json字符串数据 **/ - // str = EntityUtils.toString(result.getEntity()); - str = EntityUtils.toString(result.getEntity(), "UTF-8"); - } - } catch (IOException e) { - System.err.println("网络异常:" + e.getMessage()); - // 网络异常 - throw e; - } catch (Exception e) { - System.err.println("系统错误:" + e.getMessage()); - throw e; - } - return str; - } - - /** - * 获取到下载的outputstream - * - * @param url - * @return - * @throws Exception - */ - public static ByteArrayOutputStream httpGetToStream(String url) throws Exception { - InputStream input = null; - CloseableHttpClient client = null; - try { - client = HttpClients.createDefault(); - // 发送get请求 - HttpGet request = new HttpGet(url); - HttpResponse response = client.execute(request); - input = response.getEntity().getContent(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buff = new byte[1024]; - int len; - while ((len = input.read(buff)) > -1) { - baos.write(buff, 0, len); - } - baos.flush(); - return baos; - } catch (Exception e) { - System.err.println("系统错误:" + e.getMessage()); - return null; - } finally { - input.close(); - client.close(); - } - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java deleted file mode 100644 index 45489939c2..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/JsonUtil.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.TypeReference; -import com.alibaba.fastjson.parser.Feature; -import com.alibaba.fastjson.serializer.SerializerFeature; - -public class JsonUtil { - /** - * 将json转化成map - * - * @param json - * @return - */ - public static Map jsonToMap(String json) { - try { - return JSON.parseObject(json, new TypeReference>() { - }, Feature.OrderedField); - } catch (Exception e) { - return new HashMap<>(); - } - - } - - /** - * 将map转化成json - * - * @param map - * @return - */ - public static String mapToJson(Map map) { - return JSON.toJSONString(map, SerializerFeature.WriteMapNullValue); - } - - public static String mapToJson2(Map map) throws Exception { - return JSON.toJSONString(map, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty); - } - - /** - * Json转Object - * - * @return - */ - public static T jsonToObject(Class clazz, String json) { - return JSON.parseObject(json, clazz); - } - - /** - * 对map 进行排序 - * - * @param map - * @return - */ - public static Map sortMapByKey(Map map) { - if (map == null || map.isEmpty()) { - return null; - } - Map sortMap = new TreeMap(new Comparator() { - - @Override - public int compare(String str0, String str1) { - return str0.compareTo(str1); - } - }); - sortMap.putAll(map); - return sortMap; - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java deleted file mode 100644 index 80405cdd80..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/lib/StreamUtil.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.java110.acct.payment.adapt.bbgpay.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; - -public class StreamUtil { - - public StreamUtil() { - - } - - public static void io(InputStream in, OutputStream out) throws IOException { - io((InputStream) in, (OutputStream) out, -1); - } - - public static void io(InputStream in, OutputStream out, int bufferSize) throws IOException { - if (bufferSize == -1) { - bufferSize = 8192; - } - - byte[] buffer = new byte[bufferSize]; - - int amount; - while ((amount = in.read(buffer)) >= 0) { - out.write(buffer, 0, amount); - } - - } - - public static void io(Reader in, Writer out) throws IOException { - io((Reader) in, (Writer) out, -1); - } - - public static void io(Reader in, Writer out, int bufferSize) throws IOException { - if (bufferSize == -1) { - bufferSize = 4096; - } - - char[] buffer = new char[bufferSize]; - - int amount; - while ((amount = in.read(buffer)) >= 0) { - out.write(buffer, 0, amount); - } - - } - - public static OutputStream synchronizedOutputStream(OutputStream out) { - return new SynchronizedOutputStream(out); - } - - public static OutputStream synchronizedOutputStream(OutputStream out, Object lock) { - return new SynchronizedOutputStream(out, lock); - } - - public static String readText(InputStream in) throws IOException { - return readText(in, (String) null, -1); - } - - public static String readText(InputStream in, String encoding) throws IOException { - return readText(in, encoding, -1); - } - - public static String readText(InputStream in, String encoding, int bufferSize) throws IOException { - Reader reader = encoding == null ? new InputStreamReader(in) : new InputStreamReader(in, encoding); - return readText(reader, bufferSize); - } - - public static String readText(Reader reader) throws IOException { - return readText(reader, -1); - } - - public static String readText(Reader reader, int bufferSize) throws IOException { - StringWriter writer = new StringWriter(); - io((Reader) reader, (Writer) writer, bufferSize); - return writer.toString(); - } - - private static class SynchronizedOutputStream extends OutputStream { - private OutputStream out; - private Object lock; - - SynchronizedOutputStream(OutputStream out) { - this(out, out); - } - - SynchronizedOutputStream(OutputStream out, Object lock) { - this.out = out; - this.lock = lock; - } - - public void write(int datum) throws IOException { - synchronized (this.lock) { - this.out.write(datum); - } - } - - public void write(byte[] data) throws IOException { - synchronized (this.lock) { - this.out.write(data); - } - } - - public void write(byte[] data, int offset, int length) throws IOException { - synchronized (this.lock) { - this.out.write(data, offset, length); - } - } - - public void flush() throws IOException { - synchronized (this.lock) { - this.out.flush(); - } - } - - public void close() throws IOException { - synchronized (this.lock) { - this.out.close(); - } - } - } -} diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java deleted file mode 100644 index a2c231d3a4..0000000000 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/bbgpay/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 该目录下存放北部湾银行 支付相关内容 - */ -package com.java110.acct.payment.adapt.bbgpay; \ No newline at end of file diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java index 071d043cf7..c981cc0a85 100644 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java +++ b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyPaymentFactoryAdapt.java @@ -2,9 +2,6 @@ import com.alibaba.fastjson.JSONObject; import com.java110.acct.payment.IPaymentFactoryAdapt; -import com.java110.acct.payment.adapt.bbgpay.EncryptDecryptFactory; -import com.java110.acct.payment.adapt.bbgpay.lib.GmUtil; -import com.java110.acct.payment.adapt.bbgpay.lib.JsonUtil; import com.java110.acct.payment.adapt.easypay.utils.HttpConnectUtils; import com.java110.core.context.ICmdDataFlowContext; import com.java110.core.factory.GenerateCodeFactory; diff --git a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java index 7b9d31e50b..a0a5426ad6 100644 --- a/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java +++ b/service-acct/src/main/java/com/java110/acct/payment/adapt/easypay/EasyRefundMoneyAdapt.java @@ -2,7 +2,6 @@ import com.alibaba.fastjson.JSONObject; import com.java110.acct.payment.IRefundMoneyAdapt; -import com.java110.acct.payment.adapt.bbgpay.EncryptDecryptFactory; import com.java110.acct.payment.adapt.easypay.utils.HttpConnectUtils; import com.java110.core.client.FtpUploadTemplate; import com.java110.core.client.OssUploadTemplate; From 0cf28cc0d41d154a6a9de3ff1a35664c2e0686a7 Mon Sep 17 00:00:00 2001 From: xuegao8848 Date: Mon, 2 Dec 2024 11:45:26 +0800 Subject: [PATCH 36/37] =?UTF-8?q?[fix]readcn=E4=B8=AD=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme_cn.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme_cn.md b/Readme_cn.md index 6e43eb0ac7..29bf48a717 100644 --- a/Readme_cn.md +++ b/Readme_cn.md @@ -2,8 +2,8 @@ ## 说明 HC小区管理系统是一套saas物业管理的系统,包括 房产、业主、 费用 (可以线上缴费)、报修(可以线上报修)、投诉建议、采购、巡检、停车、门径、道闸、监控、工作流、问卷和公告等功能。 -目前很多地方商用超过一年半时间 欢饮直接使用或者推广使用 - + 当前,众多地区已进入商用阶段达一年半之久,其应用成效已获充分验证,欢迎各界直接采用或广泛推广,携手共创更大价值与更优效益。 + 相关代码: 1、[物业系统前端](https://gitee.com/java110/MicroCommunityWeb) : 物业员工使用电脑端 2、[物业系统后端](https://gitee.com/wuxw7/MicroCommunity): 核心业务处理端 From 96f9d12c7e74054cfed1027c1ed38109e1ab2fc7 Mon Sep 17 00:00:00 2001 From: jxfzzzt <1160490625@qq.com> Date: Fri, 13 Dec 2024 21:02:15 +0800 Subject: [PATCH 37/37] update `com.alibaba:fastjson` from 1.2.83 to 2.0.53 and fix break change. --- pom.xml | 2 +- .../com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java | 4 ++-- .../java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java | 2 +- .../com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 52fc6432b7..fe4795911e 100755 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,7 @@ com.alibaba fastjson - 1.2.83 + 2.0.53 org.mybatis.spring.boot diff --git a/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java index c6693e88ed..36931f3da8 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/invoice/SaveInvoiceApplyCmd.java @@ -204,7 +204,7 @@ private BigDecimal computeFeeDetail(JSONObject reqJson, List } FeeDetailDto feeDetailDto = new FeeDetailDto(); - feeDetailDto.setDetailIds(detailIds.toArray(new String[detailIds.size()])); + feeDetailDto.setDetailIds((String[]) detailIds.toArray(new String[detailIds.size()])); feeDetailDto.setCommunityId(reqJson.getString("communityId")); List feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto); @@ -263,7 +263,7 @@ private BigDecimal computeAcctDetail(JSONObject reqJson, List accountReceiptDtos = accountReceiptV1InnerServiceSMOImpl.queryAccountReceipts(accountReceiptDto); if (accountReceiptDtos == null || accountReceiptDtos.isEmpty()) { diff --git a/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java index f6efd4eebc..43b129e6ef 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/payment/SavePaymentPoolCmd.java @@ -149,7 +149,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONOb } JSONArray configIds = reqJson.getJSONArray("configIds"); FeeConfigDto feeConfigDto = new FeeConfigDto(); - feeConfigDto.setConfigIds(configIds.toArray(new String[configIds.size()])); + feeConfigDto.setConfigIds((String[]) configIds.toArray(new String[configIds.size()])); feeConfigDto.setCommunityId(reqJson.getString("communityId")); List feeConfigDtos = payFeeConfigV1InnerServiceSMOImpl.queryPayFeeConfigs(feeConfigDto); diff --git a/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java index bd1527f63a..8cb9414da8 100644 --- a/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java +++ b/service-acct/src/main/java/com/java110/acct/cmd/payment/UpdatePaymentPoolCmd.java @@ -139,7 +139,7 @@ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONOb } JSONArray configIds = reqJson.getJSONArray("configIds"); FeeConfigDto feeConfigDto = new FeeConfigDto(); - feeConfigDto.setConfigIds(configIds.toArray(new String[configIds.size()])); + feeConfigDto.setConfigIds((String[]) configIds.toArray(new String[configIds.size()])); feeConfigDto.setCommunityId(reqJson.getString("communityId")); List feeConfigDtos = payFeeConfigV1InnerServiceSMOImpl.queryPayFeeConfigs(feeConfigDto);
- * BASE64编码解码工具包 - */ -public class Base64Util { - - /** - *
- * BASE64字符串解码为二进制数据 - *
- * 二进制数据编码为BASE64字符串 - *