diff --git a/.gitignore b/.gitignore index 4916f7a2..b10eb207 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ target/ *.iws *.iml *.ipr +rebel.xml ### NetBeans ### nbproject/private/ diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java index f33c5e73..e3187fb0 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java @@ -135,15 +135,18 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher { OrderMappingRepository orderMappingRepository, String operatorId) { EtOrderMapping etOrderMapping; - EtOrderMapping om = new EtOrderMapping(); + EtOrderMapping om; if (internetSerialNumber != null) { + om = new EtOrderMapping(); om.setEvcsOrderNo(internetSerialNumber); Example example = Example.of(om); etOrderMapping = orderMappingRepository.findOne(example).orElse(null); if (etOrderMapping == null) { + om.setXhOrderNo(xhOrderNo); etOrderMapping = orderMappingRepository.save(om); } } else { + om = new EtOrderMapping(); om.setXhOrderNo(xhOrderNo); Example example = Example.of(om); etOrderMapping = orderMappingRepository.findOne(example).orElse(null); diff --git a/pom.xml b/pom.xml index 9d913dd0..bf139940 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,13 @@ + + + javax.validation + validation-api + 2.0.1.Final + + org.springframework.cloud diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/model/LoginUser.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/model/LoginUser.java index cae15e70..49878ee4 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/model/LoginUser.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/model/LoginUser.java @@ -25,7 +25,7 @@ public class LoginUser implements Serializable private Long userid; /** - * 用户名 + * 用户账号(手机号、账号) */ private String username; diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/ServiceNameConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/ServiceNameConstants.java index 46038d44..01530427 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/ServiceNameConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/ServiceNameConstants.java @@ -54,4 +54,9 @@ public class ServiceNameConstants { */ public static final String XHPC_PAYMENT = "xhpc-payment"; + /** + * 卡服务 + */ + public static final String XHPC_CARD ="xhpc-card"; + } diff --git a/ruoyi-gateway/src/main/java/com/xhpc/gateway/filter/AuthFilter.java b/ruoyi-gateway/src/main/java/com/xhpc/gateway/filter/AuthFilter.java index 69394c89..8f9d1a46 100644 --- a/ruoyi-gateway/src/main/java/com/xhpc/gateway/filter/AuthFilter.java +++ b/ruoyi-gateway/src/main/java/com/xhpc/gateway/filter/AuthFilter.java @@ -37,7 +37,7 @@ public class AuthFilter implements GlobalFilter, Ordered { private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); - private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 60; + private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 600; // 排除过滤的 uri 地址,nacos自行添加 @Autowired diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java index b001f44c..6430a50e 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java @@ -11,6 +11,7 @@ import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.security.annotation.PreAuthorize; +import com.xhpc.common.util.UserTypeUtil; import com.xhpc.system.api.domain.SysRole; import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.model.LoginUser; @@ -107,6 +108,10 @@ public class SysUserController extends BaseController { sysUserVo.setTenantId(sysUser.getTenantId()); sysUserVo.setRoles(roles); sysUserVo.setPermissions(permissions); + sysUserVo.setUsername(username); + sysUserVo.setUserType(UserTypeUtil.USER_TYPE); + sysUserVo.setUserTypeUtil(UserTypeUtil.USER); + sysUserVo.setUserid(sysUser.getUserId()); return R.ok(sysUserVo); } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 8e553c57..679b6328 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -27,6 +27,7 @@ + diff --git a/sql/test-opsecret.sql b/sql/test-opsecret.sql new file mode 100644 index 00000000..b707aaa1 --- /dev/null +++ b/sql/test-opsecret.sql @@ -0,0 +1,24 @@ +INSERT INTO `ry-cloud`.et_auth_sec_token (name, operator_id, operator_id3irdpty, secret_token_type, token, token_expiry, + data_secret, data_secretiv, operator_secret, sig_secret, encrypt, url_prefix, + last_push_order, tenant_id) +VALUES ('成都市平台', 'MA6DFCTD5', '765367656', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU', + 'wAeYIVQUwd0iGZsV', 1, 'http://hlht.cd-test.zcsy-inc.cn/evcs/20160701', NULL, '000000'), + (NULL, 'MA6DFCTD5', '765367656', 'OUT', NULL, NULL, + '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU', 'wAeYIVQUwd0iGZsV', 1, + 'http://hlht.cd-test.zcsy-inc.cn/evcs/20160701', INTENDED, '000000'), + ('恒大', 'MA6DFCTD5', 'MA5FF58R7', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU', + 'wAeYIVQUwd0iGZsV', 1, 'http://119.23.185.48:9268/evcs/v1/', NULL, '000000'), + (NULL, 'MA6DFCTD5', 'MA5FF58R7', 'OUT', NULL, NULL, '134714FB204A2CD1', '134707EDE37275E7', 'B8E66A501605A3C0', + '218A622D09620801', 1, 'http://119.23.185.48:9268/evcs/v1/', NULL, '000000'), + ('快电', 'MA6DFCTD5', 'MA005DBW1', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU', + 'wAeYIVQUwd0iGZsV', 1, 'https://dev-charge-hub-ws-qq.gokuaidian.com/evcs/v1.0/', NULL, '000000'), + (NULL, 'MA6DFCTD5', 'MA005DBW1', 'OUT', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU', + 'wAeYIVQUwd0iGZsV', 1, 'https://dev-charge-hub-ws-qq.gokuaidian.com/evcs/v1.0/', NULL, '000000'), + ('新电途', 'MA6DFCTD5', 'MA25CNM38', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU', + 'wAeYIVQUwd0iGZsV', 1, 'https://test.evshine.net/icnin/evcs/v1.1/', NULL, '000000'), + (NULL, 'MA6DFCTD5', 'MA25CNM38', 'OUT', NULL, NULL, 'ojs67l46z3f7rhok', 'tet9swfkyojkhaos', '4t8jr80mrjjt2y7f', + '75ghv1ie1zzex31s', 1, 'https://test.evshine.net/icnin/evcs/v1.1/', NULL, '000000'), + ('小桔', 'MA6DFCTD5', '101437000', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU', + 'wAeYIVQUwd0iGZsV', 1, 'http://opendev.xiaojukeji.com/operatorplatform/', NULL, '000000'), + (NULL, 'MA6DFCTD5', '101437000', 'OUT', NULL, NULL, '618c8e506e798acf', 'ea0e7e1b8fb8a935', '7751a50aa41683f0', + '7b3b03fe94654e3b', 1, 'http://opendev.xiaojukeji.com/operatorplatform/', NULL, '000000'); diff --git a/sql/v2.1.sql b/sql/v2.1.sql index a1ce2890..3fbc485c 100644 --- a/sql/v2.1.sql +++ b/sql/v2.1.sql @@ -241,7 +241,7 @@ CREATE TABLE `xhpc_device_message` `type` varchar(50) DEFAULT NULL COMMENT '设备类型(PILE-充电桩,TERMINAL-终端)', `serial_number` varchar(32) DEFAULT NULL COMMENT '设备流水号', `content` text CHARACTER SET utf8 COMMENT '报文16进制原文', - `reply_content` text COMMENT '回复的报文', + `charge_order_no` varchar(50) default null COMMENT '充电订单号', `status` int(10) DEFAULT '0' COMMENT '状态(0正常 1停用)', `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', `create_by` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者', diff --git a/xhpc-modules/pom.xml b/xhpc-modules/pom.xml index 561957dd..e5a4a82c 100644 --- a/xhpc-modules/pom.xml +++ b/xhpc-modules/pom.xml @@ -19,6 +19,7 @@ xhpc-wxma xhpc-invoice xhpc-tradebill + xhpc-message-board xhpc-modules diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/CardService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/CardService.java new file mode 100644 index 00000000..176e3d33 --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/CardService.java @@ -0,0 +1,26 @@ +package com.xhpc.common.api; + +import com.xhpc.common.api.factory.CardFallbackFactory; +import com.xhpc.common.core.constant.ServiceNameConstants; +import com.xhpc.common.core.domain.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 卡订单 + * @author yuyang + * @date 2022/1/19 16:56 + */ +@FeignClient(contextId ="cardService",value = ServiceNameConstants.XHPC_CARD, fallbackFactory = CardFallbackFactory.class) +public interface CardService { + + /** + * 卡启动判断接口 + * @param cardNumber 卡号 + * @param serialNumber 终端编码 + * @return + */ + @GetMapping("/card/cardStartup") + R cardStartup(@RequestParam(value = "cardNumber") String cardNumber, @RequestParam(value = "serialNumber") String serialNumber); +} diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java index 0597c235..298cf914 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java @@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import java.math.BigDecimal; +import java.util.Map; /** * @author yuyang @@ -18,11 +19,12 @@ public interface UserTypeService { /** * 根据手机号(账号),用户id和类型 获取用户信息 + * * @param * @return */ @GetMapping("/common/getUser") - R getUser(@RequestParam(value = "phone")String phone,@RequestParam(value = "userId")Long userId,@RequestParam(value = "userType")Integer userType,@RequestParam(value = "serialNumber")String serialNumber,@RequestParam(value = "tenantId")String tenantId); + R> getUser(@RequestParam(value = "phone") String phone, @RequestParam(value = "userId") Long userId, @RequestParam(value = "userType") Integer userType, @RequestParam(value = "serialNumber") String serialNumber, @RequestParam(value = "tenantId") String tenantId); diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/CardFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/CardFallbackFactory.java new file mode 100644 index 00000000..99821d5b --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/CardFallbackFactory.java @@ -0,0 +1,24 @@ +package com.xhpc.common.api.factory; + +import com.xhpc.common.api.CardService; +import com.xhpc.common.core.domain.R; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + +/** + * @author yuyang + * @date 2022/1/19 17:18 + */ +@Component +public class CardFallbackFactory implements FallbackFactory { + + @Override + public CardService create(Throwable cause) { + return new CardService() { + @Override + public R cardStartup(String cardNumber, String serialNumber) { + return R.fail("卡启动判断接口失败:" + cause.getMessage()); + } + }; + } +} diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java index d42975d1..f8e605f9 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java @@ -88,5 +88,8 @@ public class UserTypeUtil { */ public static final String SYS_USER_TYPE_ZERO = "00"; public static final String SYS_USER_TYPE_ONE = "01"; + public static final String SYS_USER_TYPE_TWO = "02"; public static final String SYS_USER_TYPE_THREE = "03"; + + public static final Long SYS_USER_TYPE_ADMIN = 1L; } diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java index 3e6c87ed..f912aa49 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java @@ -171,12 +171,23 @@ public class HexUtils { byte[] bytes = toBytes(hex); final StringBuilder result = new StringBuilder(); - for (byte b: bytes) { - for (int i=0; i<8; i++) { + for (byte b : bytes) { + for (int i = 0; i < 8; i++) { result.append(b >> (8 - (i + 1)) & 0x0001); } } - return result. toString(); + return result.toString(); + } + + public static final String toAscii(String hex) { + + if (hex == null) return null; + byte[] bytes = toBytes(hex); + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + sb.append(Character.valueOf((char) b)); + } + return sb.toString(); } public static void main(String[] args) { diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcAgreementController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcAgreementController.java index a2756b26..1e63467d 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcAgreementController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcAgreementController.java @@ -3,6 +3,8 @@ package com.xhpc.general.controller; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.general.domain.XhpcAgreement; import com.xhpc.general.service.IXhpcAgreementService; import org.springframework.beans.factory.annotation.Autowired; @@ -20,18 +22,22 @@ public class XhpcAgreementController extends BaseController { @Autowired IXhpcAgreementService iXhpcAgreementService; + + @Log(title = "协议-删除", businessType = BusinessType.DELETE) @PostMapping("/delete") public AjaxResult delete(@RequestBody XhpcAgreement xhpcAgreement){ return iXhpcAgreementService.deleteAgreementItem(xhpcAgreement.getAgreementId()); } + @Log(title = "协议-添加", businessType = BusinessType.DELETE) @PostMapping("/add") public AjaxResult add(@RequestBody XhpcAgreement xhpcAgreement){ return iXhpcAgreementService.insertAgreementItem(xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent()); } + @Log(title = "协议-编辑", businessType = BusinessType.UPDATE) @PostMapping("/update") public AjaxResult update(@RequestBody XhpcAgreement xhpcAgreement){ @@ -51,6 +57,7 @@ public class XhpcAgreementController extends BaseController { return AjaxResult.success(iXhpcAgreementService.selectAgreementItem(agreementId)); } + @GetMapping("/getContent") public AjaxResult getContent(@RequestParam Integer type){ diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcDictBizController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcDictBizController.java index ae6e2d50..d92d5ea2 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcDictBizController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcDictBizController.java @@ -3,6 +3,8 @@ package com.xhpc.general.controller; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.general.domain.XhpcDictionary; import com.xhpc.general.dto.XhpcDictionaryChild; import com.xhpc.general.service.IXhpcDictBizService; @@ -42,6 +44,7 @@ public class XhpcDictBizController extends BaseController { * @param sort the dictionary's sortValue * @return */ + @Log(title = "字典-添加", businessType = BusinessType.INSERT) @PostMapping("/addMainItem") public AjaxResult addMainDictionaryItem(@RequestBody XhpcDictionary xhpcDictionary){ diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcEtTokenController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcEtTokenController.java index 16360e06..96d6ded3 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcEtTokenController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcEtTokenController.java @@ -3,6 +3,8 @@ package com.xhpc.general.controller; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.general.domain.EtTokenEntity; import com.xhpc.general.service.IXhpcEtTokenService; import org.springframework.beans.factory.annotation.Autowired; @@ -28,12 +30,14 @@ public class XhpcEtTokenController extends BaseController { return getDataTable(iXhpcEtTokenService.list(operatorId, operatorId3irdpty)); } + @Log(title = "第三方token-删除", businessType = BusinessType.DELETE) @PostMapping(value = "/delete") public AjaxResult delete(@RequestBody EtTokenEntity etTokenEntity){ return iXhpcEtTokenService.delete(etTokenEntity.getId()); } + @Log(title = "第三方token-添加", businessType = BusinessType.INSERT) @PostMapping(value = "/add") public AjaxResult add(@RequestBody EtTokenEntity etTokenEntity){ diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcHelpController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcHelpController.java index a17144d5..6901de2d 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcHelpController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcHelpController.java @@ -3,6 +3,8 @@ package com.xhpc.general.controller; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.general.domain.HelpEntity; import com.xhpc.general.service.IXhpcHelpService; import org.springframework.beans.factory.annotation.Autowired; @@ -22,18 +24,22 @@ public class XhpcHelpController extends BaseController { @Autowired IXhpcHelpService iXhpcHelpService; + + @Log(title = "帮助-删除", businessType = BusinessType.DELETE) @PostMapping("/delete") public AjaxResult deleteHelpItem(@RequestBody HelpEntity helpEntity){ return iXhpcHelpService.deleteHelpItem(helpEntity.getHelpId()); } + @Log(title = "帮助-添加", businessType = BusinessType.INSERT) @PostMapping("/add") public AjaxResult insertHelpItem(@RequestBody HelpEntity helpEntity){ return iXhpcHelpService.insertHelpItem(helpEntity.getTitle(),helpEntity.getContent(),helpEntity.getType()); } + @Log(title = "帮助-修改", businessType = BusinessType.UPDATE) @PostMapping("/update") public AjaxResult updateHelpItem(@RequestBody HelpEntity helpEntity){ diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcServiceDataUpdateController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcServiceDataUpdateController.java index 80703e03..58bf8604 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcServiceDataUpdateController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcServiceDataUpdateController.java @@ -1,6 +1,8 @@ package com.xhpc.general.controller; import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.general.service.IXhpcServiceDataUpdateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -23,6 +25,7 @@ public class XhpcServiceDataUpdateController { return AjaxResult.success(xhpcServiceDataUpdateService.list()); } + @Log(title = "小程序设置-修改", businessType = BusinessType.UPDATE) @PostMapping("/update") public AjaxResult update(@RequestParam(required = false) String SOC, @RequestParam(required = false) String version, @RequestParam(required = false) String phone, @RequestParam(required = false) String aliyunMessageCount) { diff --git a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcAgreementMapper.xml b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcAgreementMapper.xml index 4966c1ec..533c8494 100644 --- a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcAgreementMapper.xml +++ b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcAgreementMapper.xml @@ -19,7 +19,6 @@ - update xhpc_agreement set del_flag=1 where agreement_id=#{agreementId} diff --git a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcEtTokenMapper.xml b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcEtTokenMapper.xml index 94ab0063..823957d3 100644 --- a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcEtTokenMapper.xml +++ b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcEtTokenMapper.xml @@ -34,7 +34,6 @@ - delete from et_auth_sec_token where id = #{id} diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/XhpcInvoiceApplication.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/XhpcInvoiceApplication.java similarity index 98% rename from xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/XhpcInvoiceApplication.java rename to xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/XhpcInvoiceApplication.java index 51a0ad3d..f88706bd 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/XhpcInvoiceApplication.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/XhpcInvoiceApplication.java @@ -1,4 +1,4 @@ -package com.xhpc.invoice; +package com.xhpc; import com.xhpc.common.security.annotation.EnableCustomConfig; import com.xhpc.common.security.annotation.EnableRyFeignClients; diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/controller/XhpcInvoiceController.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/controller/XhpcInvoiceController.java index efd09327..ed1b7f29 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/controller/XhpcInvoiceController.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/controller/XhpcInvoiceController.java @@ -95,7 +95,7 @@ public class XhpcInvoiceController extends BaseController { public AjaxResult invoiceToUser(@RequestBody InvoiceToUserRequest requestData) { //前置条件 if (requestData.getInvoiceId() == null) { - return AjaxResult.error("必须传递未开发票id"); + return AjaxResult.error("必须上传发票id"); } if (requestData.getStatus() == null || requestData.getStatus().equals(InvoiceStatusConst.INVOICING)) { return AjaxResult.error("必须传递发票状态或发票状态不能为0"); diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java index e2d32a27..6d345f3e 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java @@ -128,6 +128,8 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { @Override @Transactional(rollbackFor = Exception.class) public Boolean invoiceToUser(InvoiceToUserRequest requestData) { + //获取当前时间 + requestData.setInvoicingTime(DateUtil.getYyyyMmDdHhMmSs()); //根据操作人的id,查询操作人的名字 SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer())); requestData.setDrawer(sysUser.getNickName()); @@ -137,7 +139,14 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { //从阿里云上下载下来电子发票 String fileUrl = requestData.getEletricInvoiceUrl(); File electricInvoiceFile = new File(environment.getProperty("file.serverStoreDisposableFileLocation") + "ElectricInvoice.pdf"); - HttpUtil.downloadFile(fileUrl, electricInvoiceFile); + try { + //参数1 文件下载路径 + //参数2 文件存放位置 + //服务器响应404 表示服务器找不到客户端所请求的资源 + HttpUtil.downloadFile(fileUrl, electricInvoiceFile); + } catch (Exception e) { + throw new RuntimeException("在阿里云上无法找到该文件,请检查上传的图片路径是否完整或有误"); + } try { MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile); } catch (Exception e) { @@ -161,6 +170,8 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { @Override @Transactional(rollbackFor = Exception.class) public void failInvoiceToUser(InvoiceToUserRequest requestData) { + //获取当前时间 + requestData.setInvoicingTime(DateUtil.getYyyyMmDdHhMmSs()); //根据操作人的id,查询操作人的名字 SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer())); requestData.setDrawer(sysUser.getNickName()); @@ -196,6 +207,11 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { public InvoiceTitleResponse findTitleInfo(String firmName) { List xhpcInvoiceList = xhpcInvoiceMapper.selectInvoiceTitleInfo(firmName); + InvoiceTitleResponse invoiceTitleResponse = new InvoiceTitleResponse(); + //如果没有记录,则返回空包装类 + if (xhpcInvoiceList.size() == 0) { + return invoiceTitleResponse; + } ArrayList dataDTOList = new ArrayList<>(); for (XhpcInvoice xhpcInvoice : xhpcInvoiceList) { InvoiceTitleResponse.DataDTO dataDTO = new InvoiceTitleResponse.DataDTO(); @@ -203,7 +219,6 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { dataDTO.setDutyNumber(xhpcInvoice.getDutyNumber()); dataDTOList.add(dataDTO); } - InvoiceTitleResponse invoiceTitleResponse = new InvoiceTitleResponse(); invoiceTitleResponse.setData(dataDTOList); return invoiceTitleResponse; } @@ -223,6 +238,10 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectUserLastInputInvoiceInfo(creatorId, creatorType); TitleResponse titleResponse = new TitleResponse(); + //如果数据库本身就没有数据,那么就返回空实体类对象 + if (xhpcInvoice == null) { + return titleResponse; + } BeanUtils.copyProperties(xhpcInvoice, titleResponse); return titleResponse; @@ -241,7 +260,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { public InvoicedOrderResponse findUserHistoryOrders(InvoicedOrdersRequest invoicedOrdersRequest) { //自动生成当前时间 - if (invoicedOrdersRequest.getCurrentTime() == null) { + if (invoicedOrdersRequest.getCurrentTime() == null || "".equals(invoicedOrdersRequest.getCurrentTime())) { Date currentDate = new Date(); String strTime = DateUtils.parseDateToStr(currentDate); invoicedOrdersRequest.setCurrentTime(strTime); @@ -251,6 +270,10 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { //查询该用户3个月内可以开发票的历史订单 List> xhpcHistoryOrderList = xhpcHistoryOrderMapper.findByCondition(invoicedOrdersRequest, lockOrderNumberList); InvoicedOrderResponse invoicedOrderResponse = new InvoicedOrderResponse(); + //没有则直接返回空对象出去 + if (xhpcHistoryOrderList.size() == 0) { + return invoicedOrderResponse; + } //设置该用户3个月内可以开发票的历史订单数量 invoicedOrderResponse.setTotalItems(xhpcHistoryOrderList.size()); //查询该用户所有可以开的发票的历史订单数量 @@ -312,29 +335,6 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { invoicedOrderResponse.setItems(itemsDTOS); return invoicedOrderResponse; -// //计算分页索引,放置到currentPage属性中 -// int startIndex = (invoicedOrdersRequest.getCurrentPage() - 1) * invoicedOrdersRequest.getItems(); -// invoicedOrdersRequest.setCurrentPage(startIndex); -// //先查询该用户被锁定了的订单,过滤掉它 -// List lockOrderNumberList = xhpcInvoiceMapHistoryOrderMapper.findLockOrdersByUserIdAndUserType(invoicedOrdersRequest); -// //查询该用户3个月内可以开发票的历史订单 -// List xhpcHistoryOrderList = xhpcHistoryOrderMapper.findByCondition(invoicedOrdersRequest, lockOrderNumberList); -// ArrayList itemsDTOList = new ArrayList<>(); -// for (XhpcHistoryOrder xhpcHistoryOrder : xhpcHistoryOrderList) { -// InvoiceOrdersResponse.ItemsDTO itemsDTO = new InvoiceOrdersResponse.ItemsDTO(); -// itemsDTO.setOrderId(xhpcHistoryOrder.getHistoryOrderId()); -// itemsDTO.setOrderNumber(xhpcHistoryOrder.getSerialNumber()); -// itemsDTO.setOrderMoney(xhpcHistoryOrder.getActPrice()); -// itemsDTO.setOrderTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, xhpcHistoryOrder.getCreateTime())); -// itemsDTOList.add(itemsDTO); -// } -// InvoiceOrdersResponse invoiceOrdersResponse = new InvoiceOrdersResponse(); -// invoiceOrdersResponse.setItems(itemsDTOList); -// //查询该用户所有可以开发票的历史订单的数量 -// Long allOrdersCount = xhpcHistoryOrderMapper.findAllOrdersByCondition(invoicedOrdersRequest, lockOrderNumberList); -// invoiceOrdersResponse.setTotalItems(allOrdersCount); -// return invoiceOrdersResponse; - } /** @@ -353,6 +353,10 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { //对拷发票部分数据 XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(invoiceId); SpecificInvoicedResponse specificInvoicedResponse = new SpecificInvoicedResponse(); + //查不出来返回空包装类 + if (xhpcInvoice == null) { + return specificInvoicedResponse; + } specificInvoicedResponse.setCreatorTime(DateUtils.parseDateToStr(xhpcInvoice.getCreateTime())); specificInvoicedResponse.setReceiveEmail(xhpcInvoice.getReceiveEmail()); specificInvoicedResponse.setTitleType(xhpcInvoice.getTitleType()); @@ -462,6 +466,11 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { invoiceHistoryRecordsRequest.setCurrentPage(startIndex); //获取该用户所提交的每个发票信息 List invoicesList = xhpcInvoiceMapper.findInvoicesByCreatorIdAndCreatorType(invoiceHistoryRecordsRequest); + //如果为0,那么则返回空的实体类出去 + InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = new InvoiceHistoryRecordsResponse(); + if (invoicesList.size() == 0) { + return invoiceHistoryRecordsResponse; + } //实体类对拷 ArrayList itemsDTOS = new ArrayList<>(); for (XhpcInvoice xhpcInvoice : invoicesList) { @@ -473,7 +482,6 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { itemsDTO.setIsRead(xhpcInvoice.getIsRead()); itemsDTOS.add(itemsDTO); } - InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = new InvoiceHistoryRecordsResponse(); invoiceHistoryRecordsResponse.setItems(itemsDTOS); Long userInvoiceItems = xhpcInvoiceMapper.getUserInvoiceItemsByCreatorIdAndCreatorType(invoiceHistoryRecordsRequest.getCreatorId(), invoiceHistoryRecordsRequest.getCreatorType()); invoiceHistoryRecordsResponse.setTotalItems(userInvoiceItems); diff --git a/xhpc-modules/xhpc-invoice/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-invoice/src/main/resources/bootstrap.yml index 9f962452..adcb25c9 100644 --- a/xhpc-modules/xhpc-invoice/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-invoice/src/main/resources/bootstrap.yml @@ -37,4 +37,5 @@ oss: #文件路径 file: aliyunPath: invoicePdf/ - serverStoreDisposableFileLocation: /www/wwwroot/xhpc.scxhua.com/disposableFiles/ \ No newline at end of file + # serverStoreDisposableFileLocation: /www/wwwroot/xhpc.scxhua.com/disposableFiles/ + serverStoreDisposableFileLocation: C:\\www\\wwwroot\\xhpc.scxhua.com\\disposableFiles\\ \ No newline at end of file diff --git a/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapHistoryOrderMapper.xml b/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapHistoryOrderMapper.xml index 08622bd6..783c6d8d 100644 --- a/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapHistoryOrderMapper.xml @@ -1,5 +1,6 @@ + diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/OrderLogController.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/OrderLogController.java index d36403e1..5050d522 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/OrderLogController.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/OrderLogController.java @@ -37,15 +37,16 @@ public class OrderLogController extends BaseController { } - @GetMapping("/{orderId}") - public TableDataInfo getOrderDetailPage(@PathVariable("orderId") String orderId){ + @GetMapping("/detail") + public TableDataInfo getOrderDetailPage(@RequestParam("orderId") String orderId){ startPage(); return getDataTable(orderLogService.getOrderDetailPage(orderId)); } - @GetMapping("/export") + @PostMapping("/export") public void export(HttpServletResponse response, + @RequestParam(required = false) String orderId, @RequestParam(required = false) String tenantId, @RequestParam(required = false) Integer number, @RequestParam(required = false) String serialNumber) throws Exception { @@ -55,6 +56,7 @@ public class OrderLogController extends BaseController { params.put("number", number); params.put("serialNumber", serialNumber); params.put("tenantId", tenantId); + params.put("orderId", orderId); orderLogService.export(response, params); } diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/PileLogController.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/PileLogController.java index 9d50a7f8..62c8da67 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/PileLogController.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/PileLogController.java @@ -38,16 +38,22 @@ public class PileLogController extends BaseController { } - @GetMapping("/{pileId}") - public TableDataInfo getPileDetailPage(@PathVariable("pileId") String pileId) { + + @GetMapping("/detail") + public TableDataInfo getPileDetailPage(@RequestParam("pileId") String pileId, + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime) { startPage(); - return getDataTable(pileLogService.getPileRunLogPage(pileId)); + return getDataTable(pileLogService.getPileRunLogPage(pileId, startTime, endTime)); } - @GetMapping("/export") + @PostMapping("/export") public void export(HttpServletResponse response, + @RequestParam("pileId") String pileId, @RequestParam(required = false) String tenantId, @RequestParam(required = false) Integer number, + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime, @RequestParam(required = false) String serialNumber) throws Exception { Map params = new HashMap<>(); @@ -56,6 +62,9 @@ public class PileLogController extends BaseController { params.put("type", StationDeviceEnum.PILE.getCode()); params.put("serialNumber", serialNumber); params.put("tenantId", tenantId); + params.put("startTime", startTime); + params.put("endTime", endTime); + params.put("pileId", pileId); pileLogService.export(response, params); } diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/StationLogController.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/StationLogController.java index 52f3afdf..8f898d5d 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/StationLogController.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/controller/StationLogController.java @@ -32,15 +32,17 @@ public class StationLogController extends BaseController { } - @GetMapping("/{stationId}") - public TableDataInfo getPileDetailPage(@PathVariable("stationId") Long stationId) { + + @GetMapping("/detail") + public TableDataInfo getPileDetailPage(@RequestParam("stationId") Long stationId) { + startPage(); return getDataTable(stationLogService.getStationRatePage(stationId)); } - @GetMapping("/rate/{rateId}") - public AjaxResult getRateInfo(@PathVariable("rateId") Integer rateId) { + @GetMapping("/rate/detail") + public AjaxResult getRateInfo(@RequestParam("rateId") Integer rateId) { return AjaxResult.success(stationLogService.getRateInfo(rateId)); } } diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/domain/XhpcDeviceMessageDomain.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/domain/XhpcDeviceMessageDomain.java index 674a9108..e3a35179 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/domain/XhpcDeviceMessageDomain.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/domain/XhpcDeviceMessageDomain.java @@ -8,18 +8,42 @@ import java.util.Date; @Data public class XhpcDeviceMessageDomain { + /** + * 消息ID + */ private Long deviceMessageId; + /** + * 设备类型 + */ private String type; + /** + * 设备编码 + */ private String serialNumber; + /** + * 充电订单号 + */ + private String chargeOrderNo; + + /** + * 报文内容 + */ private String content; - private String replyContent; - + /** + * 状态 + */ private Integer status; + /** + * 备注描述 + */ + private String remark; + + private Date createTime; private String createBy; @@ -28,5 +52,4 @@ public class XhpcDeviceMessageDomain { private String updateBy; - private String remark; } diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/mapper/XhpcChargingStationMapper.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/mapper/XhpcChargingStationMapper.java index 119f695f..c905bf1e 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/mapper/XhpcChargingStationMapper.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/mapper/XhpcChargingStationMapper.java @@ -25,4 +25,7 @@ public interface XhpcChargingStationMapper { List> selectRateTimeListByRateId(@Param("rateId")Integer rateId); + + List> selectBaseRateTimeListByRateId(@Param("rateId")Integer rateId); + } diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/mapper/XhpcDeviceMessageMapper.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/mapper/XhpcDeviceMessageMapper.java index 7f6dda18..c9f267ad 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/mapper/XhpcDeviceMessageMapper.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/mapper/XhpcDeviceMessageMapper.java @@ -11,8 +11,17 @@ import java.util.Map; public interface XhpcDeviceMessageMapper { List> selectListByTypeAndSerialNumber(@Param("type") String type, - @Param("serialNumber")String serialNumber); + @Param("serialNumber")String serialNumber, + @Param("startTime") String startTime, + @Param("endTime") String endTime); List> selectListByParams(@Param("params")Map params); + + + List> selectListByChargeOrderNo(@Param("chargeOrderNo") String chargeOrderNo); + + + + List> getOrderMessageByParams(@Param("params")Map params); } diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/PileLogService.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/PileLogService.java index b57710b9..4243d1e4 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/PileLogService.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/PileLogService.java @@ -10,7 +10,7 @@ public interface PileLogService { List> getPilePage(Map params); - List> getPileRunLogPage(String pileId); + List> getPileRunLogPage(String pileId, String startTime, String endTime); void export(HttpServletResponse response, Map params) throws Exception; } diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/StationLogService.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/StationLogService.java index 955ee274..5d9ed7f9 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/StationLogService.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/StationLogService.java @@ -12,5 +12,6 @@ public interface StationLogService { List> getStationRatePage(Long stationId); - List> getRateInfo(int rateId); + Map getRateInfo(int rateId); + } diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/OrderLogServiceImpl.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/OrderLogServiceImpl.java index 015256f4..e67291d5 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/OrderLogServiceImpl.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/OrderLogServiceImpl.java @@ -4,6 +4,7 @@ package com.xhpc.log.service.impl; import cn.hutool.core.io.IoUtil; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; +import com.xhpc.log.mapper.XhpcDeviceMessageMapper; import com.xhpc.log.mapper.XhpcHistoryOrderMapper; import com.xhpc.log.mapper.XhpcMessageMapper; import com.xhpc.log.service.OrderLogService; @@ -21,8 +22,9 @@ public class OrderLogServiceImpl implements OrderLogService { @Resource XhpcHistoryOrderMapper historyOrderMapper; + @Resource - XhpcMessageMapper messageMapper; + XhpcDeviceMessageMapper deviceMessageMapper; @Override @@ -33,13 +35,13 @@ public class OrderLogServiceImpl implements OrderLogService { @Override public List> getOrderDetailPage(String orderId){ - return messageMapper.getOrderMessagePage(orderId); + return deviceMessageMapper.selectListByChargeOrderNo(orderId); } @Override public void export(HttpServletResponse response, Map params) throws Exception{ - List> list = messageMapper.getOrderMessageByParams(params); + List> list = deviceMessageMapper.getOrderMessageByParams(params); ExcelWriter writer = ExcelUtil.getWriter(true); writer.addHeaderAlias("serialNumber", "订单号"); diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/PileLogServiceImpl.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/PileLogServiceImpl.java index 0b817f6f..70387e76 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/PileLogServiceImpl.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/PileLogServiceImpl.java @@ -33,8 +33,8 @@ public class PileLogServiceImpl implements PileLogService { @Override - public List> getPileRunLogPage(String pileId){ - return deviceMessageMapper.selectListByTypeAndSerialNumber(StationDeviceEnum.PILE.getCode(), pileId); + public List> getPileRunLogPage(String pileId, String startTime, String endTime){ + return deviceMessageMapper.selectListByTypeAndSerialNumber(StationDeviceEnum.PILE.getCode(), pileId, startTime, endTime); } @Override @@ -45,11 +45,10 @@ public class PileLogServiceImpl implements PileLogService { writer.addHeaderAlias("chargingStationName", "场站名称"); writer.addHeaderAlias("chargingPileName", "充电桩名称"); writer.addHeaderAlias("serialNumber", "桩编码"); - writer.addHeaderAlias("brandModel", "费率"); + writer.addHeaderAlias("brandModel", "规则型号"); writer.addHeaderAlias("pileType", "电桩类型"); writer.addHeaderAlias("power", "电桩功率(KW)"); writer.addHeaderAlias("content", "充电桩上传平台报文"); - writer.addHeaderAlias("replyContent", "平台回复报文"); writer.addHeaderAlias("remark", "备注描述"); writer.addHeaderAlias("createTime", "发送时间"); diff --git a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/StationLogServiceImpl.java b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/StationLogServiceImpl.java index c7f1f066..70dd33e3 100644 --- a/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/StationLogServiceImpl.java +++ b/xhpc-modules/xhpc-log/src/main/java/com/xhpc/log/service/impl/StationLogServiceImpl.java @@ -5,6 +5,7 @@ import com.xhpc.log.service.StationLogService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,7 +29,11 @@ public class StationLogServiceImpl implements StationLogService { @Override - public List> getRateInfo(int rateId){ - return stationMapper.selectRateTimeListByRateId(rateId); + public Map getRateInfo(int rateId){ + Map resData = new HashMap<>(); + resData.put("base", stationMapper.selectBaseRateTimeListByRateId(rateId)); + resData.put("current", stationMapper.selectRateTimeListByRateId(rateId)); + + return resData; } } diff --git a/xhpc-modules/xhpc-log/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-log/src/main/resources/bootstrap.yml index ac095b69..28ca6854 100644 --- a/xhpc-modules/xhpc-log/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-log/src/main/resources/bootstrap.yml @@ -27,7 +27,8 @@ spring: logging: level: root: info - com.xhpc.tradebill.mapper: debug + com.xhpc.log.mapper: debug + file: path: "d:\\logs" @@ -54,37 +55,3 @@ alibaba: certPath: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt" publicCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt" rootCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt" - -###获取微信openid地址 -#WXGETJSCODE: "https://api.weixin.qq.com/sns/jscode2session?appid=wxb14ef93e9b7901f3&secret=b5c5672141b5930c30a1abee95a2dcbf&js_code=" -###阿里云身份证验证地址 -#VERIFYCARD: "http://idenauthen.market.alicloudapi.com/idenAuthentication" -##阿里云身份证验证地址appcode -#APPCODE: "APPCODE e26d9088b58e24af69411d5933cece47" -##小程序appid -#APPID: "wxd0a48e00319ef8a7" -##小程序绑定商户id -#MCHID: "1514355771" -##商户后台设置的key -#KEY: "sichuanxianghuakejiyouxiangongsi" -##微信小程序支付地址 -#WXPAYUNIFIEDORDER: "https://api.mch.weixin.qq.com/pay/unifiedorder" -##微信支付回调地址 -#SERVERDOMAIN: "http://www.scxhua.cn/prod-api/xhpc-payment/wx/paymentCallback" -##微信小程序支付地址 -#WXTRANSFERS: "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers" - -##支付宝支付回调地址 -#ALIPAYPSERVERDOMAIN: "https://www.scxhua.cn/prod-api/xhpc-payment/alipay/notifyUrl" -##支付宝公钥 -#ALIPAYPUBLICKEY: -##应用私钥 -#ALIPAYPRIVATEKEY: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGHX1s315EKjoIBkNiF3IxCAmvtVg+TdCDL/XmJZWdcZ23tEWmmIMsLRCLUKsaPfTEhnqD6EFJnmpJu4teDImo3aDbOoO31YFEXjMXUnTTS/dtDVEo1OecsRL+Re43KSohOkIL1TMyTuNfeIglQTuhCSZ3LOEOx4OHpYwcrLp8p1ORvAS7x35nsmjLp3oQTJo9RWfzfEaKbm6cxsWLKyr5/5eGDXrUHNC5hIDLjoJbe6iqNKyIiPJHtPZfJ36PcWa7PFvx4X+Ded32KZb2AA3p9w/HX7gn1MnRfT5NGH0k3ggxLNarDU8g6JjQYgNtmE/R8gbp99BudZNfDoSF1llNAgMBAAECggEAaTa9bSoXM/bErALt3ghyx1B8+OGVpts5F5IKoVEe/PNjPfkpIzdGwONhtUnF0cKFQaAWgWE1xuGGlO2Sumevn1Cvnw1axF+1F8Om5UcE67cPFvh5kUTlpyGrutt1tMSQjpy7r7jEf1UwP3e5pzBz7TPWf2wv635OC56uOtivPJZ+8vg7VYon/mNXQuL4AavoxfSDtvo0ad30X2fK1WKeeBtgiT4UzV6ZGZh5igKQHM4lVvmbo/jOeQD0KAod7pRe/h4FBFmCVIWwgW+I+Hnzp8A/nJezoowJ3jiTt0FodC9uBCT64ZCz5dVCryD62LDVjKBxB7cfIoQA+PxCiXr9QQKBgQD+2v38J/MlfK/XCYldclzumizwIw6T0Mv6XvYwXQHYgYDKYNF6k1LhMEUo7fP3EsPdV8h/nXmdU4qadOVm6QSJ/rGEl22yGlO7woUzTY/Ls9eknoqfMYuyI1+ICMnNxmesQbWyc0cOHh44cEF+icfJxEDAmrHGLmBVsKuLUJUuVQKBgQCGt663TF7mixghiUOcT11zC1fqG+dIcvAwHpCHfdxsniYRqnv+SLf6eC5PCkQ5aNAAl/ywOLQAWS0XgYti3LyZ4iuGIYcUE0IDDmhWl68V27iXcLIK+rBRqBGxSdk8xR+zSE8fpO4mXpxn8SH0Butex8PJ+oHTbmdXIUAXdn6HGQKBgQCvAB1rqtsRoL72ADxtCHy78u5srwXxhmyqrc6LgzIjQzn2vejaLJO6wfSbmFnwDNimAwNQbgf2ekkwqphjxBozz8qB66GNrPpWccoZYmcdT48CIUO68MCmQBf3R2GbhWPnKu/ja7kc/p1tz9eJVn70E2kLWK4+EdZgwQHqlhj6SQKBgF4AmbdpYOb5s9Li1vyhHJIEHkpLQi15lkPdb/g7SK26BNJa5b5fu5DYf2fDwCtXCZ0AcN/+EQwVLbOzPzGy2R9/g+NKTdkiPvOnAAM8QH2+HaX+ix3CI3o3DnFpGF6hJieRkzR/f3Ximryks451rZMrTWEIncKMzSstFm3Izy0xAoGBAJQaMqlzpM+QaJiytJNeqRpPWRsi0Dkf4XqJXPWLOrApSISsafZF5vk2ZOeIqRsVCBH3LdfVIJxEBAF4l/Sd2q7xC9JHawJDqa4ea7VwL68ANH2w3jcJ3j6DQqf7NIe/lSGxYF6Jt+74oRFHxN3GDSf+z91DYfZz8hQnyphKDNEJ" -##支付宝appid -#ALIPAYAPPID: "2021002156615717" -##应用公钥证书路径 -#CERTPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt" -##支付宝公钥证书路径 -#PUBLICCERTPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt" -##支付宝根证书路径 -#ROOTCRETPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt" \ No newline at end of file diff --git a/xhpc-modules/xhpc-log/src/main/resources/mapper/SysOperLogMapper.xml b/xhpc-modules/xhpc-log/src/main/resources/mapper/SysOperLogMapper.xml index 72b22665..fd2e2dd3 100644 --- a/xhpc-modules/xhpc-log/src/main/resources/mapper/SysOperLogMapper.xml +++ b/xhpc-modules/xhpc-log/src/main/resources/mapper/SysOperLogMapper.xml @@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" oper_name = #{params.operName} + order by oper_time desc diff --git a/xhpc-modules/xhpc-log/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-log/src/main/resources/mapper/XhpcChargingStationMapper.xml index 5a0e6bc0..e7b2cb93 100644 --- a/xhpc-modules/xhpc-log/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-log/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -31,7 +31,8 @@ + + + diff --git a/xhpc-modules/xhpc-log/src/main/resources/mapper/XhpcDeviceMessageMapper.xml b/xhpc-modules/xhpc-log/src/main/resources/mapper/XhpcDeviceMessageMapper.xml index 599fca67..18b1c9f6 100644 --- a/xhpc-modules/xhpc-log/src/main/resources/mapper/XhpcDeviceMessageMapper.xml +++ b/xhpc-modules/xhpc-log/src/main/resources/mapper/XhpcDeviceMessageMapper.xml @@ -9,7 +9,7 @@ type as 'type', serial_number as 'serialNumber', content as 'content', - reply_content as 'replyContent', + charge_order_no as 'chargeOrderNo', status as 'status', remark as 'remark', create_time as 'createTime', @@ -18,6 +18,33 @@ update_by as 'updateBy' from xhpc_device_message where type=#{type} and serial_number=#{serialNumber} + + and create_time = ]]> #{startTime} + + + and create_time #{endTime} + + order by create_time desc + + + + + @@ -33,12 +60,12 @@ m.type as 'type', m.serial_number as 'serialNumber', m.content as 'content', - m.reply_content as 'replyContent', + m.charge_order_no as 'chargeOrderNo', m.status as 'status', m.remark as 'remark', m.create_time as 'createTime', m.create_by as 'createBy', - m.update_time as 'updateTime', + m.update_time as 'updateTime' from xhpc_device_message m left join xhpc_charging_pile cp on cp.serial_number=m.serial_number left join xhpc_charging_station st on st.charging_station_id =cp.charging_station_id @@ -52,12 +79,70 @@ and m.type=#{params.type} + + and m.serial_number=#{params.pileId} + and cp.tenant_id = #{params.tenantId} and cp.serial_number=#{params.serialNumber} + + and m.charge_order_no=#{params.chargeOrderNo} + + + and m.create_time = ]]> #{params.startTime} + + + and m.create_time #{params.endTime} + + order by m.create_time desc + + + + + diff --git a/xhpc-modules/xhpc-message-board/pom.xml b/xhpc-modules/xhpc-message-board/pom.xml new file mode 100644 index 00000000..efffedac --- /dev/null +++ b/xhpc-modules/xhpc-message-board/pom.xml @@ -0,0 +1,143 @@ + + + + xhpc-modules + com.ruoyi + 3.0.0 + + 4.0.0 + + xhpc-message-board + + + 留言板服务 + + + + 8 + 8 + + + + + + + junit + junit + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + mysql + mysql-connector-java + + + + + com.ruoyi + ruoyi-common-datasource + + + + + com.ruoyi + ruoyi-common-datascope + + + + + com.ruoyi + ruoyi-common-log + + + + + com.ruoyi + ruoyi-common-swagger + + + com.ruoyi + ruoyi-common-core + + + com.squareup.okhttp3 + okhttp + + + com.ruoyi + xhpc-common + 3.0.0 + compile + + + com.aliyun.oss + aliyun-sdk-oss + 3.10.2 + compile + + + + + + ${project.artifactId} + + + src/main/resources + + + src/main/java + + **/*.xml + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.4.0 + + + + repackage + + + + + + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/XhpcMessageBoardApplication.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/XhpcMessageBoardApplication.java new file mode 100644 index 00000000..e3264ebc --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/XhpcMessageBoardApplication.java @@ -0,0 +1,37 @@ +package com.xhpc; + +import com.xhpc.common.security.annotation.EnableCustomConfig; +import com.xhpc.common.swagger.annotation.EnableCustomSwagger2; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * @author WH + * @date 2021/12/7 14:55 + * @since version-1.0 + */ +@EnableCustomConfig +@EnableCustomSwagger2 +@EnableFeignClients +@SpringBootApplication +@MapperScan("com.xhpc.board.mapper") +public class XhpcMessageBoardApplication { + + public static void main(String[] args) { + + SpringApplication.run(XhpcMessageBoardApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ 留言板模块启动成功 ლ(´ڡ`ლ)゙ \n" + + " .-------. ____ __ \n" + + " | _ _ \\ \\ \\ / / \n" + + " | ( ' ) | \\ _. / ' \n" + + " |(_ o _) / _( )_ .' \n" + + " | (_,_).' __ ___(_ o _)' \n" + + " | |\\ \\ | || |(_,_)' \n" + + " | | \\ `' /| `-' / \n" + + " | | \\ / \\ / \n" + + " ''-' `'-' `-..-' "); + } + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/api/XhpcMessageBoardApiController.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/api/XhpcMessageBoardApiController.java new file mode 100644 index 00000000..f8fe9a4b --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/api/XhpcMessageBoardApiController.java @@ -0,0 +1,73 @@ +package com.xhpc.board.api; + +import com.xhpc.board.domain.QueryUserMassageResponse; +import com.xhpc.board.domain.SendMessageToPlatformRequest; +import com.xhpc.board.domain.UserQueryCondition; +import com.xhpc.board.service.XhpcMessageBoardService; +import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * 小程序的InvoiceController + * + * @author WH + * @date 2021/12/23 13:49 + * @since version-1.0 + */ +@RestController +@RequestMapping("/api/message-board") +public class XhpcMessageBoardApiController extends BaseController { + + @Resource + XhpcMessageBoardService xhpcMessageBoardService; + + /** + * 用户发起聊天,发送聊天记录给平台客服 + * + * @author WH + * @date 2021/12/28 18:51 + * @since version-1.0 + */ + @PostMapping("/user/message") + @Log(title = "留言板-用户发送聊天信息", businessType = BusinessType.INSERT) + public AjaxResult sendMessageToPlatform(@RequestBody SendMessageToPlatformRequest userMessage) { + + xhpcMessageBoardService.writeUserMessageToDb(userMessage); + return AjaxResult.success(); + } + + /** + * 用户查看所发送的聊天记录 + * + * @author WH + * @date 2022/1/13 18:15 + * @since version-1.0 + */ + @GetMapping("/user/message") + public AjaxResult queryUserMessage(UserQueryCondition userQueryCondition) { + + QueryUserMassageResponse queryUserMassageResponse = xhpcMessageBoardService.queryUserMessage(userQueryCondition); + return AjaxResult.success(queryUserMassageResponse); + } + + /** + * 获取用户对应的租户的头像 + * + * @author WH + * @date 2022/1/13 18:19 + * @since version-1.0 + */ + @GetMapping("/platform-icon") + public AjaxResult returnPlatformAvatar(@Param("tenantId") String tenantId, @Param("tenantType") Integer tenantType) { + + String avatarAddress = xhpcMessageBoardService.returnPlatformAvatar(tenantId, tenantType); + return AjaxResult.success(avatarAddress); + } + +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/controller/XhpcMessageBoardController.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/controller/XhpcMessageBoardController.java new file mode 100644 index 00000000..d22962d2 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/controller/XhpcMessageBoardController.java @@ -0,0 +1,59 @@ +package com.xhpc.board.controller; + +import com.xhpc.board.domain.PlatformSendMessageToUserRequest; +import com.xhpc.board.domain.QueryUserListRequest; +import com.xhpc.board.domain.QueryUserListResponse; +import com.xhpc.board.service.XhpcMessageBoardService; +import com.xhpc.common.core.web.domain.AjaxResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * 留言板服务Controller + * + * @author WH + * @date 2022/1/10 10:02 + * @since version-1.0 + */ +@RestController +@RequestMapping("/board") +@Slf4j +public class XhpcMessageBoardController { + + @Resource + XhpcMessageBoardService xhpcMessageBoardService; + + /** + * 平台给用户发送消息 + * + * @author WH + * @date 2022/1/13 18:43 + * @since version-1.0 + */ + @PostMapping("/platform/message") + public AjaxResult platformSendMessageToUser(@RequestBody PlatformSendMessageToUserRequest platformRequest) { + + xhpcMessageBoardService.platformSendMessageToUser(platformRequest); + + return AjaxResult.success(); + } + + /** + * 租户查询给它发送信息的用户的列表 + * + * @author WH + * @date 2022/1/14 10:26 + * @since version-1.0 + */ + @GetMapping("/user/list") + public AjaxResult queryUserList(QueryUserListRequest param) { + + QueryUserListResponse queryUserListResponse = xhpcMessageBoardService.queryUserList(param); + + return AjaxResult.success(queryUserListResponse); + + } + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/PlatformQueryCondition.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/PlatformQueryCondition.java new file mode 100644 index 00000000..2d36a24c --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/PlatformQueryCondition.java @@ -0,0 +1,29 @@ +package com.xhpc.board.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 平台查询条件 + * + * @author WH + * @date 2022/1/12 15:23 + * @since version-1.0 + */ +@NoArgsConstructor +@Data +public class PlatformQueryCondition { + + @JsonProperty("senderAccount") + private String senderAccount; + @JsonProperty("senderType") + private Integer senderType; + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("tenantType") + private Integer tenantType; + @JsonProperty("sendMessageTime") + private String sendMessageTime; + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/PlatformSendMessageToUserRequest.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/PlatformSendMessageToUserRequest.java new file mode 100644 index 00000000..943e408a --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/PlatformSendMessageToUserRequest.java @@ -0,0 +1,31 @@ +package com.xhpc.board.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 平台向用户发送的信息包装类 + * + * @author WH + * @date 2022/1/11 13:47 + * @since version-1.0 + */ +@NoArgsConstructor +@Data +public class PlatformSendMessageToUserRequest { + + @JsonProperty("sendMessageTime") + private String sendMessageTime; + @JsonProperty("senderAccount") + private String senderAccount; + @JsonProperty("senderType") + private Integer senderType; + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("tenantType") + private Integer tenantType; + @JsonProperty("messageContent") + private String messageContent; + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserListRequest.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserListRequest.java new file mode 100644 index 00000000..2e250e6f --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserListRequest.java @@ -0,0 +1,60 @@ +package com.xhpc.board.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 查询给租户发信息的用户的列表 + * + * @author WH + * @date 2022/1/14 11:17 + * @since version-1.0 + */ +@NoArgsConstructor +@Data +public class QueryUserListRequest { + + /** + * senderAccount + */ + @JsonProperty("senderAccount") + private String senderAccount; + /** + * userType + */ + @JsonProperty("userType") + private Integer userType; + /** + * currentPage + */ + @JsonProperty("currentPage") + @NotNull(message = "currentPage的参数名不正确或者currentPage的值为空,检查传入参数") + @NotBlank(message = "currentPage的参数为''字符串,请检查传入参数") + private Integer currentPage; + /** + * items + */ + @JsonProperty("items") + @NotNull(message = "items的参数名不正确或者items的值为空,检查传入参数") + @NotBlank(message = "items的参数为''字符串,请检查传入参数") + private Integer items; + /** + * tenantId + */ + @JsonProperty("tenantId") + @NotNull(message = "tenantId的参数名不正确或者tenantId的值为空,检查传入参数") + @NotBlank(message = "tenantId的参数为''字符串,请检查传入参数") + private String tenantId; + /** + * tenantType + */ + @JsonProperty("tenantType") + @NotNull(message = "tenantType的参数名不正确或者tenantType的值为空,检查传入参数") + @NotBlank(message = "tenantType的参数为''字符串,请检查传入参数") + private Integer tenantType; + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserListResponse.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserListResponse.java new file mode 100644 index 00000000..5191b53e --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserListResponse.java @@ -0,0 +1,44 @@ +package com.xhpc.board.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 封装查询用户列表的包装类对象 + * + * @author WH + * @date 2022/1/14 11:23 + * @since version-1.0 + */ +@NoArgsConstructor +@Data +public class QueryUserListResponse { + + @JsonProperty("totalItems") + private Long totalItems; + @JsonProperty("data") + private List data; + + @NoArgsConstructor + @Data + public static class DataDTO { + + @JsonProperty("userIcon") + private String userIcon; + @JsonProperty("userAccount") + private String userAccount; + @JsonProperty("userType") + private Integer userType; + @JsonProperty("haveNewInfo") + private Integer haveNewInfo; + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("tenantType") + private Integer tenantType; + + } + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserMassageResponse.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserMassageResponse.java new file mode 100644 index 00000000..7bf9fb9e --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/QueryUserMassageResponse.java @@ -0,0 +1,48 @@ +package com.xhpc.board.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 查询用户信息的返回封装数据类 + * + * @author WH + * @date 2022/1/13 10:23 + * @since version-1.0 + */ +@NoArgsConstructor +@Data +public class QueryUserMassageResponse { + + @JsonProperty("nextQueryTime") + private String nextQueryTime; + @JsonProperty("data") + private List data; + + @NoArgsConstructor + @Data + public static class DataDTO { + + @JsonProperty("senderType") + private Integer senderType; + @JsonProperty("senderAccount") + private String senderAccount; + @JsonProperty("sendMessageTime") + private String sendMessageTime; + @JsonProperty("messageContent") + private String messageContent; + @JsonProperty("tenantType") + private Integer tenantType; + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("have_new_info") + private Integer haveNewInfo; + @JsonProperty("sender") + private Integer sender; + + } + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/SendMessageToPlatformRequest.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/SendMessageToPlatformRequest.java new file mode 100644 index 00000000..6b950fa3 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/SendMessageToPlatformRequest.java @@ -0,0 +1,31 @@ +package com.xhpc.board.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 用户所发送的信息的包装类 + * + * @author WH + * @date 2022/1/7 17:19 + * @since version-1.0 + */ +@NoArgsConstructor +@Data +public class SendMessageToPlatformRequest { + + @JsonProperty("sendMessageTime") + private String sendMessageTime; + @JsonProperty("senderAccount") + private String senderAccount; + @JsonProperty("senderType") + private Integer senderType; + @JsonProperty("messageContent") + private String messageContent; + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("tenantType") + private Integer tenantType; + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/UserQueryCondition.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/UserQueryCondition.java new file mode 100644 index 00000000..cc8a35b3 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/domain/UserQueryCondition.java @@ -0,0 +1,29 @@ +package com.xhpc.board.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 用户查询条件 + * + * @author WH + * @date 2022/1/12 15:23 + * @since version-1.0 + */ +@NoArgsConstructor +@Data +public class UserQueryCondition { + + @JsonProperty("senderAccount") + private String senderAccount; + @JsonProperty("senderType") + private Integer senderType; + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("tenantType") + private Integer tenantType; + @JsonProperty("sendMessageTime") + private String sendMessageTime; + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/mapper/XhpcMessageBoardMapper.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/mapper/XhpcMessageBoardMapper.java new file mode 100644 index 00000000..2bd03c28 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/mapper/XhpcMessageBoardMapper.java @@ -0,0 +1,97 @@ +package com.xhpc.board.mapper; + +import com.xhpc.board.domain.PlatformSendMessageToUserRequest; +import com.xhpc.board.domain.SendMessageToPlatformRequest; +import com.xhpc.board.domain.UserQueryCondition; +import com.xhpc.board.pojo.XhpcMessageBoard; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface XhpcMessageBoardMapper { + + int deleteByPrimaryKey(Long messageId); + + int insert(XhpcMessageBoard record); + + int insertSelective(XhpcMessageBoard record); + + XhpcMessageBoard selectByPrimaryKey(Long messageId); + + int updateByPrimaryKeySelective(XhpcMessageBoard record); + + int updateByPrimaryKey(XhpcMessageBoard record); + + /** + * 用户端存入时间记录 + * + * @param userMessage 用户时间记录信息 + * @author WH + * @date 2022/1/11 17:46 + * @since version-1.0 + */ + void insertUserTimeMessageRecord(SendMessageToPlatformRequest userMessage); + + /** + * 用户端存入发送的消息 + * + * @param userMessage 用户发送的消息 + * @author WH + * @date 2022/1/11 18:16 + * @since version-1.0 + */ + void insertUserMessage(SendMessageToPlatformRequest userMessage); + + /** + * 平台端存入发送的信息 + * + * @param platformRequest 平台所要发送给用户的信息 + * @author WH + * @date 2022/1/12 11:30 + * @since version-1.0 + */ + void insertPlatformMessage(PlatformSendMessageToUserRequest platformRequest); + + /** + * 平台端存入时间记录 + * + * @param platformRequest 平台时间记录信息 + * @author WH + * @date 2022/1/12 11:49 + * @since version-1.0 + */ + void insertPlatformTimeMessageRecord(PlatformSendMessageToUserRequest platformRequest); + + /** + * 查询用户一个月的记录 + * + * @param userQueryCondition 用户查询条件 + * @param nextTimeStr 上一个月的时间 + * @return 返回一个装有一个月的数据的集合 + * @author WH + * @date 2022/1/12 16:03 + * @since version-1.0 + */ + List selectBy(@Param("userQueryCondition") UserQueryCondition userQueryCondition, @Param("nextTimeStr") String nextTimeStr); + + /** + * 给查询出来的记录,添加用户已读状态 + * + * @param messageIdList 查询出来的记录的id集合 + * @author WH + * @date 2022/1/13 10:16 + * @since version-1.0 + */ + void setUserReadedStatus(List messageIdList); + + /** + * 查询用户所有时间记录 + * + * @param userQueryCondition 用户信息 + * @author WH + * @date 2022/1/13 10:56 + * @since version-1.0 + */ + List selectTimeRecords(UserQueryCondition userQueryCondition); + +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/mapper/XhpcMessageBoardReceiveUserMapper.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/mapper/XhpcMessageBoardReceiveUserMapper.java new file mode 100644 index 00000000..54ae11b7 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/mapper/XhpcMessageBoardReceiveUserMapper.java @@ -0,0 +1,40 @@ +package com.xhpc.board.mapper; + +import com.xhpc.board.domain.SendMessageToPlatformRequest; +import com.xhpc.board.pojo.XhpcMessageBoardReceiveUser; + +/** + * the mapper of the xhpc_message_board_receive_user + * + * @author WH + * @date 2022/1/11 10:26 + * @since version-1.0 + */ +public interface XhpcMessageBoardReceiveUserMapper { + + int insert(XhpcMessageBoardReceiveUser record); + + int insertSelective(XhpcMessageBoardReceiveUser record); + + /** + * 通过用户id,用户类型,租户id,租户类型,查询指定记录 + * + * @param userMessage 储存条件的包装类 + * @return 指定记录 + * @author WH + * @date 2022/1/10 18:03 + * @since version-1.0 + */ + XhpcMessageBoardReceiveUser findOneByCondition(SendMessageToPlatformRequest userMessage); + + /** + * 将指定用户记录have_new_info字段的值,将其设置为0,即该用户发送了新消息 + * + * @param userMessage 指定要更新哪个记录的条件 + * @author WH + * @date 2022/1/11 10:31 + * @since version-1.0 + */ + void updateHaveNewInfoFiledByUserCondition(SendMessageToPlatformRequest userMessage); + +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/pojo/XhpcMessageBoard.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/pojo/XhpcMessageBoard.java new file mode 100644 index 00000000..2c41e605 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/pojo/XhpcMessageBoard.java @@ -0,0 +1,68 @@ +package com.xhpc.board.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * xhpc_message_board + * + * @author WH + */ +@Data +public class XhpcMessageBoard implements Serializable { + + /** + * 消息id + */ + private Long messageId; + + /** + * 用户类型 + */ + private Integer senderType; + + /** + * 用户账号 + */ + private String senderAccount; + + /** + * 发送消息的时间 + */ + private Date sendMessageTime; + + /** + * 消息内容 + */ + private String messageContent; + + /** + * 租户类型 + */ + private Integer tenantType; + + /** + * 租户id(平台id) + */ + private String tenantId; + + /** + * 租户发送的消息,用户是否已读,默认为null,表示未读,0表示已读 + */ + private Integer haveNewInfo; + + /** + * 逻辑删除字段 + */ + private Integer delFlag; + + /** + * 发送者(0,用户,1,时间,2,平台(租户)) + */ + private Integer sender; + + private static final long serialVersionUID = 1L; + +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/pojo/XhpcMessageBoardReceiveUser.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/pojo/XhpcMessageBoardReceiveUser.java new file mode 100644 index 00000000..f71d6430 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/pojo/XhpcMessageBoardReceiveUser.java @@ -0,0 +1,52 @@ +package com.xhpc.board.pojo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * xhpc_message_board_receive_user + * + * @author WH + */ +@Data +public class XhpcMessageBoardReceiveUser implements Serializable { + + /** + * 接收者id(租户id) + */ + private String tenantId; + + /** + * 接收者类型(租户类型) + */ + private Integer tenantType; + + /** + * 发送者账号 + */ + private String senderAccount; + + /** + * 发送者类型(0 C端用户 1 流量方用户 2社区用户 3B端用户) + */ + private Integer senderType; + + /** + * 用户头像地址 + */ + private String userIcon; + + /** + * 是否有新消息(null表示有新消息,0表示没有) + */ + private Integer haveNewInfo; + + /** + * 逻辑删除(0为删除) + */ + private Integer delFlag; + + private static final long serialVersionUID = 1L; + +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/service/XhpcMessageBoardService.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/service/XhpcMessageBoardService.java new file mode 100644 index 00000000..ab3f12cb --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/service/XhpcMessageBoardService.java @@ -0,0 +1,69 @@ +package com.xhpc.board.service; + +import com.xhpc.board.domain.*; + +/** + * 留言板服务的Service + * + * @author WH + * @date 2022/1/7 17:57 + * @since version-1.0 + */ +public interface XhpcMessageBoardService { + + /** + * 将用户发送的信息保存到数据库中 + * + * @param userMessage 用户发送的信息 + * @author WH + * @date 2022/1/10 14:17 + * @since version-1.0 + */ + void writeUserMessageToDb(SendMessageToPlatformRequest userMessage); + + /** + * 将平台(租户)发送的信息保存到数据库中 + * + * @param platformRequest 平台消息 + * @author WH + * @date 2022/1/11 13:58 + * @since version-1.0 + */ + void platformSendMessageToUser(PlatformSendMessageToUserRequest platformRequest); + + /** + * 根据用户条件,查询指定的数据库中的记录 + * + * @param userQueryCondition 用户传入的条件 + * @return 用户在数据库中发送的记录 + * @author WH + * @date 2022/1/12 15:30 + * @since version-1.0 + */ + QueryUserMassageResponse queryUserMessage(UserQueryCondition userQueryCondition); + + /** + * 根据租户id和租户类型查询指定的租户头像 + * + * @param tenantId 租户id + * @param tenantType 租户类型 + * @return 头像地址 + * @author WH + * @date 2022/1/13 18:30 + * @since version-1.0 + */ + String returnPlatformAvatar(String tenantId, Integer tenantType); + + /** + * 平台用户查询哪些用户发留言了的列表 + * + * @param param query list condition + * @return 发了信息的用户列表 + * @author WH + * @date 2022/1/14 11:25 + * @since version-1.0 + */ + QueryUserListResponse queryUserList(QueryUserListRequest param); + + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/service/impl/XhpcMessageBoardServiceImpl.java b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/service/impl/XhpcMessageBoardServiceImpl.java new file mode 100644 index 00000000..bdbdfdaa --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/java/com/xhpc/board/service/impl/XhpcMessageBoardServiceImpl.java @@ -0,0 +1,259 @@ +package com.xhpc.board.service.impl; + +import com.xhpc.board.domain.*; +import com.xhpc.board.mapper.XhpcMessageBoardMapper; +import com.xhpc.board.mapper.XhpcMessageBoardReceiveUserMapper; +import com.xhpc.board.pojo.XhpcMessageBoard; +import com.xhpc.board.pojo.XhpcMessageBoardReceiveUser; +import com.xhpc.board.service.XhpcMessageBoardService; +import com.xhpc.common.api.UserTypeService; +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.utils.DateUtils; +import com.xhpc.common.core.utils.bean.BeanUtils; +import com.xhpc.common.redis.service.RedisService; +import com.xhpc.common.security.service.TokenService; +import com.xhpc.common.util.DateUtil; +import com.xhpc.system.api.domain.SysUser; +import com.xhpc.system.api.model.LoginUser; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 留言板实现类 + * + * @author WH + */ +@Service +public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService { + + @Resource + TokenService tokenService; + @Resource + XhpcMessageBoardMapper messageBoardMapper; + @Resource + XhpcMessageBoardReceiveUserMapper xhpcMessageBoardReceiveUserMapper; + @Resource + RedisService redisService; + @Resource + UserTypeService userTypeService; + + + /** + * 将用户发送的信息保存到数据库中 + * + * @param userMessage 用户发送的信息 + * @author WH + * @date 2022/1/10 14:17 + * @since version-1.0 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void writeUserMessageToDb(SendMessageToPlatformRequest userMessage) { + //解析Token,获取用户与平台用户信息 + LoginUser loginUser = tokenService.getLoginUser(); + String userRedisKey = "userMessageValidTime:" + loginUser.getUserType() + ":" + loginUser.getUserid() + ":" + userMessage.getTenantType() + ":" + userMessage.getTenantId(); + //使用Redis判断消息发送是否大于5分钟: + Object cacheObject = redisService.getCacheObject(userRedisKey); + String currentTime; + String platformRedisKey = "PlatformMessageValidTime:" + userMessage.getTenantType() + ":" + userMessage.getTenantId() + ":" + loginUser.getUserType() + ":" + loginUser.getUsername(); + if (cacheObject == null) { + //设置当前时间 + currentTime = DateUtil.getYyyyMmDdHhMmSs(); + redisService.setCacheObject(userRedisKey, currentTime); + redisService.expire(userRedisKey, 60 * 5); + //设置平台RedisKey的有效时间,保证双方时间数据同步 + redisService.setCacheObject(platformRedisKey, currentTime); + redisService.expire(platformRedisKey, 60 * 5); + userMessage.setSendMessageTime(currentTime); + userMessage.setSenderAccount(loginUser.getUsername()); + userMessage.setSenderType(loginUser.getUserType()); + messageBoardMapper.insertUserTimeMessageRecord(userMessage); + messageBoardMapper.insertUserMessage(userMessage); + XhpcMessageBoardReceiveUser receiverUser = xhpcMessageBoardReceiveUserMapper.findOneByCondition(userMessage); + if (receiverUser == null) { + XhpcMessageBoardReceiveUser xhpcMessageBoardReceiveUser = new XhpcMessageBoardReceiveUser(); + BeanUtils.copyProperties(userMessage, xhpcMessageBoardReceiveUser); + //发送请求所返回的响应信息 + R> result = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null, userMessage.getTenantId()); + Map userInfo = result.getData(); + String avatar = (String) userInfo.get("avatar"); + xhpcMessageBoardReceiveUser.setUserIcon(avatar); + xhpcMessageBoardReceiveUser.setHaveNewInfo(0); + xhpcMessageBoardReceiveUserMapper.insertSelective(xhpcMessageBoardReceiveUser); + } else { + xhpcMessageBoardReceiveUserMapper.updateHaveNewInfoFiledByUserCondition(userMessage); + } + } else { + //reset redis key valid time + redisService.expire(userRedisKey, 60 * 5); + redisService.expire(platformRedisKey, 60 * 5); + currentTime = (String) cacheObject; + userMessage.setSendMessageTime(currentTime); + //设置用户账号,用户类型 + userMessage.setSenderAccount(loginUser.getUsername()); + userMessage.setSenderType(loginUser.getUserType()); + messageBoardMapper.insertUserMessage(userMessage); + //向租户显示的列表中添加该用户信息,表示该用户来新消息了,如果列表中已经有该用户了,则只更新状态即可。 + XhpcMessageBoardReceiveUser receiverUser = xhpcMessageBoardReceiveUserMapper.findOneByCondition(userMessage); + if (receiverUser == null) { + XhpcMessageBoardReceiveUser xhpcMessageBoardReceiveUser = new XhpcMessageBoardReceiveUser(); + BeanUtils.copyProperties(userMessage, xhpcMessageBoardReceiveUser); + //发送请求所返回的响应信息 + R> result = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null, userMessage.getTenantId()); + Map userInfo = result.getData(); + String avatar = (String) userInfo.get("avatar"); + xhpcMessageBoardReceiveUser.setUserIcon(avatar); + xhpcMessageBoardReceiveUser.setHaveNewInfo(0); + xhpcMessageBoardReceiveUserMapper.insertSelective(xhpcMessageBoardReceiveUser); + } else { + xhpcMessageBoardReceiveUserMapper.updateHaveNewInfoFiledByUserCondition(userMessage); + } + } + } + + /** + * 将平台(租户)发送的信息保存到数据库中 + * + * @param platformRequest 平台消息 + * @author WH + * @date 2022/1/11 13:58 + * @since version-1.0 + */ + @Override + public void platformSendMessageToUser(PlatformSendMessageToUserRequest platformRequest) { + + //获取平台用户信息 + SysUser sysUser = tokenService.getLoginUser().getSysUser(); + //使用redis控制发送时间 + String platformRedisKey = "PlatformMessageValidTime:" + "0:" + sysUser.getTenantId() + ":" + platformRequest.getSenderType() + ":" + platformRequest.getSenderAccount(); + Object cacheObject = redisService.getCacheObject(platformRedisKey); + String currentTime; + String userRedisKey = "userMessageValidTime:" + platformRequest.getSenderType() + ":" + platformRequest.getSenderAccount() + ":" + "0:" + sysUser.getTenantId(); + if (cacheObject == null) { + //设置当前时间 + currentTime = DateUtil.getYyyyMmDdHhMmSs(); + redisService.setCacheObject(platformRedisKey, currentTime); + redisService.expire(platformRedisKey, 60 * 5); + //设置用户RedisKey的有效时间,保证双方时间数据同步 + redisService.setCacheObject(userRedisKey, currentTime); + redisService.expire(userRedisKey, 60 * 5); + platformRequest.setSendMessageTime(currentTime); + platformRequest.setTenantId(sysUser.getTenantId()); + platformRequest.setTenantType(0); + messageBoardMapper.insertPlatformTimeMessageRecord(platformRequest); + messageBoardMapper.insertPlatformMessage(platformRequest); + } + //reset redis key valid time + redisService.expire(platformRedisKey, 60 * 5); + redisService.expire(userRedisKey, 60 * 5); + platformRequest.setSendMessageTime((String) cacheObject); + platformRequest.setTenantId(sysUser.getTenantId()); + platformRequest.setTenantType(0); + messageBoardMapper.insertPlatformMessage(platformRequest); + + } + + /** + * 根据用户条件,查询指定的数据库中的记录 + * + * @param userQueryCondition 用户传入的条件 + * @author WH + * @date 2022/1/12 15:30 + * @since version-1.0 + */ + @Override + public QueryUserMassageResponse queryUserMessage(UserQueryCondition userQueryCondition) { + //完善条件集合 + LoginUser loginUser = tokenService.getLoginUser(); + userQueryCondition.setSenderAccount(loginUser.getUsername()); + userQueryCondition.setSenderType(loginUser.getUserType()); + String nextTimeStr = null; + if ("".equals(userQueryCondition.getSendMessageTime()) || userQueryCondition.getSendMessageTime() == null || "null".equals(userQueryCondition.getSendMessageTime())) { + userQueryCondition.setSendMessageTime(DateUtil.getYyyyMmDdHhMmSs()); + //查询用户是否有数据,即查询该用户的所有时间记录(有时间记录表示该用户发送过信息) + List allTimeRecords = messageBoardMapper.selectTimeRecords(userQueryCondition); + QueryUserMassageResponse queryUserMassageResponse = new QueryUserMassageResponse(); + if (allTimeRecords.size() == 0) { + return queryUserMassageResponse; + } + //获取最后一个时间记录,将其减去一个月,放入查询条件中 + XhpcMessageBoard xhpcMessageBoard = allTimeRecords.get(allTimeRecords.size() - 1); + Date finalTime = xhpcMessageBoard.getSendMessageTime(); + userQueryCondition.setSendMessageTime(DateUtils.parseDateToStr(finalTime)); + Calendar finalTimeCalendar = DateUtil.getCalendar(finalTime); + finalTimeCalendar.add(Calendar.MONTH, -1); + Date nextTime = finalTimeCalendar.getTime(); + nextTimeStr = DateUtils.parseDateToStr(nextTime); + } else { + //如果有值过来,说明有之前的记录,计算上一个月的值,作为查询条件,并返回 + String sendMessageTimeStr = userQueryCondition.getSendMessageTime(); + Date sendMessageTimeDate = DateUtils.parseDate(sendMessageTimeStr); + Calendar nextTimeCalendar = DateUtil.getCalendar(sendMessageTimeDate); + nextTimeCalendar.add(Calendar.MONTH, -1); + Date nextTime = nextTimeCalendar.getTime(); + nextTimeStr = DateUtils.parseDateToStr(nextTime); + } + //根据用户信息中所保存的时间,与上个月时间进行区间查询 + List aMonthRecords = messageBoardMapper.selectBy(userQueryCondition, nextTimeStr); + //如果没有数据,则返回空实体类对象 + QueryUserMassageResponse response = new QueryUserMassageResponse(); + if (aMonthRecords.size() == 0) { + return response; + } + List messageIdList = new ArrayList<>(); + for (int index = 0; index <= aMonthRecords.size() - 1; index++) { + Long messageId = aMonthRecords.get(index).getMessageId(); + messageIdList.add(messageId); + } + //设置查询出来的记录为已读状态 + messageBoardMapper.setUserReadedStatus(messageIdList); + //封装数据 + ArrayList dataDTOS = new ArrayList<>(); + for (XhpcMessageBoard aMonthRecord : aMonthRecords) { + QueryUserMassageResponse.DataDTO dataDTO = new QueryUserMassageResponse.DataDTO(); + BeanUtils.copyProperties(aMonthRecord, dataDTO); + dataDTO.setSendMessageTime(DateUtils.parseDateToStr(aMonthRecord.getSendMessageTime())); + dataDTOS.add(dataDTO); + } + //处理下次查询时间 + //todo 截取时间 + response.setNextQueryTime(nextTimeStr); + response.setData(dataDTOS); + return response; + } + + /** + * 根据租户id和租户类型查询指定的租户头像 + * + * @param tenantId 租户id + * @param tenantType 租户类型 + * @return 头像地址 + * @author WH + * @date 2022/1/13 18:30 + * @since version-1.0 + */ + @Override + public String returnPlatformAvatar(String tenantId, Integer tenantType) { + //todo 查询数据库 + return "https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png"; + } + + /** + * 平台用户查询哪些用户发留言了的列表 + * + * @param param query list condition + * @return 发了信息的用户列表 + * @author WH + * @date 2022/1/14 11:25 + * @since version-1.0 + */ + @Override + public QueryUserListResponse queryUserList(QueryUserListRequest param) { + + return null; + } + +} diff --git a/xhpc-modules/xhpc-message-board/src/main/resources/banner.txt b/xhpc-modules/xhpc-message-board/src/main/resources/banner.txt new file mode 100644 index 00000000..27cacb9c --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/resources/banner.txt @@ -0,0 +1,10 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} + _ __ _ _ + (_) / _|(_)| | + _ __ _ _ ___ _ _ _ ______ | |_ _ | | ___ +| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \ +| | | |_| || (_) || |_| || | | | | || || __/ +|_| \__,_| \___/ \__, ||_| |_| |_||_| \___| + __/ | + |___/ \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-message-board/src/main/resources/bootstrap.yml new file mode 100644 index 00000000..c0bbf680 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/resources/bootstrap.yml @@ -0,0 +1,28 @@ +# Tomcat +server: + port: 9805 + +# Spring +spring: + application: + # 应用名称 + name: xhpc-message-board + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +logging: + level: + com.xhpc.board.mapper: debug \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/resources/logback.xml b/xhpc-modules/xhpc-message-board/src/main/resources/logback.xml new file mode 100644 index 00000000..66683df0 --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/resources/logback.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/xhpc-modules/xhpc-message-board/src/main/resources/mapper/XhpcMessageBoardMapper.xml b/xhpc-modules/xhpc-message-board/src/main/resources/mapper/XhpcMessageBoardMapper.xml new file mode 100644 index 00000000..0f2c01bf --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/resources/mapper/XhpcMessageBoardMapper.xml @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + message_id + , sender_type, sender_account, send_message_time, message_content, tenant_type, + tenant_id, have_new_info, del_flag, sender + + + + + + delete + from xhpc_message_board + where message_id = #{messageId,jdbcType=BIGINT} + + + insert into xhpc_message_board (sender_type, sender_account, send_message_time, + message_content, tenant_type, tenant_id, + have_new_info, del_flag, sender) + values (#{senderType,jdbcType=TINYINT}, #{senderAccount,jdbcType=VARCHAR}, + #{sendMessageTime,jdbcType=TIMESTAMP}, + #{messageContent,jdbcType=VARCHAR}, #{tenantType,jdbcType=TINYINT}, #{tenantId,jdbcType=VARCHAR}, + #{haveNewInfo,jdbcType=BOOLEAN}, #{delFlag,jdbcType=BOOLEAN}, #{sender,jdbcType=BOOLEAN}) + + + insert into xhpc_message_board + + + sender_type, + + + sender_account, + + + send_message_time, + + + message_content, + + + tenant_type, + + + tenant_id, + + + have_new_info, + + + del_flag, + + + sender, + + + + + #{senderType,jdbcType=TINYINT}, + + + #{senderAccount,jdbcType=VARCHAR}, + + + #{sendMessageTime,jdbcType=TIMESTAMP}, + + + #{messageContent,jdbcType=VARCHAR}, + + + #{tenantType,jdbcType=TINYINT}, + + + #{tenantId,jdbcType=VARCHAR}, + + + #{haveNewInfo,jdbcType=BOOLEAN}, + + + #{delFlag,jdbcType=BOOLEAN}, + + + #{sender,jdbcType=BOOLEAN}, + + + + + insert into xhpc_message_board + (sender_type, sender_account, send_message_time, tenant_type, tenant_id, sender) + values (#{senderType}, #{senderAccount}, #{sendMessageTime}, #{tenantType}, #{tenantId}, 1) + + + insert into xhpc_message_board + + + sender_type, + + + sender_account, + + + send_message_time, + + + message_content, + + + tenant_type, + + + tenant_id, + + have_new_info, + sender, + + + + #{senderType,jdbcType=TINYINT}, + + + #{senderAccount,jdbcType=VARCHAR}, + + + #{sendMessageTime,jdbcType=TIMESTAMP}, + + + #{messageContent,jdbcType=VARCHAR}, + + + #{tenantType,jdbcType=TINYINT}, + + + #{tenantId,jdbcType=VARCHAR}, + + 0, + 0, + + + + insert into xhpc_message_board + + + sender_type, + + + sender_account, + + + send_message_time, + + + message_content, + + + tenant_type, + + + tenant_id, + + have_new_info, + sender, + + + + #{senderType,jdbcType=TINYINT}, + + + #{senderAccount,jdbcType=VARCHAR}, + + + #{sendMessageTime,jdbcType=TIMESTAMP}, + + + #{messageContent,jdbcType=VARCHAR}, + + + #{tenantType,jdbcType=TINYINT}, + + + #{tenantId,jdbcType=VARCHAR}, + + 0, + 2, + + + + insert into xhpc_message_board + (sender_type, sender_account, send_message_time, tenant_type, tenant_id, sender) + values (#{senderType}, #{senderAccount}, #{sendMessageTime}, #{tenantType}, #{tenantId}, 1) + + + update xhpc_message_board + + + sender_type = #{senderType,jdbcType=TINYINT}, + + + sender_account = #{senderAccount,jdbcType=VARCHAR}, + + + send_message_time = #{sendMessageTime,jdbcType=TIMESTAMP}, + + + message_content = #{messageContent,jdbcType=VARCHAR}, + + + tenant_type = #{tenantType,jdbcType=TINYINT}, + + + tenant_id = #{tenantId,jdbcType=VARCHAR}, + + + have_new_info = #{haveNewInfo,jdbcType=BOOLEAN}, + + + del_flag = #{delFlag,jdbcType=BOOLEAN}, + + + sender = #{sender,jdbcType=BOOLEAN}, + + + where message_id = #{messageId,jdbcType=BIGINT} + + + update xhpc_message_board + set sender_type = #{senderType,jdbcType=TINYINT}, + sender_account = #{senderAccount,jdbcType=VARCHAR}, + send_message_time = #{sendMessageTime,jdbcType=TIMESTAMP}, + message_content = #{messageContent,jdbcType=VARCHAR}, + tenant_type = #{tenantType,jdbcType=TINYINT}, + tenant_id = #{tenantId,jdbcType=VARCHAR}, + have_new_info = #{haveNewInfo,jdbcType=BOOLEAN}, + del_flag = #{delFlag,jdbcType=BOOLEAN}, + sender = #{sender,jdbcType=BOOLEAN} + where message_id = #{messageId,jdbcType=BIGINT} + + + UPDATE `xhpc_message_board` + SET have_new_info = 1 + WHERE + message_id IN + + #{messageId} + + AND del_flag IS NULL + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-message-board/src/main/resources/mapper/XhpcMessageBoardReceiveUserMapper.xml b/xhpc-modules/xhpc-message-board/src/main/resources/mapper/XhpcMessageBoardReceiveUserMapper.xml new file mode 100644 index 00000000..4a24934c --- /dev/null +++ b/xhpc-modules/xhpc-message-board/src/main/resources/mapper/XhpcMessageBoardReceiveUserMapper.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + tenant_id + , + tenant_type, + sender_account, + sender_type, + user_icon, + have_new_info, + del_flag + + + insert into xhpc_message_board_receive_user (tenant_id, tenant_type, sender_account, + sender_type, user_icon, have_new_info, + del_flag) + values (#{tenantId,jdbcType=VARCHAR}, #{tenantType,jdbcType=INTEGER}, #{senderAccount,jdbcType=VARCHAR}, + #{senderType,jdbcType=INTEGER}, #{userIcon,jdbcType=VARCHAR}, #{haveNewInfo,jdbcType=BOOLEAN}, + #{delFlag,jdbcType=BOOLEAN}) + + + insert into xhpc_message_board_receive_user + + + tenant_id, + + + tenant_type, + + + sender_account, + + + sender_type, + + + user_icon, + + + have_new_info, + + + del_flag, + + + + + #{tenantId,jdbcType=VARCHAR}, + + + #{tenantType,jdbcType=INTEGER}, + + + #{senderAccount,jdbcType=VARCHAR}, + + + #{senderType,jdbcType=INTEGER}, + + + #{userIcon,jdbcType=VARCHAR}, + + + #{haveNewInfo,jdbcType=BOOLEAN}, + + + #{delFlag,jdbcType=BOOLEAN}, + + + + + UPDATE xhpc_message_board_receive_user + SET have_new_info = 0 + WHERE tenant_type = #{tenantType} + AND tenant_id = #{tenantId} + AND sender_account = #{senderAccount} + AND sender_type = #{senderType} + AND del_flag IS NULL; + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-order/pom.xml b/xhpc-modules/xhpc-order/pom.xml index 121691b4..f1a31b0a 100644 --- a/xhpc-modules/xhpc-order/pom.xml +++ b/xhpc-modules/xhpc-order/pom.xml @@ -99,6 +99,10 @@ com.squareup.okhttp3 okhttp + + com.ruoyi + ruoyi-common-log + diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java index 78a7a2e0..142be756 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java @@ -1,6 +1,5 @@ package com.xhpc.order.api; -import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.xhpc.common.api.WebSocketService; import com.xhpc.common.core.web.controller.BaseController; @@ -22,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; -import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -68,7 +66,6 @@ public class XhpcChargeOrderController extends BaseController { } - /** * 启动充电 * @param userId diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 7856827a..ad2cd3e3 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -383,7 +383,7 @@ public class XhpcPileOrderController extends BaseController { //订单异常 xhpcChargeOrder.setStatus(2); //异常原因 - xhpcChargeOrder.setErroRemark("桩异常:" + stopReason + ">>>>用户id:" + userId + "为空"); + xhpcChargeOrder.setErroRemark("".equals(xhpcChargeOrder.getErroRemark())?"桩异常:" + stopReason + ">>>>用户id:" + userId + "为空":xhpcChargeOrder.getErroRemark()+"桩异常:" + stopReason + ">>>>用户id:" + userId + "为空"); xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder); R.ok(); } @@ -436,7 +436,7 @@ public class XhpcPileOrderController extends BaseController { R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId); if(user !=null && user.getData() !=null){ Map userMessage = (Map)user.getData(); - if (userMessage == null || userMessage.get("balance") == null) { + if (userMessage != null && userMessage.get("balance") != null) { xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,orderNo,1); } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index bca87578..fc8b02aa 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -877,7 +877,7 @@ public class XhpcHistoryOrderController extends BaseController { R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId); if(user !=null && user.getData() !=null){ Map userMessage = (Map)user.getData(); - if (userMessage == null || userMessage.get("balance") == null) { + if (userMessage != null && userMessage.get("balance") != null) { xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,xhpcChargeOrder.getSerialNumber(),2); } } @@ -888,6 +888,30 @@ public class XhpcHistoryOrderController extends BaseController { } } + @GetMapping("/getManualAudit") + public void getManualAudit(Long chargeOrderId){ + //获取异常的订单 24小时之外的异常订单 + XhpcChargeOrder xhpcChargeOrder = chargeOrderService.getChargingOrderId(chargeOrderId); + if(xhpcChargeOrder !=null){ + Integer source = xhpcChargeOrder.getSource(); + String tenantId = xhpcChargeOrder.getTenantId(); + xhpcChargeOrder.getChargeOrderId(); + if(!UserTypeUtil.INTERNET_TYPE.equals(source)){ + R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId); + if(user !=null && user.getData() !=null){ + Map userMessage = (Map)user.getData(); + if (userMessage != null && userMessage.get("balance") != null) { + xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,xhpcChargeOrder.getSerialNumber(),2); + } + } + }else{ + xhpcHistoryOrderService.addXhpcChargeOrder(null,xhpcChargeOrder.getSerialNumber(),2); + } + } + } + + + /** * 标记异常大于创建4小时,标记为异常 * @param diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderReconciliationStatusController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderReconciliationStatusController.java index 04eeeede..01aaefeb 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderReconciliationStatusController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderReconciliationStatusController.java @@ -4,6 +4,8 @@ import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.order.service.IXhpcHistoryOrderReconciliationStatusService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -25,6 +27,7 @@ public class XhpcHistoryOrderReconciliationStatusController extends BaseControll * 修改对账状态 * @return */ + @Log(title = "对账-修改对账状态", businessType = BusinessType.UPDATE) @PostMapping("/status") @ApiOperation(value = "修改对账状态") public AjaxResult status(@RequestBody Map map) { diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderSortingStatusController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderSortingStatusController.java index cbb246fe..6c097111 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderSortingStatusController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderSortingStatusController.java @@ -5,6 +5,8 @@ import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.order.service.IXhpcHistoryOrderSortingStatusService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -27,6 +29,7 @@ public class XhpcHistoryOrderSortingStatusController extends BaseController { * 修改清分状态 * @return */ + @Log(title = "清分-修改清分状态", businessType = BusinessType.UPDATE) @PostMapping("/status") @ApiOperation(value = "修改清分状态") public AjaxResult status(@RequestBody Map map) { diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java index c99ff053..52bc164b 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java @@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -42,9 +43,9 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getTimeIntervalPage") - public TableDataInfo getTimeIntervalPage(String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public TableDataInfo getTimeIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { - List> list = xhpcStatisticsService.getTimeIntervalPage(chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); + List> list = xhpcStatisticsService.getTimeIntervalPage(request,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); return getDataTable(list); } @@ -60,9 +61,9 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getDateIntervalPage") - public TableDataInfo getDateIntervalPage(String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public TableDataInfo getDateIntervalPage(HttpServletRequest request,String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { - List> list = xhpcStatisticsService.getDateIntervalPage(chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); + List> list = xhpcStatisticsService.getDateIntervalPage(request,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); return getDataTable(list); } /** @@ -78,9 +79,9 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getStationIntervalPage") - public TableDataInfo getStationIntervalPage(String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public TableDataInfo getStationIntervalPage(HttpServletRequest request,String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { - List> list = xhpcStatisticsService.getStationIntervalPage(chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type); + List> list = xhpcStatisticsService.getStationIntervalPage(request,chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type); return getDataTable(list); } @@ -95,9 +96,9 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getOperatorIntervalPage") - public TableDataInfo getOperatorIntervalPage(String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public TableDataInfo getOperatorIntervalPage(HttpServletRequest request,String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { - List> list = xhpcStatisticsService.getOperatorIntervalPage(operatorIds,operatorId,startTime,endTime,userId,type); + List> list = xhpcStatisticsService.getOperatorIntervalPage(request,operatorIds,operatorId,startTime,endTime,userId,type); return getDataTable(list); } @@ -112,10 +113,10 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getInternetUserIntervalPage") - public TableDataInfo getInternetUserIntervalPage(String internetUserIds,Long internetUserId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public TableDataInfo getInternetUserIntervalPage(HttpServletRequest request,String internetUserIds,Long internetUserId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { startPage(); - List> list = xhpcStatisticsService.getInternetUserIntervalPage(internetUserIds,internetUserId,startTime,endTime,userId,type); + List> list = xhpcStatisticsService.getInternetUserIntervalPage(request,internetUserIds,internetUserId,startTime,endTime,userId,type); return getDataTable(list); } @@ -132,9 +133,9 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getTerminalIntervalPage") - public TableDataInfo getTerminalIntervalPage(String chargingStationId,String terminalId,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public TableDataInfo getTerminalIntervalPage(HttpServletRequest request,String chargingStationId,String terminalId,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { - List> list = xhpcStatisticsService.getTerminalIntervalPage(chargingStationId,terminalId,operatorId,startTime,endTime,userId,type); + List> list = xhpcStatisticsService.getTerminalIntervalPage(request,chargingStationId,terminalId,operatorId,startTime,endTime,userId,type); return getDataTable(list); } @@ -146,12 +147,12 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getChargingStationList") - public AjaxResult getChargingStationList(Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { if (type == null || type==3) { return AjaxResult.success(); } - return xhpcStatisticsService.getChargingStationList(operatorId, userId, type); + return xhpcStatisticsService.getChargingStationList(request,operatorId, userId, type); } /** @@ -162,12 +163,12 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getOperatorList") - public AjaxResult getOperatorList(Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public AjaxResult getOperatorList(HttpServletRequest request,Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { if (type == null || type==3) { return AjaxResult.success(); } - return xhpcStatisticsService.getOperatorList(operatorId, userId, type); + return xhpcStatisticsService.getOperatorList(request,operatorId, userId, type); } /** @@ -178,12 +179,12 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getInternetUserIList") - public AjaxResult getInternetUserIList(Long internetUserId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) { if (type == null || type==2) { return AjaxResult.success(); } - return xhpcStatisticsService.getInternetUserIList(internetUserId, userId, type); + return xhpcStatisticsService.getInternetUserIList(request,internetUserId, userId, type); } /** @@ -194,11 +195,11 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getTerminalList") - public AjaxResult getTerminalList(Long chargingStationId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) { + public AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) { if (type == null || type == 3) { return AjaxResult.success(); } - return xhpcStatisticsService.getTerminalList(chargingStationId, userId, type); + return xhpcStatisticsService.getTerminalList(request,chargingStationId, userId, type); } /** @@ -208,8 +209,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getSourceList") - public AjaxResult getSourceList(@RequestParam("userId") Long userId, @RequestParam("type") Integer type) { - return xhpcStatisticsService.getSourceList(userId, type); + public AjaxResult getSourceList(HttpServletRequest request,@RequestParam("userId") Long userId, @RequestParam("type") Integer type) { + return xhpcStatisticsService.getSourceList(request,userId, type); } /** @@ -220,9 +221,9 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getSumSourceList") - public TableDataInfo getSumSourceList(String startTime, String endTime, String internetUserIds,@RequestParam("userId") Long userId, @RequestParam("type") Integer type, String chargingStationIds) { + public TableDataInfo getSumSourceList(HttpServletRequest request,String startTime, String endTime, String internetUserIds,@RequestParam("userId") Long userId, @RequestParam("type") Integer type, String chargingStationIds) { startPage(); - List> list = xhpcStatisticsService.getSumSourceList(startTime,endTime,internetUserIds,userId, type,chargingStationIds); + List> list = xhpcStatisticsService.getSumSourceList(request,startTime,endTime,internetUserIds,userId, type,chargingStationIds); return getDataTable(list); } @@ -242,8 +243,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @PostMapping("/timeInterval/export") - public void timeIntervalExport(HttpServletResponse response, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { - xhpcStatisticsService.timeIntervalExport(response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); + public void timeIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { + xhpcStatisticsService.timeIntervalExport(request,response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); } /** @@ -258,8 +259,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @PostMapping("/dateInterval/export") - public void dateIntervalExport(HttpServletResponse response, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { - xhpcStatisticsService.dateIntervalExport(response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); + public void dateIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { + xhpcStatisticsService.dateIntervalExport(request,response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); } /** * 电站统计导出 @@ -274,8 +275,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @PostMapping("/stationInterval/export") - public void stationIntervalExport(HttpServletResponse response, String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { - xhpcStatisticsService.stationIntervalExport(response, chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type); + public void stationIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { + xhpcStatisticsService.stationIntervalExport(request,response, chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type); } /** @@ -289,8 +290,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @PostMapping("/operatorInterval/export") - public void operatorIntervalExport(HttpServletResponse response, String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { - xhpcStatisticsService.operatorIntervalExport(response, operatorIds,operatorId,startTime,endTime,userId,type); + public void operatorIntervalExport(HttpServletRequest request,HttpServletResponse response, String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { + xhpcStatisticsService.operatorIntervalExport(request,response, operatorIds,operatorId,startTime,endTime,userId,type); } /** @@ -298,8 +299,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @PostMapping("/internetUserInterval/export") - public void internetUserIntervalExport(HttpServletResponse response, String startTime, String endTime,String internetUserIds, @RequestParam("userId") Long userId, @RequestParam("type")Integer type, String chargingStationIds) throws IOException { - xhpcStatisticsService.getSumSourceListExport(response, startTime,endTime,internetUserIds,userId,type,chargingStationIds); + public void internetUserIntervalExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime,String internetUserIds, @RequestParam("userId") Long userId, @RequestParam("type")Integer type, String chargingStationIds) throws IOException { + xhpcStatisticsService.getSumSourceListExport(request,response, startTime,endTime,internetUserIds,userId,type,chargingStationIds); } @@ -315,8 +316,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @PostMapping("/terminalInterval/export") - public void terminalIntervalExport(HttpServletResponse response, String chargingStationId,String terminalId,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { - xhpcStatisticsService.terminalIntervalExport(response, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type); + public void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId,String terminalId,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { + xhpcStatisticsService.terminalIntervalExport(request,response, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type); } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java index 6c7f51af..ed09318c 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java @@ -69,7 +69,7 @@ public interface XhpcHistoryOrderMapper { * @param historyOrderId * @return */ - Map gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("type") Integer type, @Param("chargingOrderId") Long chargingOrderId, @Param("tenantId") String tenantId); + Map gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("source") Integer source, @Param("chargingOrderId") Long chargingOrderId, @Param("tenantId") String tenantId); /** * 历史订单记录(PC) @@ -112,4 +112,10 @@ public interface XhpcHistoryOrderMapper { * 获取登陆用户信息 */ Map getLandUser(@Param("userId")Long userId); + + + /** + * 查询启动订单表 + */ + Map getchargingOrderById(@Param("chargingOrderId")Long chargingOrderId,@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java index a3667492..b36de127 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java @@ -27,7 +27,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getTimeIntervalPage(@Param("chargingStationIds") List chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); + List> getTimeIntervalPage(@Param("chargingStationIds") List chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId); /** @@ -40,7 +40,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getDateIntervalPage(@Param("chargingStationIds") List chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId")Long userId); + List> getDateIntervalPage(@Param("chargingStationIds") List chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId")Long userId,@Param("tenantId")String tenantId); /** * 电站统计 @@ -53,7 +53,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getStationIntervalPage(@Param("chargingStationIds") List chargingStationIds,@Param("operatorUserId") List operatorUserId,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); + List> getStationIntervalPage(@Param("chargingStationIds") List chargingStationIds,@Param("operatorUserId") List operatorUserId,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId); /** * 运营商统计 @@ -64,7 +64,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getOperatorIntervalPage(@Param("operatorUserId") List operatorUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); + List> getOperatorIntervalPage(@Param("operatorUserId") List operatorUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId); /** * 流量方统计 @@ -75,7 +75,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getInternetUserIntervalPage(@Param("internetIds") List internetIds,@Param("internetUserId") Long internetUserId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); + List> getInternetUserIntervalPage(@Param("internetIds") List internetIds,@Param("internetUserId") Long internetUserId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId); /** @@ -88,7 +88,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getTerminalIntervalPage(@Param("chargingStationId") String chargingStationId,@Param("terminalId") String terminalId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); + List> getTerminalIntervalPage(@Param("chargingStationId") String chargingStationId,@Param("terminalId") String terminalId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId); /** @@ -98,7 +98,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getChargingStationList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type); + List> getChargingStationList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId); /** * 运营商列表 @@ -107,7 +107,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getOperatorList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type); + List> getOperatorList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId); /** @@ -117,7 +117,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getInternetUserIList(@Param("internetUserId")Long internetUserId,@Param("userId")Long userId,@Param("type")Integer type); + List> getInternetUserIList(@Param("internetUserId")Long internetUserId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId); /** * 终端列表 @@ -126,7 +126,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type); + List> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId); /** * 添加时段订单统计 @@ -144,7 +144,7 @@ public interface XhpcStatisticsServiceMapper { * 获取流量方列表 * @return */ - List> getInternetList(@Param("userId")Long userId); + List> getInternetList(@Param("userId")Long userId,@Param("tenantId")String tenantId); /** @@ -153,7 +153,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List chargingStationIdList); + List> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List chargingStationIdList,@Param("tenantId")String tenantId); /** * 获取登陆用户信息 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java index 57e1867e..7d702184 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java @@ -19,7 +19,7 @@ public interface IXhpcHistoryOrderService { /** * 用户历史订单表 - * @param userId + * @param * @return */ List> list(HttpServletRequest request); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java index b5137124..1bddceb4 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java @@ -138,4 +138,9 @@ public interface IXhpcRealTimeOrderService { */ Map addOrderTime(CacheRealtimeData cacheRealtimeData, XhpcChargeOrder xhpcChargeOrder, String orderNo, Integer type); + + /** + * 获取一条实时数据 + */ + XhpcRealTimeOrder getChargingOrderId(Long chargingOrderId,Integer type); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java index 4cf4c5c9..2210ef8f 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java @@ -6,6 +6,7 @@ import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @@ -29,7 +30,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getTimeIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); + List> getTimeIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); /** @@ -43,7 +44,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getDateIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); + List> getDateIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); /** * 电站统计 @@ -57,7 +58,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getStationIntervalPage(String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); + List> getStationIntervalPage(HttpServletRequest request,String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); /** * 运营商统计 @@ -69,7 +70,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getOperatorIntervalPage(String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type); + List> getOperatorIntervalPage(HttpServletRequest request,String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type); /** @@ -82,7 +83,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getInternetUserIntervalPage(String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type); + List> getInternetUserIntervalPage(HttpServletRequest request,String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type); /** @@ -96,7 +97,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getTerminalIntervalPage(String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type); + List> getTerminalIntervalPage(HttpServletRequest request,String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type); /** * 电站列表 @@ -105,7 +106,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getChargingStationList(Long operatorId,Long userId,Integer type); + AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId,Long userId,Integer type); /** * 运营商列表 @@ -114,7 +115,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getOperatorList(Long operatorId,Long userId,Integer type); + AjaxResult getOperatorList(HttpServletRequest request,Long operatorId,Long userId,Integer type); /** * 流量方列表 @@ -123,7 +124,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getInternetUserIList(Long internetUserId,Long userId,Integer type); + AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId,Long userId,Integer type); /** @@ -133,7 +134,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getTerminalList(Long chargingStationId,Long userId,Integer type); + AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId,Long userId,Integer type); /** * 订单来源列表 @@ -141,7 +142,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getSourceList(Long userId,Integer type); + AjaxResult getSourceList(HttpServletRequest request,Long userId,Integer type); /** * 订单来源列表 @@ -149,7 +150,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getSumSourceList(String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds); + List> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds); /** * 添加时段订单统计 @@ -180,7 +181,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - void timeIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; + void timeIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; /** @@ -194,7 +195,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - void dateIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; + void dateIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; /** * 电站统计导出 @@ -208,7 +209,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - void stationIntervalExport(HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; + void stationIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; /** * 运营商统计导出 @@ -220,14 +221,14 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - void operatorIntervalExport(HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; + void operatorIntervalExport(HttpServletRequest request,HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; /** * 订单来源统计导出 * @return */ - void getSumSourceListExport(HttpServletResponse response, String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds) throws IOException; + void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds) throws IOException; /** @@ -241,7 +242,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - void terminalIntervalExport(HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; + void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java index 76be4198..9f5a9567 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java @@ -1,5 +1,7 @@ package com.xhpc.order.service.impl; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import com.xhpc.common.api.PowerPileService; import com.xhpc.common.api.UserTypeService; @@ -17,9 +19,11 @@ import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcOrderRedisRecord; +import com.xhpc.order.domain.XhpcRealTimeOrder; import com.xhpc.order.mapper.XhpcChargeOrderMapper; import com.xhpc.order.mapper.XhpcInternetUserMapper; import com.xhpc.order.service.IXhpcChargeOrderService; +import com.xhpc.order.service.IXhpcRealTimeOrderService; import com.xhpc.system.api.model.LoginUser; import org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi; import org.slf4j.Logger; @@ -58,6 +62,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar private TokenService tokenService; @Autowired private UserTypeService userTypeService; + @Autowired + private IXhpcRealTimeOrderService xhpcRealTimeOrderService; private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderServiceImpl.class); //队列名称 @@ -90,7 +96,29 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar public List> getHistotyChargeOrderStatusList(HttpServletRequest request) { LoginUser loginUser = tokenService.getLoginUser(request); startPage(); - return xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType()); + List> list = xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(), loginUser.getTenantId(), loginUser.getUserType()); + if(list !=null && list.size()>0){ + for (int i = 0; i map = list.get(i); + //获取该订单最后一条实时数据 + Map cacheMap = redisService.getCacheMap("order:" + map.get("serialNumber").toString()); + if(cacheMap !=null && cacheMap.size()>0){ + List CacheRealtimeDataList = (List) cacheMap.get("realtimeDataList"); + if(CacheRealtimeDataList !=null && CacheRealtimeDataList.size()>0){ + CacheRealtimeData endData = CacheRealtimeDataList.get(list.size() - 1); + if (endData != null) { + map.put("actPrice", new BigDecimal(endData.getAmountCharged()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_DOWN)); + } + } + }else{ + XhpcRealTimeOrder endRealTimeOrder = xhpcRealTimeOrderService.getChargingOrderId(Long.valueOf(map.get("chargeOrderId").toString()), 2); + if (endRealTimeOrder != null) { + map.put("actPrice", endRealTimeOrder.getAmountCharged()); + } + } + } + } + return list; } @Override @@ -572,19 +600,24 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar List list = xhpcChargeOrderMapper.getFourTimsStatus(); if(list !=null && list.size()>0){ for (XhpcChargeOrder xhpcChargeOrder:list) { - CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + xhpcChargeOrder.getSerialNumber() + ".lord"); Long chargeOrderId = xhpcChargeOrder.getChargeOrderId(); - if(cacheRealtimeData ==null){ - int count = xhpcChargeOrderMapper.getSerialNumberLike(xhpcChargeOrder.getSerialNumber().substring(0, 16), chargeOrderId); - if(count>0){ - //有充电改为 由充电中变为启动充电中 - xhpcChargeOrderMapper.updateStatus(-1,chargeOrderId); + if(UserTypeUtil.INTERNET_TYPE.equals(xhpcChargeOrder.getSource())){ + //标记异常 + xhpcChargeOrderMapper.updateStatus(2,chargeOrderId); + }else{ + CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + xhpcChargeOrder.getSerialNumber() + ".lord"); + if(cacheRealtimeData ==null){ + int count = xhpcChargeOrderMapper.getSerialNumberLike(xhpcChargeOrder.getSerialNumber().substring(0, 16), chargeOrderId); + if(count>0){ + //有充电改为 由充电中变为启动充电中 + xhpcChargeOrderMapper.updateStatus(-1,chargeOrderId); + }else{ + //标记异常 + xhpcChargeOrderMapper.updateStatus(2,chargeOrderId); + } }else{ - //标记异常 xhpcChargeOrderMapper.updateStatus(2,chargeOrderId); } - }else{ - xhpcChargeOrderMapper.updateStatus(2,chargeOrderId); } } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index 4b339a87..84e52108 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -20,6 +20,7 @@ import com.xhpc.common.util.EvcsUtil; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcHistoryOrder; +import com.xhpc.order.domain.XhpcRealTimeOrder; import com.xhpc.order.dto.XhpcChargeHistoryOrder; import com.xhpc.order.mapper.XhpcHistoryOrderMapper; import com.xhpc.order.mapper.XhpcRealTimeOrderMapper; @@ -87,7 +88,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis R user = userTypeService.getUser(null, userid, userType, null, tenantId); if(user !=null && user.getData() !=null){ Map userMessage = (Map)user.getData(); - if (userMessage == null) { + if (userMessage != null) { startPage(); return xhpcHistoryOrderMapper.list(userid,userType,tenantId); } @@ -104,7 +105,95 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis @Override public AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId) { LoginUser loginUser = tokenService.getLoginUser(request); - return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(loginUser.getUserid(), historyOrderId, type, chargingOrderId,loginUser.getTenantId())); + + Map map = xhpcHistoryOrderMapper.gethistotyOrderMessage(loginUser.getUserid(), historyOrderId, loginUser.getUserType(), chargingOrderId, loginUser.getTenantId()); + if(map !=null){ + return AjaxResult.success(map); + } + //查询最后一帧数据 + if(chargingOrderId !=null){ + Map stringObjectMap = xhpcHistoryOrderMapper.getchargingOrderById(chargingOrderId,loginUser.getUserid(),loginUser.getUserType(),loginUser.getTenantId()); + if(stringObjectMap !=null){ + //获取该订单最后一条实时数据 + Map cacheMap = redisService.getCacheMap("order:" + stringObjectMap.get("serialNumber").toString()); + List list = (List) cacheMap.get("realtimeDataList"); + CacheRealtimeData startData =new CacheRealtimeData(); + CacheRealtimeData endData =new CacheRealtimeData(); + + Date startTime = null; + Date endTime = null; + BigDecimal amountCharged = new BigDecimal(0); + //充电度数 + BigDecimal chargingDegree = new BigDecimal(0); + if (list != null && list.size() > 0) { + endData =list.get(list.size()-1); + for (int i = 0; i 0){ + break; + } + } + } + Long rateModelId = Long.valueOf(stringObjectMap.get("rateModelId").toString()); + if(endData !=null && endData.getAmountCharged() !=null){ + //最后一祯时间 + endTime = DateUtil.parse(endData.getCreateTime()); + startTime =DateUtil.parse(startData.getCreateTime()); + //充电时长 + Long tiem = (endTime.getTime() - startTime.getTime()) / 1000; + if (tiem > 3600) { + long hours = tiem / 3600; + double mins = (double) ((tiem - (hours * 3600)) / 60); + stringObjectMap.put("chargingTime",hours + "时" + new BigDecimal(mins).setScale(0) + "分"); + } else { + double mins = (double) (tiem / 60); + stringObjectMap.put("chargingTime",new BigDecimal(mins).setScale(0) + "分"); + } + chargingDegree = new BigDecimal(endData.getChargingDegree()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_DOWN); + stringObjectMap.put("chargingDegree",chargingDegree); + amountCharged = new BigDecimal(endData.getAmountCharged()).divide(new BigDecimal(10000),2,BigDecimal.ROUND_DOWN); + stringObjectMap.put("actPrice",amountCharged); + }else{ + //当没有缓存数据时,查询数据库 + XhpcRealTimeOrder startRealTimeOrder = xhpcRealTimeOrderService.getChargingOrderId(chargingOrderId, 1); + XhpcRealTimeOrder endRealTimeOrder = xhpcRealTimeOrderService.getChargingOrderId(chargingOrderId, 2); + if(startRealTimeOrder==null || endRealTimeOrder==null){ + return AjaxResult.success(); + } + //最后一祯时间 + endTime = endRealTimeOrder.getCreateTime(); + startTime = startRealTimeOrder.getCreateTime(); + chargingDegree = endRealTimeOrder.getChargingDegree(); + stringObjectMap.put("chargingDegree",chargingDegree); + stringObjectMap.put("chargingTime",endRealTimeOrder.getChargingTime()); + amountCharged=endRealTimeOrder.getAmountCharged(); + stringObjectMap.put("actPrice",amountCharged); + } + BigDecimal powerPriceTotal =new BigDecimal(0); + //1时间没有跨天 + DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd"); + DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd"); + //每分钟多少度电 + BigDecimal decimal = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),4,BigDecimal.ROUND_DOWN); + BigDecimal divide = chargingDegree.divide(decimal,4,BigDecimal.ROUND_DOWN); + long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY); + if(betweenDay==0){ + powerPriceTotal = getBigDecimal(rateModelId,DateUtil.formatTime(startTime), DateUtil.formatTime(endTime), powerPriceTotal, divide); + }else{ + //跨天 + powerPriceTotal = getBigDecimal(rateModelId, DateUtil.formatTime(startTime), "23:59:59", powerPriceTotal, divide); + System.out.println(">>>>>>跨天前>>>>>>>"+powerPriceTotal); + //明天 + DateTime tomorrow = DateUtil.offsetDay(startTime,1); + Date startTime3 = DateUtil.beginOfDay(tomorrow); + powerPriceTotal = getBigDecimal(rateModelId, DateUtil.formatTime(startTime3), DateUtil.formatTime(endTime), powerPriceTotal, divide); + System.out.println(">>>>>>跨天后>>>>>>>"+powerPriceTotal); + } + stringObjectMap.put("actPowerPrice",powerPriceTotal); + } + return AjaxResult.success(stringObjectMap); + } + return AjaxResult.success(); } @Override @@ -803,11 +892,41 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis return powerPriceTotal; } - private BigDecimal getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice) { - BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime()) / 60000).multiply(degree); - BigDecimal multiply = powerPrice.multiply(v).setScale(2, BigDecimal.ROUND_DOWN); - return multiply; + private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) { + List> reatTimeList = getReatTimeList(startTime,updateTime, rateModelId); + for (int i = 0; i map = reatTimeList.get(i); + String startTime1 = map.get("startTime").toString(); + String endTime1 = map.get("endTime").toString(); + BigDecimal powerFee =new BigDecimal(map.get("powerFee").toString()); + if("00:00:00".equals(endTime1)){ + endTime1="23:59:59"; + } + //获取费率 + if(size==1){ + powerPriceTotal = powerPriceTotal.add(getRateTimeList(startTime,updateTime,divide,powerFee)); + }else{ + if(i==0){ + powerPriceTotal = powerPriceTotal.add(getRateTimeList(startTime,endTime1,divide,powerFee)); + } else if(i cacheMap = redisService.getCacheMap("order:" + chargeOrder.getSerialNumber()); List list = (List) cacheMap.get("realtimeDataList"); + CacheRealtimeData startData =new CacheRealtimeData(); CacheRealtimeData endData =new CacheRealtimeData(); @@ -175,7 +176,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe Long rateModelId = chargeOrder.getRateModelId(); - if(endData !=null && endData.getAmountCharged() !=null){ + if(endData !=null && endData.getAmountCharged() !=null && startData.getChargingTime()>0){ message.put("soc",endData.getSoc()); //最后一祯时间 @@ -220,6 +221,12 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe chargeOrder.setChargingTime(endRealTimeOrder.getChargingTime()); message.put("chargingTime",endRealTimeOrder.getChargingTime()); + if(chargeOrder.getStartTime().equals(chargeOrder.getEndTime())){ + message.put("powerPriceTotal",0); + message.put("servicePriceTotal",0); + return AjaxResult.success(message); + } + chargeOrder.setStartTime(startTime); chargeOrder.setEndTime(endTime); chargeOrder.setStartSoc(startRealTimeOrder.getSoc()); @@ -233,6 +240,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe chargeOrder.setChargingDegree(chargingDegree); chargeOrder.setType(0); chargeOrder.setAmountCharged(endRealTimeOrder.getAmountCharged()); + } Date startTime2 = chargeOrder.getStartTime(); @@ -307,7 +315,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe //订单异常 xhpcChargeOrder.setStatus(2); //异常原因 - xhpcChargeOrder.setErroRemark("用户id:" + userId + "为空"); + xhpcChargeOrder.setErroRemark("".equals(xhpcChargeOrder.getErroRemark())?"用户id:" + userId + "为空":xhpcChargeOrder.getErroRemark()+"用户id:" + userId + "为空"); xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder); return AjaxResult.error("用户id:" + userId + "为空"); } @@ -827,6 +835,11 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe return map; } + @Override + public XhpcRealTimeOrder getChargingOrderId(Long chargingOrderId, Integer type) { + return xhpcRealTimeOrderMapper.getChargingOrderId(chargingOrderId, type); + } + private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) { List> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime,updateTime, rateModelId); for (int i = 0; i > getTimeIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { + public List> getTimeIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { if (getJudge(internetUserId, operatorId, type)){ return new ArrayList<>(); } @@ -45,26 +53,24 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati chargingStationId= Arrays.asList(chargingStationIds.split(",")); } //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(request); List> list =new ArrayList<>(); - if(logUserId !=1){ - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - startPage(); - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId); - }else{ - //查询赋值的场站 - list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,logUserId); - } - } + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + startPage(); + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId); + }else{ + //查询赋值的场站 + list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId); } }else{ startPage(); - list =xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,logUserId); + list =xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId); } List> page =new ArrayList<>(); if(list !=null && list.size()>0){ @@ -159,7 +165,7 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati return page; } @Override - public List> getDateIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { + public List> getDateIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { if (getJudge(internetUserId, operatorId, type)){ return new ArrayList<>(); } @@ -167,35 +173,33 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati if(!"".equals(chargingStationIds) && chargingStationIds !=null){ chargingStationId= Arrays.asList(chargingStationIds.split(",")); } - //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); + //获取登陆用户 List> list =new ArrayList<>(); - if(logUserId !=1){ - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - startPage(); - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId); - }else{ - //查询赋值的场站 - list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,logUserId); - } - } + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + startPage(); + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId); + }else{ + //查询赋值的场站 + list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId); } }else{ startPage(); - list =xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,logUserId); + list =xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId); } return list; } @Override - public List> getStationIntervalPage(String chargingStationIds, String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { + public List> getStationIntervalPage(HttpServletRequest request,String chargingStationIds, String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { if (getJudge(internetUserId, operatorId, type)){ return new ArrayList<>(); } @@ -207,28 +211,24 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati if(!"".equals(operatorIds) && operatorIds !=null){ operatorUserId= Arrays.asList(operatorIds.split(",")); } - - //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); List> list =new ArrayList<>(); - if(logUserId !=1){ - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - startPage(); - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,1,logOperatorId); - }else{ - //查询赋值的场站 - list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,2,logUserId); - } - } + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + startPage(); + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,1,logOperatorId,tenantId); + }else{ + //查询赋值的场站 + list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,2,sysUserId,tenantId); } }else{ startPage(); - list =xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,0,logUserId); + list =xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,0,sysUserId,tenantId); } @@ -236,7 +236,7 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati } @Override - public List> getOperatorIntervalPage(String operatorIds, Long operatorId, String startTime, String endTime, Long userId, Integer type) { + public List> getOperatorIntervalPage(HttpServletRequest request,String operatorIds, Long operatorId, String startTime, String endTime, Long userId, Integer type) { if(getJudge(null,operatorId,type)){ return new ArrayList<>(); } @@ -244,35 +244,31 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati if(!"".equals(operatorIds) && operatorIds !=null){ operatorUserId= Arrays.asList(operatorIds.split(",")); } - - //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); List> list =new ArrayList<>(); - if(logUserId !=1){ - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - startPage(); - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 1,logOperatorId); - }else{ - //查询赋值的场站 - list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 2,logUserId); - } - } + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + startPage(); + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId); + }else{ + //查询赋值的场站 + list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId); } }else{ startPage(); - list =xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 0,logUserId); + list =xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId); } return list; } @Override - public List> getInternetUserIntervalPage(String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type) { + public List> getInternetUserIntervalPage(HttpServletRequest request,String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type) { if(getJudge(internetUserId,null,type)){ return new ArrayList<>(); } @@ -280,36 +276,38 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati if(!"".equals(internetUserIds) && internetUserIds !=null){ internetIds= Arrays.asList(internetUserIds.split(",")); } + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); // if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){ // startTime =date(1); // endTime =date(2); // } - return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,userId); + return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,sysUserId,tenantId); } @Override - public List> getTerminalIntervalPage(String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { + public List> getTerminalIntervalPage(HttpServletRequest request,String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(request); List> list =new ArrayList<>(); - if(logUserId !=1){ - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - startPage(); - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 1,logOperatorId); - }else{ - //查询赋值的场站 - list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 2,logUserId); - } - } + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + startPage(); + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 1,logOperatorId,tenantId); + }else{ + //查询赋值的场站 + list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 2,sysUserId,tenantId); } }else{ startPage(); - list =xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 0,logUserId); + list =xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 0,sysUserId,tenantId); } @@ -317,114 +315,104 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati } @Override - public AjaxResult getChargingStationList(Long operatorId, Long userId, Integer type) { - + public AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId, Long userId, Integer type) { + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); - if(logUserId !=1){ - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logOperatorId, 1)); - }else{ - //查询赋值的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logUserId, 2)); - } - } + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logOperatorId, 1,tenantId)); + }else{ + //查询赋值的场站 + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 2,tenantId)); } }else{ - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logUserId, 0)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 0,tenantId)); } - return AjaxResult.success(); } @Override - public AjaxResult getOperatorList(Long operatorId, Long userId, Integer type) { + public AjaxResult getOperatorList(HttpServletRequest request,Long operatorId, Long userId, Integer type) { //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); - if(logUserId !=1){ - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logOperatorId, 1)); - }else{ - //查询赋值的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logUserId, 2)); - } - } + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logOperatorId, 1,tenantId)); + }else{ + //查询赋值的场站 + return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 2,tenantId)); } }else{ - return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logUserId, 0)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 0,tenantId)); } - return AjaxResult.success(); } @Override - public AjaxResult getInternetUserIList(Long internetUserId, Long userId, Integer type) { - return AjaxResult.success(xhpcStatisticsServiceMapper.getInternetUserIList(internetUserId, userId, type)); + public AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId, Long userId, Integer type) { + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); + return AjaxResult.success(xhpcStatisticsServiceMapper.getInternetUserIList(internetUserId, sysUserId, type,tenantId)); } @Override - public AjaxResult getTerminalList(Long chargingStationId, Long userId, Integer type) { - - //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); - if(logUserId !=1){ - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logOperatorId, 1)); - }else{ - //查询赋值的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logUserId, 2)); - } - } + public AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId, Long userId, Integer type) { +//获取登陆用户 + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logOperatorId, 1,tenantId)); + }else{ + //查询赋值的场站 + return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, sysUserId, 2,tenantId)); } }else{ - return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logUserId, 0)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, sysUserId, 0,tenantId)); } - - - - return AjaxResult.success(); } @Override - public AjaxResult getSourceList(Long userId, Integer type) { + public AjaxResult getSourceList(HttpServletRequest request,Long userId, Integer type) { //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); //桩的统计、该时段金额 List> list = new ArrayList<>(); - Map landUser = xhpcStatisticsServiceMapper.getLandUser(logUserId); - if (landUser != null) { - if (landUser.get("userType") != null && "02".equals(landUser.get("userType").toString())) { - list = xhpcStatisticsServiceMapper.getInternetList(logUserId); - }else{ - list = xhpcStatisticsServiceMapper.getInternetList(null); - Map map1 =new HashMap<>(); - Map map2 =new HashMap<>(); - map1.put("name","微信"); - map1.put("id","微信"); - map2.put("name","支付宝"); - map2.put("id","支付宝"); - list.add(map1); - list.add(map2); - } + if (UserTypeUtil.SYS_USER_TYPE_TWO.equals(sysUser.getUserType())) { + list = xhpcStatisticsServiceMapper.getInternetList(sysUserId,tenantId); + }else{ + list = xhpcStatisticsServiceMapper.getInternetList(null,tenantId); + Map map1 =new HashMap<>(); + Map map2 =new HashMap<>(); + map1.put("name","微信"); + map1.put("id","微信"); + map2.put("name","支付宝"); + map2.put("id","支付宝"); + list.add(map1); + list.add(map2); } return AjaxResult.success(list); } @Override - public List> getSumSourceList(String startTime, String endTime, String sourceIds, Long userId, Integer type,String chargingStationIds) { + public List> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds, Long userId, Integer type,String chargingStationIds) { List sourceList =new ArrayList<>(); if(!"".equals(sourceIds) && sourceIds !=null){ sourceList= Arrays.asList(sourceIds.split(",")); @@ -433,7 +421,11 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati if(!"".equals(chargingStationIds) && chargingStationIds !=null){ chargingStationIdList= Arrays.asList(chargingStationIds.split(",")); } - return xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, userId, type,chargingStationIdList); + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); + return xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId); } @Override @@ -507,8 +499,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati @Override - public void timeIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { - List> list = getTimeIntervalPage(chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type); + public void timeIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { + List> list = getTimeIntervalPage(request,chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); @@ -546,8 +538,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati @Override - public void dateIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { - List> list = getDateIntervalPage(chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type); + public void dateIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { + List> list = getDateIntervalPage(request,chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); @@ -588,8 +580,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati } @Override - public void stationIntervalExport(HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { - List> list = getStationIntervalPage(chargingStationIds, operatorIds, internetUserId, operatorId, startTime, endTime, userId, type); + public void stationIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { + List> list = getStationIntervalPage(request,chargingStationIds, operatorIds, internetUserId, operatorId, startTime, endTime, userId, type); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); @@ -632,8 +624,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati } @Override - public void operatorIntervalExport(HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { - List> list = getOperatorIntervalPage(operatorIds, operatorId, startTime, endTime, userId, type); + public void operatorIntervalExport(HttpServletRequest request,HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { + List> list = getOperatorIntervalPage(request,operatorIds, operatorId, startTime, endTime, userId, type); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); @@ -676,9 +668,9 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati @Override - public void getSumSourceListExport(HttpServletResponse response, String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds) throws IOException { + public void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds) throws IOException { - List> list = getSumSourceList(startTime, endTime, sourceIds, userId, type,chargingStationIds); + List> list = getSumSourceList(request,startTime, endTime, sourceIds, userId, type,chargingStationIds); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); @@ -721,8 +713,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati @Override - public void terminalIntervalExport(HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { - List> list = getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, userId, type); + public void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { + List> list = getTerminalIntervalPage(request,chargingStationId, terminalId, operatorId, startTime, endTime, userId, type); // 通过工具类创建writer,默认创建xls格式 ExcelWriter writer = ExcelUtil.getWriter(true); diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml index ece34bd9..64ece5ca 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml @@ -327,15 +327,12 @@ cor.serial_number as serialNumber, cs.name as chargingStationName, ter.name as terminalName, - ho.history_order_id as historyOrderId, - ho.act_price as actPrice, cor.charging_time as chargingTime, cor.charging_degree as chargingDegree, cor.status as status from xhpc_charge_order as cor left join xhpc_charging_station as cs on cs.charging_station_id = cor.charging_station_id left join xhpc_terminal as ter on ter.terminal_id=cor.terminal_id - left join xhpc_history_order as ho on ho.charge_order_id = cor.charge_order_id where cor.status =2 and cor.del_flag =0 and cor.user_id=#{userId} @@ -647,7 +644,7 @@ from xhpc_terminal as xt left join xhpc_charging_pile as xcp on xcp.serial_number = substring(#{serialNumber}, 1, 14) left join xhpc_charging_station as cs on xt.charging_station_id = cs.charging_station_id - where xt.serial_number = #{serialNumber} + where xt.serial_number = #{serialNumber} and xt.del_falg = 0 @@ -668,6 +671,8 @@ when ho.charging_mode="2" then "恒大" when ho.charging_mode="3" then "新电途" when ho.charging_mode="4" then "小桔" + when ho.charging_mode="微信" then "微信" + when ho.charging_mode="支付宝" then "支付宝" else "C端客户" end chargingModeName from xhpc_history_order as ho @@ -910,4 +915,58 @@ + + diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml index e81c2180..e6bd2a26 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -101,6 +101,9 @@ and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) + + and tenant_id = #{tenantId} + group by status order by status @@ -145,6 +148,9 @@ and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) + + and tenant_id = #{tenantId} + group by DATE_FORMAT(create_time,'%Y-%m-%d') order by DATE_FORMAT(create_time,'%Y-%m-%d') desc @@ -199,6 +205,9 @@ #{operatorId} + + and ss.tenant_id = #{tenantId} + group by ss.charging_station_id @@ -244,6 +253,9 @@ and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) + + and ss.tenant_id = #{tenantId} + group by ss.operator_id @@ -286,6 +298,9 @@ and ss.internet_user_id =#{internetUserId} + + and ss.tenant_id = #{tenantId} + group by ss.internet_user_id @@ -333,6 +348,9 @@ and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) + + and ss.tenant_id = #{tenantId} + group by ss.terminal_id @@ -348,6 +366,9 @@ and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) + + and tenant_id = #{tenantId} + @@ -357,13 +378,15 @@ name as operatorName from xhpc_operator where 1=1 - and operator_id in (select operator_id from xhpc_charging_station where operator_id=#{userId}) and operator_id in (select operator_id from xhpc_charging_station where charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})) + + and tenant_id = #{tenantId} + @@ -766,6 +794,9 @@ and internet_user_id=#{userId} + + and tenant_id = #{tenantId} + diff --git a/xhpc-modules/xhpc-payment/pom.xml b/xhpc-modules/xhpc-payment/pom.xml index bb3ef119..3c43cfbf 100644 --- a/xhpc-modules/xhpc-payment/pom.xml +++ b/xhpc-modules/xhpc-payment/pom.xml @@ -81,6 +81,10 @@ 3.0.0 compile + + com.ruoyi + ruoyi-common-log + diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/AlipayPaymentController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/AlipayPaymentController.java index 855dab4a..9c18eb43 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/AlipayPaymentController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/AlipayPaymentController.java @@ -35,6 +35,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.*; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; @@ -68,6 +70,7 @@ public class AlipayPaymentController { private static final Logger logger = LoggerFactory.getLogger(AlipayPaymentController.class); + @Log(title = "支付宝-支付", businessType = BusinessType.INSERT) @NoRepeatSubmit @PostMapping("/payment") @ApiOperation(value = "支付宝支付") diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java index 0d418809..c1af930b 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java @@ -10,6 +10,8 @@ import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.WXPayUtil; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.data.down.StartChargingData; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.payment.domain.XhpcAppUser; @@ -78,6 +80,7 @@ public class WxPaymentController { private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class); + @Log(title = "微信-支付", businessType = BusinessType.INSERT) @NoRepeatSubmit @PostMapping("/payment") @ApiOperation(value = "微信支付") diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java index 0a380825..90158226 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java @@ -18,6 +18,8 @@ import com.xhpc.common.core.utils.WXPayUtil; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.payment.domain.XhpcAppUser; @@ -99,6 +101,7 @@ public class XhpcRefundAuditController extends BaseController { * @param xhpcRefundAudit * @return */ + @Log(title = "退款-审核", businessType = BusinessType.UPDATE) @PostMapping("/examine") @ApiOperation(value = "退款审核") @Transactional diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java index 5a894afb..cdc749ac 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java @@ -8,6 +8,8 @@ import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.payment.service.IXhpcCommonPayment; @@ -44,6 +46,7 @@ public class XhpcRefundOrderController extends BaseController { * * @return */ + @Log(title = "申请退款", businessType = BusinessType.INSERT) @NoRepeatSubmit @PostMapping("/checkOut") @ApiOperation(value = "申请退款") diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcUserAccountStatementServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcUserAccountStatementServiceImpl.java index 4dbacb4c..b81f41e0 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcUserAccountStatementServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcUserAccountStatementServiceImpl.java @@ -6,10 +6,13 @@ import com.xhpc.common.core.domain.R; import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.service.BaseService; import com.xhpc.common.security.service.TokenService; +import com.xhpc.payment.controller.AlipayPaymentController; import com.xhpc.payment.domain.XhpcUserAccountStatement; import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper; import com.xhpc.payment.service.IXhpcUserAccountStatementService; import com.xhpc.system.api.model.LoginUser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,7 +39,7 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements @Autowired private TokenService tokenService; - + private static final Logger logger = LoggerFactory.getLogger(XhpcUserAccountStatementServiceImpl.class); /** * 新增 用户流水 * @@ -51,7 +54,7 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements /** * 用户流水分页列表 * - * @param appUserId C端用户id + * @param C端用户id * @return */ @Override @@ -64,13 +67,12 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements R user = userTypeService.getUser(null, userid, userType, null, tenantId); if(user !=null && user.getData() !=null){ Map userMessage = (Map)user.getData(); - if (userMessage == null) { + if (userMessage != null) { startPage(); return xhpcUserAccountStatementMapper.page(userid,userType,tenantId); } } return list; - //return xhpcUserAccountStatementMapper.page(appUserId); } /** @@ -115,7 +117,7 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements /** * 用户流水列表 * - * @param appUserId C端用户id + * @param C端用户id * @return */ @Override @@ -129,7 +131,7 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements R user = userTypeService.getUser(null, userid, userType, null, tenantId); if(user !=null && user.getData() !=null){ Map userMessage = (Map)user.getData(); - if (userMessage == null) { + if (userMessage != null) { return xhpcUserAccountStatementMapper.list(userid,userType,tenantId); } } diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml index 0f020fd3..9a6cdc92 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml @@ -139,10 +139,10 @@ and xau.app_user_id = #{appUserId} - and xau.tenant_id = #{tenantId} + and xuas.tenant_id = #{tenantId} - and xau.source = #{source} + and xuas.source = #{source} ORDER BY xuas.create_time DESC @@ -188,10 +188,10 @@ and xau.app_user_id = #{appUserId} - and xau.tenant_id = #{tenantId} + and xuas.tenant_id = #{tenantId} - and xau.source = #{source} + and xuas.source = #{source} ORDER BY xuas.create_time DESC diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/mapper/XhpcDeviceMessageMapper.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/mapper/XhpcDeviceMessageMapper.java similarity index 90% rename from xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/mapper/XhpcDeviceMessageMapper.java rename to xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/mapper/XhpcDeviceMessageMapper.java index a0f2fb54..382e89e2 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/mapper/XhpcDeviceMessageMapper.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/mapper/XhpcDeviceMessageMapper.java @@ -1,4 +1,4 @@ -package com.xhpc.pp.mapper; +package com.xhpc.mapper; import com.xhpc.pp.domain.XhpcDeviceMessage; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/ChargingController.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/ChargingController.java index adf450b4..cc720066 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/ChargingController.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/ChargingController.java @@ -11,7 +11,7 @@ import com.xhpc.common.data.down.StartChargingData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.logic.RateModelRequestLogic; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.server.ChargingPileServer; import com.xhpc.pp.utils.HexUtils; import com.xhpc.pp.utils.security.CRCCalculator; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/domain/XhpcDeviceMessage.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/domain/XhpcDeviceMessage.java index 7f35d596..b3881863 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/domain/XhpcDeviceMessage.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/domain/XhpcDeviceMessage.java @@ -8,18 +8,41 @@ import java.util.Date; @Data public class XhpcDeviceMessage { + /** + * 消息ID + */ private Long deviceMessageId; + /** + * 设备类型 + */ private String type; + /** + * 设备编码 + */ private String serialNumber; + /** + * 充电订单号 + */ + private String chargeOrderNo; + + /** + * 报文内容 + */ private String content; - private String replyContent; - + /** + * 状态 + */ private Integer status; + /** + * 备注描述 + */ + private String remark; + private Date createTime; private String createBy; @@ -28,5 +51,4 @@ public class XhpcDeviceMessage { private String updateBy; - private String remark; } diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BalanceUpdateReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BalanceUpdateReplyDataLogic.java index ba79e1ae..d74e45fe 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BalanceUpdateReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BalanceUpdateReplyDataLogic.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.xhpc.common.data.up.BalanceUpdateReplyData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargerInterruptDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargerInterruptDataLogic.java index 5b10bc89..f91f8a46 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargerInterruptDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargerInterruptDataLogic.java @@ -1,16 +1,13 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; -import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.domain.XhpcMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -22,8 +19,7 @@ import java.util.Map; public class BmsChargerInterruptDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class); - @Autowired - private XhpcMessageMapper xhpcMessageMapper; + @Resource XhpcDeviceMessageMapper deviceMessageMapper; @@ -31,18 +27,13 @@ public class BmsChargerInterruptDataLogic implements ServiceLogic { public ServiceResult service(ServiceParameter sp) throws Exception { String remark = "充电桩与 BMS 充电阶段充电机中止报文"; Map req = sp.getParameters(); - XhpcMessage msg = new XhpcMessage(); - msg.setContent((String) req.get("hex")); - msg.setChargeOrderNo((String) req.get("orderNo")); - msg.setRemark(remark); - xhpcMessageMapper.insertItemsBy(msg); - XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setSerialNumber(sp.getPileNo()); deviceMessage.setRemark(remark); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(false); } diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingCompletedDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingCompletedDataLogic.java index 8920327f..d177fa96 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingCompletedDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingCompletedDataLogic.java @@ -1,16 +1,13 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; -import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.domain.XhpcMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -22,8 +19,6 @@ import java.util.Map; public class BmsChargingCompletedDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(BmsChargingCompletedDataLogic.class); - @Autowired - private XhpcMessageMapper xhpcMessageMapper; @Resource XhpcDeviceMessageMapper deviceMessageMapper; @@ -32,12 +27,6 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic { public ServiceResult service(ServiceParameter sp) throws Exception { String remark = "充电桩与 BMS 充电结束阶段报文"; Map req = sp.getParameters(); - XhpcMessage msg = new XhpcMessage(); - msg.setContent((String) req.get("hex")); - msg.setChargeOrderNo((String) req.get("orderNo")); - msg.setRemark(remark); - xhpcMessageMapper.insertItemsBy(msg); - XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); deviceMessage.setType(StationDeviceEnum.PILE.getCode()); @@ -45,6 +34,7 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic { deviceMessage.setRemark(remark); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(false); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingConfigDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingConfigDataLogic.java index a8107214..940825ac 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingConfigDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingConfigDataLogic.java @@ -1,16 +1,13 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; -import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.domain.XhpcMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -22,8 +19,6 @@ import java.util.Map; public class BmsChargingConfigDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(BmsChargingConfigDataLogic.class); - @Autowired - private XhpcMessageMapper xhpcMessageMapper; @Resource XhpcDeviceMessageMapper deviceMessageMapper; @@ -33,11 +28,6 @@ public class BmsChargingConfigDataLogic implements ServiceLogic { String remark = "充电桩与 BMS 参数配置阶段报文"; Map req = sp.getParameters(); - XhpcMessage msg = new XhpcMessage(); - msg.setContent((String) req.get("hex")); - msg.setChargeOrderNo((String) req.get("orderNo")); - msg.setRemark(remark); - xhpcMessageMapper.insertItemsBy(msg); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); deviceMessage.setType(StationDeviceEnum.PILE.getCode()); @@ -45,6 +35,7 @@ public class BmsChargingConfigDataLogic implements ServiceLogic { deviceMessage.setRemark(remark); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(false); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingDataLogic.java index 2760eab0..2976e2bb 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingDataLogic.java @@ -1,16 +1,17 @@ package com.xhpc.pp.logic; -import com.xhpc.mapper.XhpcMessageMapper; -import com.xhpc.pp.domain.XhpcMessage; +import com.xhpc.common.enums.StationDeviceEnum; +import com.xhpc.pp.domain.XhpcDeviceMessage; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; +import javax.annotation.Resource; import java.util.Map; @Lazy @@ -18,18 +19,23 @@ import java.util.Map; public class BmsChargingDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(BmsChargingDataLogic.class); - @Autowired - private XhpcMessageMapper xhpcMessageMapper; + @Resource + XhpcDeviceMessageMapper deviceMessageMapper; @Override public ServiceResult service(ServiceParameter sp) throws Exception { Map req = sp.getParameters(); - XhpcMessage msg = new XhpcMessage(); - msg.setContent((String) req.get("hex")); - msg.setChargeOrderNo((String) req.get("orderNo")); - msg.setRemark("充电桩与 BMS 充电过程 BMS 信息"); - xhpcMessageMapper.insertItemsBy(msg); + + XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); + deviceMessage.setType(StationDeviceEnum.PILE.getCode()); + deviceMessage.setSerialNumber(sp.getPileNo()); + deviceMessage.setRemark("充电桩与 BMS 充电过程 BMS 信息"); + deviceMessage.setStatus(0); + deviceMessage.setContent((String) req.get("hex")); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); + deviceMessageMapper.insertByDomain(deviceMessage); + return new ServiceResult(false); } diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingHandshakeDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingHandshakeDataLogic.java index 6b25ec30..18c70ce9 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingHandshakeDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsChargingHandshakeDataLogic.java @@ -1,16 +1,13 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; -import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.domain.XhpcMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -22,8 +19,6 @@ import java.util.Map; public class BmsChargingHandshakeDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(BmsChargingHandshakeDataLogic.class); - @Autowired - private XhpcMessageMapper xhpcMessageMapper; @Resource XhpcDeviceMessageMapper deviceMessageMapper; @@ -33,11 +28,6 @@ public class BmsChargingHandshakeDataLogic implements ServiceLogic { String remark = "充电桩与 BMS 充电握手阶段报文"; Map req = sp.getParameters(); - XhpcMessage msg = new XhpcMessage(); - msg.setContent((String) req.get("hex")); - msg.setChargeOrderNo((String) req.get("orderNo")); - msg.setRemark(remark); - xhpcMessageMapper.insertItemsBy(msg); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); deviceMessage.setType(StationDeviceEnum.PILE.getCode()); @@ -45,6 +35,7 @@ public class BmsChargingHandshakeDataLogic implements ServiceLogic { deviceMessage.setRemark(remark); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(false); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsErrorDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsErrorDataLogic.java index c335450d..71b22460 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsErrorDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsErrorDataLogic.java @@ -1,16 +1,13 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; -import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.domain.XhpcMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -22,8 +19,7 @@ import java.util.Map; public class BmsErrorDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(BmsErrorDataLogic.class); - @Autowired - private XhpcMessageMapper xhpcMessageMapper; + @Resource XhpcDeviceMessageMapper deviceMessageMapper; @@ -31,11 +27,6 @@ public class BmsErrorDataLogic implements ServiceLogic { public ServiceResult service(ServiceParameter sp) throws Exception { String remark = "充电桩与 BMS 充电错误报文"; Map req = sp.getParameters(); - XhpcMessage msg = new XhpcMessage(); - msg.setContent((String) req.get("hex")); - msg.setChargeOrderNo((String) req.get("orderNo")); - msg.setRemark(remark); - xhpcMessageMapper.insertItemsBy(msg); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); deviceMessage.setType(StationDeviceEnum.PILE.getCode()); @@ -43,6 +34,8 @@ public class BmsErrorDataLogic implements ServiceLogic { deviceMessage.setRemark(remark); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); + deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(false); } diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsInterruptDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsInterruptDataLogic.java index 568f7af9..715cefd6 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsInterruptDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsInterruptDataLogic.java @@ -1,16 +1,13 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; -import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.domain.XhpcMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -22,8 +19,7 @@ import java.util.Map; public class BmsInterruptDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(BmsInterruptDataLogic.class); - @Autowired - private XhpcMessageMapper xhpcMessageMapper; + @Resource XhpcDeviceMessageMapper deviceMessageMapper; @@ -31,11 +27,6 @@ public class BmsInterruptDataLogic implements ServiceLogic { public ServiceResult service(ServiceParameter sp) throws Exception { String remark = "充电桩与 BMS 充电阶段 BMS 中止报文"; Map req = sp.getParameters(); - XhpcMessage msg = new XhpcMessage(); - msg.setContent((String) req.get("hex")); - msg.setChargeOrderNo((String) req.get("orderNo")); - msg.setRemark(remark); - xhpcMessageMapper.insertItemsBy(msg); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); deviceMessage.setType(StationDeviceEnum.PILE.getCode()); @@ -43,6 +34,8 @@ public class BmsInterruptDataLogic implements ServiceLogic { deviceMessage.setRemark(remark); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); + deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(false); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsReqChargerOutputDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsReqChargerOutputDataLogic.java index dafb9b36..f5a0e61c 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsReqChargerOutputDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsReqChargerOutputDataLogic.java @@ -1,16 +1,17 @@ package com.xhpc.pp.logic; -import com.xhpc.mapper.XhpcMessageMapper; -import com.xhpc.pp.domain.XhpcMessage; +import com.xhpc.common.enums.StationDeviceEnum; +import com.xhpc.pp.domain.XhpcDeviceMessage; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; +import javax.annotation.Resource; import java.util.Map; @Lazy @@ -18,18 +19,23 @@ import java.util.Map; public class BmsReqChargerOutputDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(BmsReqChargerOutputDataLogic.class); - @Autowired - private XhpcMessageMapper xhpcMessageMapper; + @Resource + XhpcDeviceMessageMapper deviceMessageMapper; @Override public ServiceResult service(ServiceParameter sp) throws Exception { Map req = sp.getParameters(); - XhpcMessage msg = new XhpcMessage(); - msg.setContent((String) req.get("hex")); - msg.setChargeOrderNo((String) req.get("orderNo")); - msg.setRemark("充电桩与 BMS 充电过程 BMS 需求、充电机输出"); - xhpcMessageMapper.insertItemsBy(msg); + + XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); + deviceMessage.setType(StationDeviceEnum.PILE.getCode()); + deviceMessage.setSerialNumber(sp.getPileNo()); + deviceMessage.setRemark("充电桩与 BMS 充电过程 BMS 需求、充电机输出"); + deviceMessage.setStatus(0); + deviceMessage.setContent((String) req.get("hex")); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); + deviceMessageMapper.insertByDomain(deviceMessage); + return new ServiceResult(false); } diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardEraseReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardEraseReplyDataLogic.java index bb063596..31912978 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardEraseReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardEraseReplyDataLogic.java @@ -2,7 +2,7 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardInquiryReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardInquiryReplyDataLogic.java index 35cc7aac..784ce841 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardInquiryReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardInquiryReplyDataLogic.java @@ -2,7 +2,7 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardSyncReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardSyncReplyDataLogic.java index 58722743..1b7fd7da 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardSyncReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OfflineCardSyncReplyDataLogic.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.xhpc.common.data.up.OfflineCardSyncReplyData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OrderDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OrderDataLogic.java index b39a30b0..211316da 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OrderDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OrderDataLogic.java @@ -30,6 +30,7 @@ import static com.xhpc.pp.utils.security.CacheDataUtils.reflectTranslate; public class OrderDataLogic implements ServiceLogic { private static final Logger log = LoggerFactory.getLogger(OrderDataLogic.class); + @Autowired private PileOrderService pileOrderService; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileConfigReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileConfigReplyDataLogic.java index 26ea5a1d..09a34622 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileConfigReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileConfigReplyDataLogic.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileStartChargingDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileStartChargingDataLogic.java index b1ebee5d..5980deed 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileStartChargingDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileStartChargingDataLogic.java @@ -7,7 +7,7 @@ import com.xhpc.mapper.IccardInfoMapper; import com.xhpc.pp.domain.IccardInfo; import com.xhpc.pp.domain.IccardInfoExample; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileTimeConfigReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileTimeConfigReplyDataLogic.java index 8869294c..5dc550e1 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileTimeConfigReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileTimeConfigReplyDataLogic.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.xhpc.common.data.up.PileTimeConfigReplyData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelConfigReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelConfigReplyDataLogic.java index ba98ca30..5065694e 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelConfigReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelConfigReplyDataLogic.java @@ -5,7 +5,7 @@ import com.xhpc.common.api.dto.ChargingStationDto; import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; @@ -55,7 +55,6 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic { deviceMessage.setRemark(remark); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); - deviceMessage.setReplyContent(result); deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(result); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelRequestLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelRequestLogic.java index 3a1a6f0d..97875b0d 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelRequestLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelRequestLogic.java @@ -6,7 +6,7 @@ import com.xhpc.common.api.dto.ChargingStationDto; import com.xhpc.common.data.redis.CacheRateModel; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; @@ -56,7 +56,6 @@ public class RateModelRequestLogic implements ServiceLogic { deviceMessage.setRemark("充电桩计费模型请求"); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); - deviceMessage.setReplyContent(resultStr); deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelValidateLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelValidateLogic.java index 236272b0..bcf50f03 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelValidateLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RateModelValidateLogic.java @@ -3,7 +3,7 @@ package com.xhpc.pp.logic; import com.xhpc.common.api.dto.ChargingStationDto; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; @@ -72,7 +72,6 @@ public class RateModelValidateLogic implements ServiceLogic { deviceMessage.setRemark("计费模型验证请求"); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); - deviceMessage.setReplyContent(resultStr); deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(HexUtils.toBytes(resultStr), resultCode); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java index f9205cb8..252c3af4 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java @@ -3,7 +3,7 @@ package com.xhpc.pp.logic; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.evcs.dto.ConnectorStatusInfo; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; @@ -91,7 +91,6 @@ public class RegisterLogic implements ServiceLogic { deviceMessage.setRemark("充电桩登录认证"); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex")); - deviceMessage.setReplyContent(resultStr); deviceMessageMapper.insertByDomain(deviceMessage); return new ServiceResult(HexUtils.toBytes(resultStr), resultCode); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteRestartReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteRestartReplyDataLogic.java index 12137040..808bc2b5 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteRestartReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteRestartReplyDataLogic.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteUpgradeReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteUpgradeReplyDataLogic.java index e28856fa..0c3c4376 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteUpgradeReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteUpgradeReplyDataLogic.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.logic.ServiceLogic; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileBinaryHandler.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileBinaryHandler.java index 0546455d..70e23b88 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileBinaryHandler.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileBinaryHandler.java @@ -3,7 +3,10 @@ package com.xhpc.pp.server; import cn.hutool.core.date.DateUtil; import com.alibaba.nacos.api.exception.NacosException; import com.xhpc.common.api.dto.ChargingStationDto; +import com.xhpc.common.enums.StationDeviceEnum; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.domain.ServiceField; +import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.logic.FieldLogic; import com.xhpc.pp.logic.ServiceMainLogic; import com.xhpc.pp.tx.ServiceParameter; @@ -47,11 +50,13 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler { // private static final String DATA_TYPE_HEX = "hex"; private final ServiceMainLogic servicemainLogic; + private final XhpcDeviceMessageMapper xhpcDeviceMessageMapper; public ChargingPileBinaryHandler() { servicemainLogic = SpringContextHolder.getBean("ServiceMainLogic"); + xhpcDeviceMessageMapper = SpringContextHolder.getBean(XhpcDeviceMessageMapper.class); } @Override @@ -115,6 +120,14 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler { } else { log.debug("server send msg >>>> ({}) |{}|", pileNo, toHex(result.getBinary())); handler.sendClientBinary(result.getBinary()); + XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); + deviceMessage.setType(StationDeviceEnum.PILE.getCode()); + deviceMessage.setSerialNumber(sp.getPileNo()); + deviceMessage.setRemark("平台下发/回复充电桩"); + deviceMessage.setStatus(0); + deviceMessage.setContent(HexUtils.toString(result.getBinary())); + deviceMessage.setChargeOrderNo((String) req.get("orderNo")); + xhpcDeviceMessageMapper.insertByDomain(deviceMessage); } if (SERVICE_HB.equals(serviceName) && OK.equals(resultCode)) { Boolean tcfg = (Boolean) cachePile.get("tcfg"); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/HBCheckTask.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/HBCheckTask.java index 6fc1d521..887cd00e 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/HBCheckTask.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/HBCheckTask.java @@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; -import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; +import com.xhpc.mapper.XhpcDeviceMessageMapper; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -44,7 +44,6 @@ public class HBCheckTask { String pileId= StrUtil.sub(gunkey.substring(gunkey.lastIndexOf(":") + 1), 0, -2); deviceMessage.setSerialNumber(pileId); - deviceMessage.setContent(JSON.toJSONString(cacheGun)); deviceMessage.setStatus(0); deviceMessage.setRemark("充电桩心跳掉线"); deviceMessageMapper.insertByDomain(deviceMessage); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CacheDataUtils.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CacheDataUtils.java index 97b5e6b9..779ab9f1 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CacheDataUtils.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CacheDataUtils.java @@ -40,6 +40,8 @@ public class CacheDataUtils { } } else if (tarFieldName.contains("ime")) { tarval = DateUtil.format(cp56toDate(srcval), NORM_DATETIME_FORMAT); + } else if (tarFieldName.startsWith("vin")) { + tarval = HexUtils.toAscii(srcval); } else { tarval = srcval; } diff --git a/xhpc-modules/xhpc-power-pile/src/main/resources/mapper/XhpcDeviceMessageMapper.xml b/xhpc-modules/xhpc-power-pile/src/main/resources/mapper/XhpcDeviceMessageMapper.xml index e454c7c6..9f546975 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/resources/mapper/XhpcDeviceMessageMapper.xml +++ b/xhpc-modules/xhpc-power-pile/src/main/resources/mapper/XhpcDeviceMessageMapper.xml @@ -1,14 +1,14 @@ - + - + @@ -19,10 +19,11 @@ insert into xhpc_device_message( - type, + + type, serial_number, content, - reply_content, + charge_order_no, status, create_by, remark, @@ -30,10 +31,10 @@ create_time, update_time )values( - #{type}, + #{type}, #{serialNumber}, #{content}, - #{replyContent}, + #{chargeOrderNo}, #{status}, #{createBy}, #{remark}, diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommunityController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommunityController.java index e70eb708..2d569784 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommunityController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommunityController.java @@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.common.util.UserTypeUtil; import com.xhpc.user.domain.XhpcCommunity; import com.xhpc.user.domain.XhpcCommunityPersonnel; import com.xhpc.user.service.IXhpcCommunityService; @@ -49,6 +50,7 @@ public class XhpcCommunityController extends BaseController { /** * 删除社区组树 */ + @Log(title = "社区", businessType = BusinessType.DELETE) @PostMapping(value = "/deleteCommunity") public AjaxResult deleteCommunity(@RequestBody XhpcCommunity xhpcCommunity) { return xhpcCommunityService.deleteCommunity(xhpcCommunity); @@ -67,6 +69,7 @@ public class XhpcCommunityController extends BaseController { * * @return */ + @Log(title = "社区", businessType = BusinessType.UPDATE) @PostMapping(value = "/updateCommunity") public AjaxResult updateCommunity(@RequestBody XhpcCommunity xhpcCommunity) { return xhpcCommunityService.updateCommunity(xhpcCommunity); @@ -89,6 +92,7 @@ public class XhpcCommunityController extends BaseController { * 社区人员添加 * */ + @Log(title = "社区人员", businessType = BusinessType.INSERT) @PostMapping(value = "/addCommunityPersonnel") public AjaxResult addCommunityPersonnel(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) { return xhpcCommunityService.addCommunityPersonnel(xhpcCommunityPersonnel); @@ -107,6 +111,7 @@ public class XhpcCommunityController extends BaseController { * 编辑社区人员 * */ + @Log(title = "社区人员", businessType = BusinessType.UPDATE) @PostMapping(value = "/updateCommunityPersonnel") public AjaxResult updateCommunityPersonnel(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) { return xhpcCommunityService.updateCommunityPersonnel(xhpcCommunityPersonnel); @@ -115,6 +120,7 @@ public class XhpcCommunityController extends BaseController { /** * 删除社区人员 */ + @Log(title = "社区人员", businessType = BusinessType.DELETE) @PostMapping(value = "/deleteCommunityPersonnel") public AjaxResult deleteCommunityPersonnel(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) { xhpcCommunityService.deleteCommunityPersonnel(xhpcCommunityPersonnel); @@ -124,6 +130,7 @@ public class XhpcCommunityController extends BaseController { /** * 改变社区人员状态 */ + @Log(title = "社区人员-状态", businessType = BusinessType.UPDATE) @PostMapping(value = "/updateCommunityPersonnelStatus") public AjaxResult updateCommunityPersonnelStatus(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) { xhpcCommunityService.updateCommunityPersonnelStatus(xhpcCommunityPersonnel); @@ -133,8 +140,10 @@ public class XhpcCommunityController extends BaseController { /** * 充值 */ + @Log(title = "社区人员-充值", businessType = BusinessType.INSERT) @PostMapping(value = "/addRecharge") public AjaxResult addRecharge(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) { + xhpcCommunityPersonnel.setRechargeType(UserTypeUtil.RECHARGE_PT); return xhpcCommunityService.addRecharge(xhpcCommunityPersonnel); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCustomersController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCustomersController.java index baf20483..dbb3e958 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCustomersController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCustomersController.java @@ -3,6 +3,9 @@ package com.xhpc.user.controller; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.common.util.UserTypeUtil; import com.xhpc.user.domain.XhpcCustomers; import com.xhpc.user.domain.XhpcCustomersPersonnel; import com.xhpc.user.service.IXhpcCustomersService; @@ -39,6 +42,7 @@ public class XhpcCustomersController extends BaseController { * * @return */ + @Log(title = "大客户组", businessType = BusinessType.INSERT) @PostMapping(value = "/addCustomers") public AjaxResult addCustomers(HttpServletRequest request, @RequestBody XhpcCustomers xhpcCustomers) { return xhpcCustomersService.addCustomers(request,xhpcCustomers); @@ -47,6 +51,7 @@ public class XhpcCustomersController extends BaseController { /** * 删除大客户 */ + @Log(title = "大客户组", businessType = BusinessType.DELETE) @PostMapping(value = "/deleteCustomers") public AjaxResult deleteCustomers(@RequestBody XhpcCustomers xhpcCustomers) { return xhpcCustomersService.deleteCustomers(xhpcCustomers); @@ -65,6 +70,7 @@ public class XhpcCustomersController extends BaseController { * * @return */ + @Log(title = "大客户组", businessType = BusinessType.UPDATE) @PostMapping(value = "/updateCustomers") public AjaxResult updateCustomers(@RequestBody XhpcCustomers xhpcCustomers) { return xhpcCustomersService.updateCustomers(xhpcCustomers); @@ -83,6 +89,7 @@ public class XhpcCustomersController extends BaseController { * 大客户人员添加 * */ + @Log(title = "大客户人员", businessType = BusinessType.INSERT) @PostMapping(value = "/addCustomersPersonnel") public AjaxResult addCustomersPersonnel(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { return xhpcCustomersService.addCustomersPersonnel(xhpcCustomersPersonnel); @@ -101,6 +108,7 @@ public class XhpcCustomersController extends BaseController { * 编辑大客户人员 * */ + @Log(title = "大客户人员", businessType = BusinessType.UPDATE) @PostMapping(value = "/updateCustomersPersonnel") public AjaxResult updateCustomersPersonnel(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { return xhpcCustomersService.updateCustomersPersonnel(xhpcCustomersPersonnel); @@ -109,6 +117,7 @@ public class XhpcCustomersController extends BaseController { /** * 删除社区人员 */ + @Log(title = "大客户人员", businessType = BusinessType.DELETE) @PostMapping(value = "/deleteCustomersPersonnel") public AjaxResult deleteCustomersPersonnel(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { xhpcCustomersService.deleteCustomersPersonnel(xhpcCustomersPersonnel); @@ -118,14 +127,17 @@ public class XhpcCustomersController extends BaseController { /** * 充值 */ + @Log(title = "大客户人员-充值", businessType = BusinessType.INSERT) @PostMapping(value = "/addRecharge") public AjaxResult addRecharge(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { + xhpcCustomersPersonnel.setRechargeType(UserTypeUtil.RECHARGE_PT); return xhpcCustomersService.addRecharge(xhpcCustomersPersonnel); } /** * 改变社区人员状态 */ + @Log(title = "大客户人员-状态", businessType = BusinessType.UPDATE) @PostMapping(value = "/updateCustomersPersonnelStatus") public AjaxResult updateCustomersPersonnelStatus(@RequestBody XhpcCustomersPersonnel xhpcCustomersPersonnel) { xhpcCustomersService.updateCustomersPersonnelStatus(xhpcCustomersPersonnel); diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java index 249a49ec..530a4432 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java @@ -8,6 +8,8 @@ import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.security.annotation.PreAuthorize; import com.xhpc.system.api.domain.SysUser; import com.xhpc.user.domain.XhpcInternetUser; @@ -43,6 +45,7 @@ public class XhpcInternetUserController extends BaseController { /** * 新增流量用户 */ + @Log(title = "流量用户", businessType = BusinessType.INSERT) @ApiOperation("新增流量用户") @RequiresRoles("admin") @PostMapping("/add") @@ -81,6 +84,7 @@ public class XhpcInternetUserController extends BaseController { /** * 修改流量用户 */ + @Log(title = "流量用户", businessType = BusinessType.UPDATE) @ApiOperation("修改流量用户") @RequiresRoles("admin") @PostMapping("/edit") @@ -118,6 +122,7 @@ public class XhpcInternetUserController extends BaseController { /** * 删除流量用户 */ + @Log(title = "流量用户", businessType = BusinessType.DELETE) @ApiOperation("删除流量用户") @RequiresRoles("admin") @PostMapping("/remove") @@ -154,6 +159,7 @@ public class XhpcInternetUserController extends BaseController { /** * 禁用/启用流量用户 */ + @Log(title = "流量用户-禁用启用", businessType = BusinessType.UPDATE) @ApiOperation("禁用/启用流量用户") @RequiresRoles("admin") @PostMapping("/status") diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorController.java index e3cfe8b1..5a3e9b1e 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorController.java @@ -7,6 +7,8 @@ import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.security.annotation.PreAuthorize; import com.xhpc.system.api.domain.SysUser; import com.xhpc.user.domain.XhpcOperator; @@ -40,6 +42,7 @@ public class XhpcOperatorController extends BaseController { /** * 新增运营商 */ + @Log(title = "运营商", businessType = BusinessType.INSERT) @ApiOperation("新增运营商") @RequiresRoles("admin") @PostMapping("/add") @@ -101,6 +104,7 @@ public class XhpcOperatorController extends BaseController { /** * 修改运营商 */ + @Log(title = "运营商", businessType = BusinessType.UPDATE) @ApiOperation("修改运营商") @PreAuthorize(hasPermi = "user:operator:edit") @RequiresRoles("admin") @@ -121,6 +125,7 @@ public class XhpcOperatorController extends BaseController { /** * 删除运营商 */ + @Log(title = "运营商", businessType = BusinessType.DELETE) @ApiOperation("删除运营商") @RequiresRoles("admin") @PostMapping("/remove") @@ -157,6 +162,7 @@ public class XhpcOperatorController extends BaseController { /** * 禁用/启用运营商 */ + @Log(title = "运营商-禁用启用", businessType = BusinessType.UPDATE) @ApiOperation("禁用/启用运营商") @RequiresRoles("admin") @PostMapping("/status") diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorInternetBlacklistController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorInternetBlacklistController.java index efc9cb8f..924051c7 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorInternetBlacklistController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorInternetBlacklistController.java @@ -3,6 +3,8 @@ package com.xhpc.user.controller; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.user.domain.XhpcOperatorInternetBlacklist; import com.xhpc.user.service.IXhpcOperatorInternetBlacklistService; import io.swagger.annotations.ApiOperation; @@ -28,6 +30,7 @@ public class XhpcOperatorInternetBlacklistController extends BaseController { /** * 新增运营商设置流量方黑名单 */ + @Log(title = "运营商-设置流量方黑名单", businessType = BusinessType.INSERT) @ApiOperation("新增运营商设置流量方黑名单") //@PreAuthorize(hasPermi = "operator:internet:add") @PostMapping("/add") diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcStationInternetBlacklistController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcStationInternetBlacklistController.java index 6be2c863..a81417db 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcStationInternetBlacklistController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcStationInternetBlacklistController.java @@ -3,6 +3,8 @@ package com.xhpc.user.controller; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.user.domain.XhpcStationInternetBlacklist; import com.xhpc.user.service.IXhpcInternetUserService; import com.xhpc.user.service.IXhpcStationInternetBlacklistService; @@ -32,6 +34,7 @@ public class XhpcStationInternetBlacklistController extends BaseController { /** * 新增电站流量方黑名单 */ + @Log(title = "场站-设置流量方黑名单", businessType = BusinessType.INSERT) @ApiOperation("新增电站流量方黑名单") // @PreAuthorize(hasPermi = "station:internet:add") @PostMapping("/add") diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java index fc97e669..9a07b170 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java @@ -7,6 +7,8 @@ import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.security.annotation.PreAuthorize; import com.xhpc.system.api.domain.SysRole; import com.xhpc.system.api.domain.SysUser; @@ -52,6 +54,7 @@ public class XhpcUserController extends BaseController { /** * 新增平台用户 */ + @Log(title = "平台用户", businessType = BusinessType.INSERT) @ApiOperation("新增平台用户") @RequiresRoles("admin") @PostMapping("/pc/add") @@ -82,6 +85,7 @@ public class XhpcUserController extends BaseController { /** * 修改平台用户 */ + @Log(title = "平台用户", businessType = BusinessType.UPDATE) @ApiOperation("修改平台用户") @RequiresRoles("admin") @PostMapping("/pc/edit") @@ -122,6 +126,7 @@ public class XhpcUserController extends BaseController { /** * 新增运营商用户 */ + @Log(title = "运营商用户", businessType = BusinessType.INSERT) @ApiOperation("新增运营商用户") @RequiresPermissions("user:operator:add") @PostMapping("/operator/add") @@ -154,6 +159,7 @@ public class XhpcUserController extends BaseController { /** * 修改运营商用户 */ + @Log(title = "运营商用户", businessType = BusinessType.UPDATE) @ApiOperation("修改运营商用户") @RequiresPermissions("user:operator:edit") @PostMapping("/operator/edit") @@ -181,6 +187,7 @@ public class XhpcUserController extends BaseController { /** * 禁用/启用平台和运营商子账号 */ + @Log(title = "平台和运营商子账号-禁用启用", businessType = BusinessType.UPDATE) @ApiOperation("禁用/启用平台和运营商子账号") //@PreAuthorize(hasPermi = "user:pc:status") @PostMapping("/status") @@ -196,6 +203,7 @@ public class XhpcUserController extends BaseController { /** * 禁用/启用平台和运营商子账号 */ + @Log(title = "平台和运营商子账号-禁用启用", businessType = BusinessType.UPDATE) @ApiOperation("禁用/启用平台和运营商子账号") //@PreAuthorize(hasPermi = "user:pc:status") @PostMapping("/remove") @@ -212,6 +220,7 @@ public class XhpcUserController extends BaseController { /** * 重置密码 */ + @Log(title = "重置密码", businessType = BusinessType.UPDATE) @PostMapping("/reset") public AjaxResult reset(@RequestParam Long userId){ diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java index a700e5eb..9300dc36 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java @@ -421,7 +421,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU if(user !=null && user.getData() !=null){ Map map = (Map)user.getData(); //发票、留言板、版本、客服电话 - Object invoice =null; + String invoice =null; if(UserTypeUtil.USER_TYPE.equals(userType)){ invoice = redisService.getCacheObject("global:invoice:" + UserTypeUtil.USER + userid); }else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){ @@ -436,7 +436,17 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU }else{ map.put("invoiceNumber",invoice); } - map.put("guestbook","0"); + String guestbook =null; + if(UserTypeUtil.USER_TYPE.equals(userType)){ + guestbook = redisService.getCacheObject("userNotReadMessageCount:" + UserTypeUtil.USER +":"+map.get("phone").toString()+":0:"+ loginUser.getTenantId()); + }else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){ + guestbook = redisService.getCacheObject("userNotReadMessageCount:" + UserTypeUtil.INTERNET +":"+map.get("phone").toString()+":0:"+ loginUser.getTenantId()); + }else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){ + guestbook = redisService.getCacheObject("userNotReadMessageCount:" + UserTypeUtil.COMMUNIT +":"+map.get("account").toString()+":0:"+ loginUser.getTenantId()); + }else{ + guestbook = redisService.getCacheObject("userNotReadMessageCount:" + UserTypeUtil.CUSTOMERS +":"+map.get("account").toString()+":0:"+ loginUser.getTenantId()); + } + map.put("guestbook",guestbook); map.put("version",version); map.put("servicePhone",servicePhone); map.put("activity",1); diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java index d5c71d37..7819d836 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java @@ -246,6 +246,11 @@ public class XhpcCustomersServiceImpl extends BaseService implements IXhpcCustom return AjaxResult.error("充值金额大于0"); } + /** + * 社区人员状态改变 + * + * @param xhpcCustomersPersonnel + */ @Override public void updateCustomersPersonnelStatus(XhpcCustomersPersonnel xhpcCustomersPersonnel) { xhpcCustomersMapper.updateCustomersPersonnelStatus(xhpcCustomersPersonnel.getCustomersPersonnelId(),xhpcCustomersPersonnel.getStatus()); @@ -273,7 +278,7 @@ public class XhpcCustomersServiceImpl extends BaseService implements IXhpcCustom if(xhpcCustomersPersonnel.getName()==null || "".equals(xhpcCustomersPersonnel.getName())){ return R.fail("名称必填"); } - if(xhpcCustomersPersonnel.getAccount()==null || "".equals(xhpcCustomersPersonnel.getAccount()) || "BE".equals(xhpcCustomersPersonnel.getAccount().substring(0,2))){ + if(xhpcCustomersPersonnel.getAccount()==null || "".equals(xhpcCustomersPersonnel.getAccount()) || !"BE".equals(xhpcCustomersPersonnel.getAccount().substring(0,2))){ return R.fail("账号必填且BE开头10位"); } if(xhpcCustomersPersonnel.getPhone()==null || "".equals(xhpcCustomersPersonnel.getPhone()) || xhpcCustomersPersonnel.getPhone().length() !=11){ diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml index cd7d2321..0285419a 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml @@ -167,9 +167,9 @@ update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, - soc = #{soc} - is_refund = #{isRefund} - soc_protect = #{socProtect} + soc = #{soc}, + is_refund = #{isRefund}, + soc_protect = #{socProtect}, WHERE app_user_id = #{appUserId} diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml index a4e4ff34..8cf5aef7 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml @@ -202,6 +202,7 @@ consume_money AS consumeMoney, red_packet AS redPacket, surplus_money AS surplusMoney, + create_time as createTime, type, status FROM