Merge branch 'master' into iccard

# Conflicts:
#	xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java
This commit is contained in:
ZZ 2022-01-20 10:24:45 +08:00
commit ae660ec67e
131 changed files with 2826 additions and 519 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@ target/
*.iws *.iws
*.iml *.iml
*.ipr *.ipr
rebel.xml
### NetBeans ### ### NetBeans ###
nbproject/private/ nbproject/private/

View File

@ -135,15 +135,18 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
OrderMappingRepository orderMappingRepository, String operatorId) { OrderMappingRepository orderMappingRepository, String operatorId) {
EtOrderMapping etOrderMapping; EtOrderMapping etOrderMapping;
EtOrderMapping om = new EtOrderMapping(); EtOrderMapping om;
if (internetSerialNumber != null) { if (internetSerialNumber != null) {
om = new EtOrderMapping();
om.setEvcsOrderNo(internetSerialNumber); om.setEvcsOrderNo(internetSerialNumber);
Example<EtOrderMapping> example = Example.of(om); Example<EtOrderMapping> example = Example.of(om);
etOrderMapping = orderMappingRepository.findOne(example).orElse(null); etOrderMapping = orderMappingRepository.findOne(example).orElse(null);
if (etOrderMapping == null) { if (etOrderMapping == null) {
om.setXhOrderNo(xhOrderNo);
etOrderMapping = orderMappingRepository.save(om); etOrderMapping = orderMappingRepository.save(om);
} }
} else { } else {
om = new EtOrderMapping();
om.setXhOrderNo(xhOrderNo); om.setXhOrderNo(xhOrderNo);
Example<EtOrderMapping> example = Example.of(om); Example<EtOrderMapping> example = Example.of(om);
etOrderMapping = orderMappingRepository.findOne(example).orElse(null); etOrderMapping = orderMappingRepository.findOne(example).orElse(null);

View File

@ -45,6 +45,13 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<!--JavaBean验证依赖-->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<!-- SpringCloud 微服务 --> <!-- SpringCloud 微服务 -->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>

View File

@ -25,7 +25,7 @@ public class LoginUser implements Serializable
private Long userid; private Long userid;
/** /**
* 用户 * 用户账号手机号账号
*/ */
private String username; private String username;

View File

@ -54,4 +54,9 @@ public class ServiceNameConstants {
*/ */
public static final String XHPC_PAYMENT = "xhpc-payment"; public static final String XHPC_PAYMENT = "xhpc-payment";
/**
* 卡服务
*/
public static final String XHPC_CARD ="xhpc-card";
} }

View File

@ -37,7 +37,7 @@ public class AuthFilter implements GlobalFilter, Ordered {
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); 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自行添加 // 排除过滤的 uri 地址nacos自行添加
@Autowired @Autowired

View File

@ -11,6 +11,7 @@ import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.annotation.PreAuthorize; 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.SysRole;
import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser; import com.xhpc.system.api.model.LoginUser;
@ -107,6 +108,10 @@ public class SysUserController extends BaseController {
sysUserVo.setTenantId(sysUser.getTenantId()); sysUserVo.setTenantId(sysUser.getTenantId());
sysUserVo.setRoles(roles); sysUserVo.setRoles(roles);
sysUserVo.setPermissions(permissions); sysUserVo.setPermissions(permissions);
sysUserVo.setUsername(username);
sysUserVo.setUserType(UserTypeUtil.USER_TYPE);
sysUserVo.setUserTypeUtil(UserTypeUtil.USER);
sysUserVo.setUserid(sysUser.getUserId());
return R.ok(sysUserVo); return R.ok(sysUserVo);
} }

View File

@ -27,6 +27,7 @@
<result column="update_by" property="updateBy"/> <result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/> <result column="remark" property="remark"/>
<result column="tenant_id" property="tenantId"/>
<result column="operator_id" property="operatorId"/> <result column="operator_id" property="operatorId"/>
<association column="dept_id" property="dept" javaType="com.xhpc.system.api.domain.SysDept" resultMap="deptResult"/> <association column="dept_id" property="dept" javaType="com.xhpc.system.api.domain.SysDept" resultMap="deptResult"/>
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>

24
sql/test-opsecret.sql Normal file
View File

@ -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');

View File

@ -241,7 +241,7 @@ CREATE TABLE `xhpc_device_message`
`type` varchar(50) DEFAULT NULL COMMENT '设备类型PILE-充电桩TERMINAL-终端)', `type` varchar(50) DEFAULT NULL COMMENT '设备类型PILE-充电桩TERMINAL-终端)',
`serial_number` varchar(32) DEFAULT NULL COMMENT '设备流水号', `serial_number` varchar(32) DEFAULT NULL COMMENT '设备流水号',
`content` text CHARACTER SET utf8 COMMENT '报文16进制原文', `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停用', `status` int(10) DEFAULT '0' COMMENT '状态0正常 1停用',
`create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`create_by` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者', `create_by` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者',

View File

@ -19,6 +19,7 @@
<module>xhpc-wxma</module> <module>xhpc-wxma</module>
<module>xhpc-invoice</module> <module>xhpc-invoice</module>
<module>xhpc-tradebill</module> <module>xhpc-tradebill</module>
<module>xhpc-message-board</module>
</modules> </modules>
<artifactId>xhpc-modules</artifactId> <artifactId>xhpc-modules</artifactId>

View File

@ -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);
}

View File

@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Map;
/** /**
* @author yuyang * @author yuyang
@ -18,11 +19,12 @@ public interface UserTypeService {
/** /**
* 根据手机号账号用户id和类型 获取用户信息 * 根据手机号账号用户id和类型 获取用户信息
*
* @param * @param
* @return * @return
*/ */
@GetMapping("/common/getUser") @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<Map<String, Object>> 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);

View File

@ -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<CardService> {
@Override
public CardService create(Throwable cause) {
return new CardService() {
@Override
public R cardStartup(String cardNumber, String serialNumber) {
return R.fail("卡启动判断接口失败:" + cause.getMessage());
}
};
}
}

View File

@ -88,5 +88,8 @@ public class UserTypeUtil {
*/ */
public static final String SYS_USER_TYPE_ZERO = "00"; 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_ONE = "01";
public static final String SYS_USER_TYPE_TWO = "02";
public static final String SYS_USER_TYPE_THREE = "03"; public static final String SYS_USER_TYPE_THREE = "03";
public static final Long SYS_USER_TYPE_ADMIN = 1L;
} }

View File

@ -171,12 +171,23 @@ public class HexUtils {
byte[] bytes = toBytes(hex); byte[] bytes = toBytes(hex);
final StringBuilder result = new StringBuilder(); final StringBuilder result = new StringBuilder();
for (byte b: bytes) { for (byte b : bytes) {
for (int i=0; i<8; i++) { for (int i = 0; i < 8; i++) {
result.append(b >> (8 - (i + 1)) & 0x0001); 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) { public static void main(String[] args) {

View File

@ -3,6 +3,8 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; 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.domain.XhpcAgreement;
import com.xhpc.general.service.IXhpcAgreementService; import com.xhpc.general.service.IXhpcAgreementService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -20,18 +22,22 @@ public class XhpcAgreementController extends BaseController {
@Autowired @Autowired
IXhpcAgreementService iXhpcAgreementService; IXhpcAgreementService iXhpcAgreementService;
@Log(title = "协议-删除", businessType = BusinessType.DELETE)
@PostMapping("/delete") @PostMapping("/delete")
public AjaxResult delete(@RequestBody XhpcAgreement xhpcAgreement){ public AjaxResult delete(@RequestBody XhpcAgreement xhpcAgreement){
return iXhpcAgreementService.deleteAgreementItem(xhpcAgreement.getAgreementId()); return iXhpcAgreementService.deleteAgreementItem(xhpcAgreement.getAgreementId());
} }
@Log(title = "协议-添加", businessType = BusinessType.DELETE)
@PostMapping("/add") @PostMapping("/add")
public AjaxResult add(@RequestBody XhpcAgreement xhpcAgreement){ public AjaxResult add(@RequestBody XhpcAgreement xhpcAgreement){
return iXhpcAgreementService.insertAgreementItem(xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent()); return iXhpcAgreementService.insertAgreementItem(xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent());
} }
@Log(title = "协议-编辑", businessType = BusinessType.UPDATE)
@PostMapping("/update") @PostMapping("/update")
public AjaxResult update(@RequestBody XhpcAgreement xhpcAgreement){ public AjaxResult update(@RequestBody XhpcAgreement xhpcAgreement){
@ -51,6 +57,7 @@ public class XhpcAgreementController extends BaseController {
return AjaxResult.success(iXhpcAgreementService.selectAgreementItem(agreementId)); return AjaxResult.success(iXhpcAgreementService.selectAgreementItem(agreementId));
} }
@GetMapping("/getContent") @GetMapping("/getContent")
public AjaxResult getContent(@RequestParam Integer type){ public AjaxResult getContent(@RequestParam Integer type){

View File

@ -3,6 +3,8 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; 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.domain.XhpcDictionary;
import com.xhpc.general.dto.XhpcDictionaryChild; import com.xhpc.general.dto.XhpcDictionaryChild;
import com.xhpc.general.service.IXhpcDictBizService; import com.xhpc.general.service.IXhpcDictBizService;
@ -42,6 +44,7 @@ public class XhpcDictBizController extends BaseController {
* @param sort the dictionary's sortValue * @param sort the dictionary's sortValue
* @return * @return
*/ */
@Log(title = "字典-添加", businessType = BusinessType.INSERT)
@PostMapping("/addMainItem") @PostMapping("/addMainItem")
public AjaxResult addMainDictionaryItem(@RequestBody XhpcDictionary xhpcDictionary){ public AjaxResult addMainDictionaryItem(@RequestBody XhpcDictionary xhpcDictionary){

View File

@ -3,6 +3,8 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; 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.domain.EtTokenEntity;
import com.xhpc.general.service.IXhpcEtTokenService; import com.xhpc.general.service.IXhpcEtTokenService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -28,12 +30,14 @@ public class XhpcEtTokenController extends BaseController {
return getDataTable(iXhpcEtTokenService.list(operatorId, operatorId3irdpty)); return getDataTable(iXhpcEtTokenService.list(operatorId, operatorId3irdpty));
} }
@Log(title = "第三方token-删除", businessType = BusinessType.DELETE)
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public AjaxResult delete(@RequestBody EtTokenEntity etTokenEntity){ public AjaxResult delete(@RequestBody EtTokenEntity etTokenEntity){
return iXhpcEtTokenService.delete(etTokenEntity.getId()); return iXhpcEtTokenService.delete(etTokenEntity.getId());
} }
@Log(title = "第三方token-添加", businessType = BusinessType.INSERT)
@PostMapping(value = "/add") @PostMapping(value = "/add")
public AjaxResult add(@RequestBody EtTokenEntity etTokenEntity){ public AjaxResult add(@RequestBody EtTokenEntity etTokenEntity){

View File

@ -3,6 +3,8 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; 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.domain.HelpEntity;
import com.xhpc.general.service.IXhpcHelpService; import com.xhpc.general.service.IXhpcHelpService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -22,18 +24,22 @@ public class XhpcHelpController extends BaseController {
@Autowired @Autowired
IXhpcHelpService iXhpcHelpService; IXhpcHelpService iXhpcHelpService;
@Log(title = "帮助-删除", businessType = BusinessType.DELETE)
@PostMapping("/delete") @PostMapping("/delete")
public AjaxResult deleteHelpItem(@RequestBody HelpEntity helpEntity){ public AjaxResult deleteHelpItem(@RequestBody HelpEntity helpEntity){
return iXhpcHelpService.deleteHelpItem(helpEntity.getHelpId()); return iXhpcHelpService.deleteHelpItem(helpEntity.getHelpId());
} }
@Log(title = "帮助-添加", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
public AjaxResult insertHelpItem(@RequestBody HelpEntity helpEntity){ public AjaxResult insertHelpItem(@RequestBody HelpEntity helpEntity){
return iXhpcHelpService.insertHelpItem(helpEntity.getTitle(),helpEntity.getContent(),helpEntity.getType()); return iXhpcHelpService.insertHelpItem(helpEntity.getTitle(),helpEntity.getContent(),helpEntity.getType());
} }
@Log(title = "帮助-修改", businessType = BusinessType.UPDATE)
@PostMapping("/update") @PostMapping("/update")
public AjaxResult updateHelpItem(@RequestBody HelpEntity helpEntity){ public AjaxResult updateHelpItem(@RequestBody HelpEntity helpEntity){

View File

@ -1,6 +1,8 @@
package com.xhpc.general.controller; package com.xhpc.general.controller;
import com.xhpc.common.core.web.domain.AjaxResult; 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 com.xhpc.general.service.IXhpcServiceDataUpdateService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -23,6 +25,7 @@ public class XhpcServiceDataUpdateController {
return AjaxResult.success(xhpcServiceDataUpdateService.list()); return AjaxResult.success(xhpcServiceDataUpdateService.list());
} }
@Log(title = "小程序设置-修改", businessType = BusinessType.UPDATE)
@PostMapping("/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) { public AjaxResult update(@RequestParam(required = false) String SOC, @RequestParam(required = false) String version, @RequestParam(required = false) String phone, @RequestParam(required = false) String aliyunMessageCount) {

View File

@ -19,7 +19,6 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<update id="deleteAgreementItem"> <update id="deleteAgreementItem">
update xhpc_agreement set del_flag=1 where agreement_id=#{agreementId} update xhpc_agreement set del_flag=1 where agreement_id=#{agreementId}
</update> </update>

View File

@ -34,7 +34,6 @@
</select> </select>
<delete id="deleteBy"> <delete id="deleteBy">
delete from et_auth_sec_token delete from et_auth_sec_token
where id = #{id} where id = #{id}
</delete> </delete>

View File

@ -1,4 +1,4 @@
package com.xhpc.invoice; package com.xhpc;
import com.xhpc.common.security.annotation.EnableCustomConfig; import com.xhpc.common.security.annotation.EnableCustomConfig;
import com.xhpc.common.security.annotation.EnableRyFeignClients; import com.xhpc.common.security.annotation.EnableRyFeignClients;

View File

@ -95,7 +95,7 @@ public class XhpcInvoiceController extends BaseController {
public AjaxResult invoiceToUser(@RequestBody InvoiceToUserRequest requestData) { public AjaxResult invoiceToUser(@RequestBody InvoiceToUserRequest requestData) {
//前置条件 //前置条件
if (requestData.getInvoiceId() == null) { if (requestData.getInvoiceId() == null) {
return AjaxResult.error("必须递未开发票id"); return AjaxResult.error("必须传发票id");
} }
if (requestData.getStatus() == null || requestData.getStatus().equals(InvoiceStatusConst.INVOICING)) { if (requestData.getStatus() == null || requestData.getStatus().equals(InvoiceStatusConst.INVOICING)) {
return AjaxResult.error("必须传递发票状态或发票状态不能为0"); return AjaxResult.error("必须传递发票状态或发票状态不能为0");

View File

@ -128,6 +128,8 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean invoiceToUser(InvoiceToUserRequest requestData) { public Boolean invoiceToUser(InvoiceToUserRequest requestData) {
//获取当前时间
requestData.setInvoicingTime(DateUtil.getYyyyMmDdHhMmSs());
//根据操作人的id查询操作人的名字 //根据操作人的id查询操作人的名字
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer())); SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer()));
requestData.setDrawer(sysUser.getNickName()); requestData.setDrawer(sysUser.getNickName());
@ -137,7 +139,14 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
//从阿里云上下载下来电子发票 //从阿里云上下载下来电子发票
String fileUrl = requestData.getEletricInvoiceUrl(); String fileUrl = requestData.getEletricInvoiceUrl();
File electricInvoiceFile = new File(environment.getProperty("file.serverStoreDisposableFileLocation") + "ElectricInvoice.pdf"); 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 { try {
MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile); MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile);
} catch (Exception e) { } catch (Exception e) {
@ -161,6 +170,8 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void failInvoiceToUser(InvoiceToUserRequest requestData) { public void failInvoiceToUser(InvoiceToUserRequest requestData) {
//获取当前时间
requestData.setInvoicingTime(DateUtil.getYyyyMmDdHhMmSs());
//根据操作人的id查询操作人的名字 //根据操作人的id查询操作人的名字
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer())); SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer()));
requestData.setDrawer(sysUser.getNickName()); requestData.setDrawer(sysUser.getNickName());
@ -196,6 +207,11 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
public InvoiceTitleResponse findTitleInfo(String firmName) { public InvoiceTitleResponse findTitleInfo(String firmName) {
List<XhpcInvoice> xhpcInvoiceList = xhpcInvoiceMapper.selectInvoiceTitleInfo(firmName); List<XhpcInvoice> xhpcInvoiceList = xhpcInvoiceMapper.selectInvoiceTitleInfo(firmName);
InvoiceTitleResponse invoiceTitleResponse = new InvoiceTitleResponse();
//如果没有记录则返回空包装类
if (xhpcInvoiceList.size() == 0) {
return invoiceTitleResponse;
}
ArrayList<InvoiceTitleResponse.DataDTO> dataDTOList = new ArrayList<>(); ArrayList<InvoiceTitleResponse.DataDTO> dataDTOList = new ArrayList<>();
for (XhpcInvoice xhpcInvoice : xhpcInvoiceList) { for (XhpcInvoice xhpcInvoice : xhpcInvoiceList) {
InvoiceTitleResponse.DataDTO dataDTO = new InvoiceTitleResponse.DataDTO(); InvoiceTitleResponse.DataDTO dataDTO = new InvoiceTitleResponse.DataDTO();
@ -203,7 +219,6 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
dataDTO.setDutyNumber(xhpcInvoice.getDutyNumber()); dataDTO.setDutyNumber(xhpcInvoice.getDutyNumber());
dataDTOList.add(dataDTO); dataDTOList.add(dataDTO);
} }
InvoiceTitleResponse invoiceTitleResponse = new InvoiceTitleResponse();
invoiceTitleResponse.setData(dataDTOList); invoiceTitleResponse.setData(dataDTOList);
return invoiceTitleResponse; return invoiceTitleResponse;
} }
@ -223,6 +238,10 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectUserLastInputInvoiceInfo(creatorId, creatorType); XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectUserLastInputInvoiceInfo(creatorId, creatorType);
TitleResponse titleResponse = new TitleResponse(); TitleResponse titleResponse = new TitleResponse();
//如果数据库本身就没有数据那么就返回空实体类对象
if (xhpcInvoice == null) {
return titleResponse;
}
BeanUtils.copyProperties(xhpcInvoice, titleResponse); BeanUtils.copyProperties(xhpcInvoice, titleResponse);
return titleResponse; return titleResponse;
@ -241,7 +260,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
public InvoicedOrderResponse findUserHistoryOrders(InvoicedOrdersRequest invoicedOrdersRequest) { public InvoicedOrderResponse findUserHistoryOrders(InvoicedOrdersRequest invoicedOrdersRequest) {
//自动生成当前时间 //自动生成当前时间
if (invoicedOrdersRequest.getCurrentTime() == null) { if (invoicedOrdersRequest.getCurrentTime() == null || "".equals(invoicedOrdersRequest.getCurrentTime())) {
Date currentDate = new Date(); Date currentDate = new Date();
String strTime = DateUtils.parseDateToStr(currentDate); String strTime = DateUtils.parseDateToStr(currentDate);
invoicedOrdersRequest.setCurrentTime(strTime); invoicedOrdersRequest.setCurrentTime(strTime);
@ -251,6 +270,10 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
//查询该用户3个月内可以开发票的历史订单 //查询该用户3个月内可以开发票的历史订单
List<Map<String, Object>> xhpcHistoryOrderList = xhpcHistoryOrderMapper.findByCondition(invoicedOrdersRequest, lockOrderNumberList); List<Map<String, Object>> xhpcHistoryOrderList = xhpcHistoryOrderMapper.findByCondition(invoicedOrdersRequest, lockOrderNumberList);
InvoicedOrderResponse invoicedOrderResponse = new InvoicedOrderResponse(); InvoicedOrderResponse invoicedOrderResponse = new InvoicedOrderResponse();
//没有则直接返回空对象出去
if (xhpcHistoryOrderList.size() == 0) {
return invoicedOrderResponse;
}
//设置该用户3个月内可以开发票的历史订单数量 //设置该用户3个月内可以开发票的历史订单数量
invoicedOrderResponse.setTotalItems(xhpcHistoryOrderList.size()); invoicedOrderResponse.setTotalItems(xhpcHistoryOrderList.size());
//查询该用户所有可以开的发票的历史订单数量 //查询该用户所有可以开的发票的历史订单数量
@ -312,29 +335,6 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
invoicedOrderResponse.setItems(itemsDTOS); invoicedOrderResponse.setItems(itemsDTOS);
return invoicedOrderResponse; return invoicedOrderResponse;
// //计算分页索引,放置到currentPage属性中
// int startIndex = (invoicedOrdersRequest.getCurrentPage() - 1) * invoicedOrdersRequest.getItems();
// invoicedOrdersRequest.setCurrentPage(startIndex);
// //先查询该用户被锁定了的订单过滤掉它
// List<Integer> lockOrderNumberList = xhpcInvoiceMapHistoryOrderMapper.findLockOrdersByUserIdAndUserType(invoicedOrdersRequest);
// //查询该用户3个月内可以开发票的历史订单
// List<XhpcHistoryOrder> xhpcHistoryOrderList = xhpcHistoryOrderMapper.findByCondition(invoicedOrdersRequest, lockOrderNumberList);
// ArrayList<InvoiceOrdersResponse.ItemsDTO> 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); XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(invoiceId);
SpecificInvoicedResponse specificInvoicedResponse = new SpecificInvoicedResponse(); SpecificInvoicedResponse specificInvoicedResponse = new SpecificInvoicedResponse();
//查不出来返回空包装类
if (xhpcInvoice == null) {
return specificInvoicedResponse;
}
specificInvoicedResponse.setCreatorTime(DateUtils.parseDateToStr(xhpcInvoice.getCreateTime())); specificInvoicedResponse.setCreatorTime(DateUtils.parseDateToStr(xhpcInvoice.getCreateTime()));
specificInvoicedResponse.setReceiveEmail(xhpcInvoice.getReceiveEmail()); specificInvoicedResponse.setReceiveEmail(xhpcInvoice.getReceiveEmail());
specificInvoicedResponse.setTitleType(xhpcInvoice.getTitleType()); specificInvoicedResponse.setTitleType(xhpcInvoice.getTitleType());
@ -462,6 +466,11 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
invoiceHistoryRecordsRequest.setCurrentPage(startIndex); invoiceHistoryRecordsRequest.setCurrentPage(startIndex);
//获取该用户所提交的每个发票信息 //获取该用户所提交的每个发票信息
List<XhpcInvoice> invoicesList = xhpcInvoiceMapper.findInvoicesByCreatorIdAndCreatorType(invoiceHistoryRecordsRequest); List<XhpcInvoice> invoicesList = xhpcInvoiceMapper.findInvoicesByCreatorIdAndCreatorType(invoiceHistoryRecordsRequest);
//如果为0那么则返回空的实体类出去
InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = new InvoiceHistoryRecordsResponse();
if (invoicesList.size() == 0) {
return invoiceHistoryRecordsResponse;
}
//实体类对拷 //实体类对拷
ArrayList<InvoiceHistoryRecordsResponse.ItemsDTO> itemsDTOS = new ArrayList<>(); ArrayList<InvoiceHistoryRecordsResponse.ItemsDTO> itemsDTOS = new ArrayList<>();
for (XhpcInvoice xhpcInvoice : invoicesList) { for (XhpcInvoice xhpcInvoice : invoicesList) {
@ -473,7 +482,6 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
itemsDTO.setIsRead(xhpcInvoice.getIsRead()); itemsDTO.setIsRead(xhpcInvoice.getIsRead());
itemsDTOS.add(itemsDTO); itemsDTOS.add(itemsDTO);
} }
InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = new InvoiceHistoryRecordsResponse();
invoiceHistoryRecordsResponse.setItems(itemsDTOS); invoiceHistoryRecordsResponse.setItems(itemsDTOS);
Long userInvoiceItems = xhpcInvoiceMapper.getUserInvoiceItemsByCreatorIdAndCreatorType(invoiceHistoryRecordsRequest.getCreatorId(), invoiceHistoryRecordsRequest.getCreatorType()); Long userInvoiceItems = xhpcInvoiceMapper.getUserInvoiceItemsByCreatorIdAndCreatorType(invoiceHistoryRecordsRequest.getCreatorId(), invoiceHistoryRecordsRequest.getCreatorType());
invoiceHistoryRecordsResponse.setTotalItems(userInvoiceItems); invoiceHistoryRecordsResponse.setTotalItems(userInvoiceItems);

View File

@ -37,4 +37,5 @@ oss:
#文件路径 #文件路径
file: file:
aliyunPath: invoicePdf/ aliyunPath: invoicePdf/
serverStoreDisposableFileLocation: /www/wwwroot/xhpc.scxhua.com/disposableFiles/ # serverStoreDisposableFileLocation: /www/wwwroot/xhpc.scxhua.com/disposableFiles/
serverStoreDisposableFileLocation: C:\\www\\wwwroot\\xhpc.scxhua.com\\disposableFiles\\

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--suppress ALL -->
<mapper namespace="com.xhpc.invoice.mapper.XhpcInvoiceMapHistoryOrderMapper"> <mapper namespace="com.xhpc.invoice.mapper.XhpcInvoiceMapHistoryOrderMapper">
<resultMap id="BaseResultMap" type="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder"> <resultMap id="BaseResultMap" type="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder">
<result column="invoice_id" jdbcType="BIGINT" property="invoiceId"/> <result column="invoice_id" jdbcType="BIGINT" property="invoiceId"/>

View File

@ -37,15 +37,16 @@ public class OrderLogController extends BaseController {
} }
@GetMapping("/{orderId}") @GetMapping("/detail")
public TableDataInfo getOrderDetailPage(@PathVariable("orderId") String orderId){ public TableDataInfo getOrderDetailPage(@RequestParam("orderId") String orderId){
startPage(); startPage();
return getDataTable(orderLogService.getOrderDetailPage(orderId)); return getDataTable(orderLogService.getOrderDetailPage(orderId));
} }
@GetMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, public void export(HttpServletResponse response,
@RequestParam(required = false) String orderId,
@RequestParam(required = false) String tenantId, @RequestParam(required = false) String tenantId,
@RequestParam(required = false) Integer number, @RequestParam(required = false) Integer number,
@RequestParam(required = false) String serialNumber) throws Exception { @RequestParam(required = false) String serialNumber) throws Exception {
@ -55,6 +56,7 @@ public class OrderLogController extends BaseController {
params.put("number", number); params.put("number", number);
params.put("serialNumber", serialNumber); params.put("serialNumber", serialNumber);
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
params.put("orderId", orderId);
orderLogService.export(response, params); orderLogService.export(response, params);
} }

View File

@ -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(); startPage();
return getDataTable(pileLogService.getPileRunLogPage(pileId)); return getDataTable(pileLogService.getPileRunLogPage(pileId, startTime, endTime));
} }
@GetMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, public void export(HttpServletResponse response,
@RequestParam("pileId") String pileId,
@RequestParam(required = false) String tenantId, @RequestParam(required = false) String tenantId,
@RequestParam(required = false) Integer number, @RequestParam(required = false) Integer number,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) String serialNumber) throws Exception { @RequestParam(required = false) String serialNumber) throws Exception {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
@ -56,6 +62,9 @@ public class PileLogController extends BaseController {
params.put("type", StationDeviceEnum.PILE.getCode()); params.put("type", StationDeviceEnum.PILE.getCode());
params.put("serialNumber", serialNumber); params.put("serialNumber", serialNumber);
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
params.put("startTime", startTime);
params.put("endTime", endTime);
params.put("pileId", pileId);
pileLogService.export(response, params); pileLogService.export(response, params);
} }

View File

@ -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(); startPage();
return getDataTable(stationLogService.getStationRatePage(stationId)); return getDataTable(stationLogService.getStationRatePage(stationId));
} }
@GetMapping("/rate/{rateId}") @GetMapping("/rate/detail")
public AjaxResult getRateInfo(@PathVariable("rateId") Integer rateId) { public AjaxResult getRateInfo(@RequestParam("rateId") Integer rateId) {
return AjaxResult.success(stationLogService.getRateInfo(rateId)); return AjaxResult.success(stationLogService.getRateInfo(rateId));
} }
} }

View File

@ -8,18 +8,42 @@ import java.util.Date;
@Data @Data
public class XhpcDeviceMessageDomain { public class XhpcDeviceMessageDomain {
/**
* 消息ID
*/
private Long deviceMessageId; private Long deviceMessageId;
/**
* 设备类型
*/
private String type; private String type;
/**
* 设备编码
*/
private String serialNumber; private String serialNumber;
/**
* 充电订单号
*/
private String chargeOrderNo;
/**
* 报文内容
*/
private String content; private String content;
private String replyContent; /**
* 状态
*/
private Integer status; private Integer status;
/**
* 备注描述
*/
private String remark;
private Date createTime; private Date createTime;
private String createBy; private String createBy;
@ -28,5 +52,4 @@ public class XhpcDeviceMessageDomain {
private String updateBy; private String updateBy;
private String remark;
} }

View File

@ -25,4 +25,7 @@ public interface XhpcChargingStationMapper {
List<Map<String, Object>> selectRateTimeListByRateId(@Param("rateId")Integer rateId); List<Map<String, Object>> selectRateTimeListByRateId(@Param("rateId")Integer rateId);
List<Map<String, Object>> selectBaseRateTimeListByRateId(@Param("rateId")Integer rateId);
} }

View File

@ -11,8 +11,17 @@ import java.util.Map;
public interface XhpcDeviceMessageMapper { public interface XhpcDeviceMessageMapper {
List<Map<String, Object>> selectListByTypeAndSerialNumber(@Param("type") String type, List<Map<String, Object>> selectListByTypeAndSerialNumber(@Param("type") String type,
@Param("serialNumber")String serialNumber); @Param("serialNumber")String serialNumber,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
List<Map<String, Object>> selectListByParams(@Param("params")Map params); List<Map<String, Object>> selectListByParams(@Param("params")Map params);
List<Map<String, Object>> selectListByChargeOrderNo(@Param("chargeOrderNo") String chargeOrderNo);
List<Map<String, Object>> getOrderMessageByParams(@Param("params")Map params);
} }

View File

@ -10,7 +10,7 @@ public interface PileLogService {
List<Map<String, Object>> getPilePage(Map<String, Object> params); List<Map<String, Object>> getPilePage(Map<String, Object> params);
List<Map<String, Object>> getPileRunLogPage(String pileId); List<Map<String, Object>> getPileRunLogPage(String pileId, String startTime, String endTime);
void export(HttpServletResponse response, Map<String, Object> params) throws Exception; void export(HttpServletResponse response, Map<String, Object> params) throws Exception;
} }

View File

@ -12,5 +12,6 @@ public interface StationLogService {
List<Map<String, Object>> getStationRatePage(Long stationId); List<Map<String, Object>> getStationRatePage(Long stationId);
List<Map<String, Object>> getRateInfo(int rateId); Map<String, Object> getRateInfo(int rateId);
} }

View File

@ -4,6 +4,7 @@ package com.xhpc.log.service.impl;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.log.mapper.XhpcDeviceMessageMapper;
import com.xhpc.log.mapper.XhpcHistoryOrderMapper; import com.xhpc.log.mapper.XhpcHistoryOrderMapper;
import com.xhpc.log.mapper.XhpcMessageMapper; import com.xhpc.log.mapper.XhpcMessageMapper;
import com.xhpc.log.service.OrderLogService; import com.xhpc.log.service.OrderLogService;
@ -21,8 +22,9 @@ public class OrderLogServiceImpl implements OrderLogService {
@Resource @Resource
XhpcHistoryOrderMapper historyOrderMapper; XhpcHistoryOrderMapper historyOrderMapper;
@Resource @Resource
XhpcMessageMapper messageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
@ -33,13 +35,13 @@ public class OrderLogServiceImpl implements OrderLogService {
@Override @Override
public List<Map<String, Object>> getOrderDetailPage(String orderId){ public List<Map<String, Object>> getOrderDetailPage(String orderId){
return messageMapper.getOrderMessagePage(orderId); return deviceMessageMapper.selectListByChargeOrderNo(orderId);
} }
@Override @Override
public void export(HttpServletResponse response, Map<String, Object> params) throws Exception{ public void export(HttpServletResponse response, Map<String, Object> params) throws Exception{
List<Map<String, Object>> list = messageMapper.getOrderMessageByParams(params); List<Map<String, Object>> list = deviceMessageMapper.getOrderMessageByParams(params);
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
writer.addHeaderAlias("serialNumber", "订单号"); writer.addHeaderAlias("serialNumber", "订单号");

View File

@ -33,8 +33,8 @@ public class PileLogServiceImpl implements PileLogService {
@Override @Override
public List<Map<String, Object>> getPileRunLogPage(String pileId){ public List<Map<String, Object>> getPileRunLogPage(String pileId, String startTime, String endTime){
return deviceMessageMapper.selectListByTypeAndSerialNumber(StationDeviceEnum.PILE.getCode(), pileId); return deviceMessageMapper.selectListByTypeAndSerialNumber(StationDeviceEnum.PILE.getCode(), pileId, startTime, endTime);
} }
@Override @Override
@ -45,11 +45,10 @@ public class PileLogServiceImpl implements PileLogService {
writer.addHeaderAlias("chargingStationName", "场站名称"); writer.addHeaderAlias("chargingStationName", "场站名称");
writer.addHeaderAlias("chargingPileName", "充电桩名称"); writer.addHeaderAlias("chargingPileName", "充电桩名称");
writer.addHeaderAlias("serialNumber", "桩编码"); writer.addHeaderAlias("serialNumber", "桩编码");
writer.addHeaderAlias("brandModel", "费率"); writer.addHeaderAlias("brandModel", "规则型号");
writer.addHeaderAlias("pileType", "电桩类型"); writer.addHeaderAlias("pileType", "电桩类型");
writer.addHeaderAlias("power", "电桩功率(KW)"); writer.addHeaderAlias("power", "电桩功率(KW)");
writer.addHeaderAlias("content", "充电桩上传平台报文"); writer.addHeaderAlias("content", "充电桩上传平台报文");
writer.addHeaderAlias("replyContent", "平台回复报文");
writer.addHeaderAlias("remark", "备注描述"); writer.addHeaderAlias("remark", "备注描述");
writer.addHeaderAlias("createTime", "发送时间"); writer.addHeaderAlias("createTime", "发送时间");

View File

@ -5,6 +5,7 @@ import com.xhpc.log.service.StationLogService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -28,7 +29,11 @@ public class StationLogServiceImpl implements StationLogService {
@Override @Override
public List<Map<String, Object>> getRateInfo(int rateId){ public Map<String, Object> getRateInfo(int rateId){
return stationMapper.selectRateTimeListByRateId(rateId); Map<String, Object> resData = new HashMap<>();
resData.put("base", stationMapper.selectBaseRateTimeListByRateId(rateId));
resData.put("current", stationMapper.selectRateTimeListByRateId(rateId));
return resData;
} }
} }

View File

@ -27,7 +27,8 @@ spring:
logging: logging:
level: level:
root: info root: info
com.xhpc.tradebill.mapper: debug com.xhpc.log.mapper: debug
file: file:
path: "d:\\logs" path: "d:\\logs"
@ -54,37 +55,3 @@ alibaba:
certPath: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt" certPath: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt"
publicCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt" publicCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt"
rootCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.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"

View File

@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
oper_name = #{params.operName} oper_name = #{params.operName}
</if> </if>
</where> </where>
order by oper_time desc
</select> </select>
</mapper> </mapper>

View File

@ -31,7 +31,8 @@
<select id="selectRateListByStationId" resultType="map"> <select id="selectRateListByStationId" resultType="map">
select select
rate_model_id as 'rateId', rate_model_id as 'rateId',
create_time as 'createTime' create_time as 'createTime',
create_by as 'createBy'
from xhpc_rate_time from xhpc_rate_time
where charging_station_id=#{stationId} where charging_station_id=#{stationId}
group by rate_model_id group by rate_model_id
@ -50,4 +51,14 @@
left join xhpc_rate as ra on ra.rate_id = rt.rate_id left join xhpc_rate as ra on ra.rate_id = rt.rate_id
where rt.rate_model_id =#{rateId} where rt.rate_model_id =#{rateId}
</select> </select>
<select id="selectBaseRateTimeListByRateId" resultType="map">
SELECT
name as 'name',
power_fee as 'powerFee',
service_fee as 'serviceFee'
FROM xhpc_rate
WHERE rate_model_id=#{rateId};
</select>
</mapper> </mapper>

View File

@ -9,7 +9,7 @@
type as 'type', type as 'type',
serial_number as 'serialNumber', serial_number as 'serialNumber',
content as 'content', content as 'content',
reply_content as 'replyContent', charge_order_no as 'chargeOrderNo',
status as 'status', status as 'status',
remark as 'remark', remark as 'remark',
create_time as 'createTime', create_time as 'createTime',
@ -18,6 +18,33 @@
update_by as 'updateBy' update_by as 'updateBy'
from xhpc_device_message from xhpc_device_message
where type=#{type} and serial_number=#{serialNumber} where type=#{type} and serial_number=#{serialNumber}
<if test="startTime !=null and startTime!=''">
and create_time <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime !=null and endTime!=''">
and create_time <![CDATA[ <= ]]> #{endTime}
</if>
order by create_time desc
</select>
<select id="selectListByChargeOrderNo" resultType="map">
select
device_message_id as 'deviceMessageId',
type as 'type',
serial_number as 'serialNumber',
content as 'content',
charge_order_no as 'chargeOrderNo',
status as 'status',
remark as 'remark',
create_time as 'createTime',
create_by as 'createBy',
update_time as 'updateTime',
update_by as 'updateBy'
from xhpc_device_message
where charge_order_no=#{chargeOrderNo}
order by create_time desc
</select> </select>
@ -33,12 +60,12 @@
m.type as 'type', m.type as 'type',
m.serial_number as 'serialNumber', m.serial_number as 'serialNumber',
m.content as 'content', m.content as 'content',
m.reply_content as 'replyContent', m.charge_order_no as 'chargeOrderNo',
m.status as 'status', m.status as 'status',
m.remark as 'remark', m.remark as 'remark',
m.create_time as 'createTime', m.create_time as 'createTime',
m.create_by as 'createBy', m.create_by as 'createBy',
m.update_time as 'updateTime', m.update_time as 'updateTime'
from xhpc_device_message m from xhpc_device_message m
left join xhpc_charging_pile cp on cp.serial_number=m.serial_number 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 left join xhpc_charging_station st on st.charging_station_id =cp.charging_station_id
@ -52,12 +79,70 @@
<if test="params.type!=null and params.type!=''"> <if test="params.type!=null and params.type!=''">
and m.type=#{params.type} and m.type=#{params.type}
</if> </if>
<if test="params.pileId!=null and params.pileId!=''">
and m.serial_number=#{params.pileId}
</if>
<if test="params.tenantId != null and params.tenantId != ''"> <if test="params.tenantId != null and params.tenantId != ''">
and cp.tenant_id = #{params.tenantId} and cp.tenant_id = #{params.tenantId}
</if> </if>
<if test="params.serialNumber !=null and params.serialNumber!=''"> <if test="params.serialNumber !=null and params.serialNumber!=''">
and cp.serial_number=#{params.serialNumber} and cp.serial_number=#{params.serialNumber}
</if> </if>
<if test="params.chargeOrderNo !=null and params.chargeOrderNo!=''">
and m.charge_order_no=#{params.chargeOrderNo}
</if>
<if test="params.startTime !=null and params.startTime!=''">
and m.create_time <![CDATA[ >= ]]> #{params.startTime}
</if>
<if test="params.endTime !=null and params.endTime!=''">
and m.create_time <![CDATA[ <= ]]> #{params.endTime}
</if>
order by m.create_time desc
</select>
<select id="getOrderMessageByParams" resultType="java.util.Map">
select
co.serial_number as 'serialNumber',
co.source as 'source',
case co.source when 0 then 'C端用户'
when 1 then '流量方用户'
when 2 then '社区用户'
when 3 then 'B端用户' end as 'sourceName',
co.start_time as 'startTime',
co.end_time as 'endTime',
co.charging_degree as 'chargingDegree',
co.amount_charged as 'amountCharged',
co.charging_time as 'chargingTime',
co.start_soc as 'startSOc',
co.end_soc as 'endSoc',
m.device_message_id as 'messageId',
m.charge_order_no as 'chargeOrderNo',
m.content as 'content',
m.status as 'status',
m.remark as 'remark',
m.create_time as 'createTime'
from xhpc_device_message m
LEFT JOIN xhpc_charge_order as co on co.serial_number = m.charge_order_no
left join xhpc_charging_station as st on st.charging_station_id = co.charging_station_id
where co.del_flag =0
<if test="params.number !=0 and params.number ==1">
and co.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
</if>
<if test="params.number !=0 and params.number ==2">
and co.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.operatorId})
</if>
<if test="params.tenantId != null and params.tenantId != ''">
and co.tenant_id = #{params.tenantId}
</if>
<if test="params.serialNumber !=null and params.serialNumber !=''">
and co.serial_number=#{params.serialNumber}
</if>
<if test="params.orderId !=null and params.orderId !=''">
and m.charge_order_no=#{params.orderId}
</if>
order by m.charge_order_no asc, m.create_time asc
</select> </select>
</mapper> </mapper>

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>xhpc-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>xhpc-message-board</artifactId>
<description>
留言板服务
</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!--单元测试依赖-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-common</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -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" +
" ''-' `'-' `-..-' ");
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<DataDTO> 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;
}
}

View File

@ -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<DataDTO> 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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<XhpcMessageBoard> 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<Long> messageIdList);
/**
* 查询用户所有时间记录
*
* @param userQueryCondition 用户信息
* @author WH
* @date 2022/1/13 10:56
* @since version-1.0
*/
List<XhpcMessageBoard> selectTimeRecords(UserQueryCondition userQueryCondition);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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<Map<String, Object>> result = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null, userMessage.getTenantId());
Map<String, Object> 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<Map<String, Object>> result = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null, userMessage.getTenantId());
Map<String, Object> 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<XhpcMessageBoard> 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<XhpcMessageBoard> aMonthRecords = messageBoardMapper.selectBy(userQueryCondition, nextTimeStr);
//如果没有数据则返回空实体类对象
QueryUserMassageResponse response = new QueryUserMassageResponse();
if (aMonthRecords.size() == 0) {
return response;
}
List<Long> 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<QueryUserMassageResponse.DataDTO> 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;
}
}

View File

@ -0,0 +1,10 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_ __ _ _
(_) / _|(_)| |
_ __ _ _ ___ _ _ _ ______ | |_ _ | | ___
| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \
| | | |_| || (_) || |_| || | | | | || || __/
|_| \__,_| \___/ \__, ||_| |_| |_||_| \___|
__/ |
|___/

View File

@ -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

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/xhpc-message-board"/>
<!-- 日志输出格式 -->
<property name="log.pattern"
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.xhpc" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,292 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--suppress ALL -->
<mapper namespace="com.xhpc.board.mapper.XhpcMessageBoardMapper">
<resultMap id="BaseResultMap" type="com.xhpc.board.pojo.XhpcMessageBoard">
<id column="message_id" jdbcType="BIGINT" property="messageId"/>
<result column="sender_type" jdbcType="TINYINT" property="senderType"/>
<result column="sender_account" jdbcType="VARCHAR" property="senderAccount"/>
<result column="send_message_time" jdbcType="TIMESTAMP" property="sendMessageTime"/>
<result column="message_content" jdbcType="VARCHAR" property="messageContent"/>
<result column="tenant_type" jdbcType="TINYINT" property="tenantType"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="have_new_info" jdbcType="TINYINT" property="haveNewInfo"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="sender" jdbcType="TINYINT" property="sender"/>
</resultMap>
<sql id="Base_Column_List">
message_id
, sender_type, sender_account, send_message_time, message_content, tenant_type,
tenant_id, have_new_info, del_flag, sender
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_message_board
where message_id = #{messageId,jdbcType=BIGINT}
</select>
<select id="selectBy" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
xhpc_message_board
WHERE
del_flag is NULL
AND sender_type = #{userQueryCondition.senderType}
AND sender_account = #{userQueryCondition.senderAccount}
AND send_message_time &lt;= #{userQueryCondition.sendMessageTime}
<if test="nextTimeStr!=null">
AND send_message_time &gt; #{nextTimeStr}
</if>
AND tenant_type = #{userQueryCondition.tenantType}
AND tenant_id = #{userQueryCondition.tenantId}
</select>
<select id="selectTimeRecords" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
xhpc_message_board
WHERE
sender_type = #{senderType}
AND sender_account = #{senderAccount}
AND del_flag IS NULL
AND message_content IS NULL
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from xhpc_message_board
where message_id = #{messageId,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="message_id" keyProperty="messageId"
parameterType="com.xhpc.board.pojo.XhpcMessageBoard" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="message_id" keyProperty="messageId"
parameterType="com.xhpc.board.pojo.XhpcMessageBoard" useGeneratedKeys="true">
insert into xhpc_message_board
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="senderType != null">
sender_type,
</if>
<if test="senderAccount != null">
sender_account,
</if>
<if test="sendMessageTime != null">
send_message_time,
</if>
<if test="messageContent != null">
message_content,
</if>
<if test="tenantType != null">
tenant_type,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="haveNewInfo != null">
have_new_info,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="sender != null">
sender,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="senderType != null">
#{senderType,jdbcType=TINYINT},
</if>
<if test="senderAccount != null">
#{senderAccount,jdbcType=VARCHAR},
</if>
<if test="sendMessageTime != null">
#{sendMessageTime,jdbcType=TIMESTAMP},
</if>
<if test="messageContent != null">
#{messageContent,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
#{tenantType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR},
</if>
<if test="haveNewInfo != null">
#{haveNewInfo,jdbcType=BOOLEAN},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=BOOLEAN},
</if>
<if test="sender != null">
#{sender,jdbcType=BOOLEAN},
</if>
</trim>
</insert>
<insert id="insertUserTimeMessageRecord">
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>
<insert id="insertUserMessage">
insert into xhpc_message_board
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="senderType != null">
sender_type,
</if>
<if test="senderAccount != null">
sender_account,
</if>
<if test="sendMessageTime != null">
send_message_time,
</if>
<if test="messageContent != null">
message_content,
</if>
<if test="tenantType != null">
tenant_type,
</if>
<if test="tenantId != null">
tenant_id,
</if>
have_new_info,
sender,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="senderType != null">
#{senderType,jdbcType=TINYINT},
</if>
<if test="senderAccount != null">
#{senderAccount,jdbcType=VARCHAR},
</if>
<if test="sendMessageTime != null">
#{sendMessageTime,jdbcType=TIMESTAMP},
</if>
<if test="messageContent != null">
#{messageContent,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
#{tenantType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR},
</if>
0,
0,
</trim>
</insert>
<insert id="insertPlatformMessage">
insert into xhpc_message_board
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="senderType != null">
sender_type,
</if>
<if test="senderAccount != null">
sender_account,
</if>
<if test="sendMessageTime != null">
send_message_time,
</if>
<if test="messageContent != null">
message_content,
</if>
<if test="tenantType != null">
tenant_type,
</if>
<if test="tenantId != null">
tenant_id,
</if>
have_new_info,
sender,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="senderType != null">
#{senderType,jdbcType=TINYINT},
</if>
<if test="senderAccount != null">
#{senderAccount,jdbcType=VARCHAR},
</if>
<if test="sendMessageTime != null">
#{sendMessageTime,jdbcType=TIMESTAMP},
</if>
<if test="messageContent != null">
#{messageContent,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
#{tenantType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR},
</if>
0,
2,
</trim>
</insert>
<insert id="insertPlatformTimeMessageRecord">
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>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.board.pojo.XhpcMessageBoard">
update xhpc_message_board
<set>
<if test="senderType != null">
sender_type = #{senderType,jdbcType=TINYINT},
</if>
<if test="senderAccount != null">
sender_account = #{senderAccount,jdbcType=VARCHAR},
</if>
<if test="sendMessageTime != null">
send_message_time = #{sendMessageTime,jdbcType=TIMESTAMP},
</if>
<if test="messageContent != null">
message_content = #{messageContent,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
tenant_type = #{tenantType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=VARCHAR},
</if>
<if test="haveNewInfo != null">
have_new_info = #{haveNewInfo,jdbcType=BOOLEAN},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=BOOLEAN},
</if>
<if test="sender != null">
sender = #{sender,jdbcType=BOOLEAN},
</if>
</set>
where message_id = #{messageId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.board.pojo.XhpcMessageBoard">
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>
<update id="setUserReadedStatus">
UPDATE `xhpc_message_board`
SET have_new_info = 1
WHERE
message_id IN
<foreach collection="list" separator="," item="messageId" open="(" close=")">
#{messageId}
</foreach>
AND del_flag IS NULL
</update>
</mapper>

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--suppress ALL -->
<mapper namespace="com.xhpc.board.mapper.XhpcMessageBoardReceiveUserMapper">
<resultMap id="BaseResultMap" type="com.xhpc.board.pojo.XhpcMessageBoardReceiveUser">
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="tenant_type" jdbcType="INTEGER" property="tenantType"/>
<result column="sender_account" jdbcType="VARCHAR" property="senderAccount"/>
<result column="sender_type" jdbcType="INTEGER" property="senderType"/>
<result column="user_icon" jdbcType="VARCHAR" property="userIcon"/>
<result column="have_new_info" jdbcType="BOOLEAN" property="haveNewInfo"/>
<result column="del_flag" jdbcType="BOOLEAN" property="delFlag"/>
</resultMap>
<sql id="Base_Column_List">
tenant_id
,
tenant_type,
sender_account,
sender_type,
user_icon,
have_new_info,
del_flag
</sql>
<insert id="insert" parameterType="com.xhpc.board.pojo.XhpcMessageBoardReceiveUser">
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>
<insert id="insertSelective" parameterType="com.xhpc.board.pojo.XhpcMessageBoardReceiveUser">
insert into xhpc_message_board_receive_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tenantId != null">
tenant_id,
</if>
<if test="tenantType != null">
tenant_type,
</if>
<if test="senderAccount != null">
sender_account,
</if>
<if test="senderType != null">
sender_type,
</if>
<if test="userIcon != null">
user_icon,
</if>
<if test="haveNewInfo != null">
have_new_info,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
#{tenantType,jdbcType=INTEGER},
</if>
<if test="senderAccount != null">
#{senderAccount,jdbcType=VARCHAR},
</if>
<if test="senderType != null">
#{senderType,jdbcType=INTEGER},
</if>
<if test="userIcon != null">
#{userIcon,jdbcType=VARCHAR},
</if>
<if test="haveNewInfo != null">
#{haveNewInfo,jdbcType=BOOLEAN},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=BOOLEAN},
</if>
</trim>
</insert>
<update id="updateHaveNewInfoFiledByUserCondition">
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;
</update>
<select id="findOneByCondition" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
xhpc_message_board_receive_user
WHERE
tenant_id = #{tenantId}
AND tenant_type = #{tenantType}
AND sender_account = #{senderAccount}
AND sender_type = #{senderType}
AND del_flag IS NULL
</select>
</mapper>

View File

@ -99,6 +99,10 @@
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>--> <!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml</artifactId>--> <!-- <artifactId>poi-ooxml</artifactId>-->

View File

@ -1,6 +1,5 @@
package com.xhpc.order.api; package com.xhpc.order.api;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xhpc.common.api.WebSocketService; import com.xhpc.common.api.WebSocketService;
import com.xhpc.common.core.web.controller.BaseController; 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 javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -68,7 +66,6 @@ public class XhpcChargeOrderController extends BaseController {
} }
/** /**
* 启动充电 * 启动充电
* @param userId * @param userId

View File

@ -383,7 +383,7 @@ public class XhpcPileOrderController extends BaseController {
//订单异常 //订单异常
xhpcChargeOrder.setStatus(2); xhpcChargeOrder.setStatus(2);
//异常原因 //异常原因
xhpcChargeOrder.setErroRemark("桩异常:" + stopReason + ">>>>用户id:" + userId + "为空"); xhpcChargeOrder.setErroRemark("".equals(xhpcChargeOrder.getErroRemark())?"桩异常:" + stopReason + ">>>>用户id:" + userId + "为空":xhpcChargeOrder.getErroRemark()+"桩异常:" + stopReason + ">>>>用户id:" + userId + "为空");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder); xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
R.ok(); R.ok();
} }
@ -436,7 +436,7 @@ public class XhpcPileOrderController extends BaseController {
R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId); R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null || userMessage.get("balance") == null) { if (userMessage != null && userMessage.get("balance") != null) {
xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,orderNo,1); xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,orderNo,1);
} }
} }

View File

@ -877,7 +877,7 @@ public class XhpcHistoryOrderController extends BaseController {
R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId); R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null || userMessage.get("balance") == null) { if (userMessage != null && userMessage.get("balance") != null) {
xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,xhpcChargeOrder.getSerialNumber(),2); 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<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage != null && userMessage.get("balance") != null) {
xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,xhpcChargeOrder.getSerialNumber(),2);
}
}
}else{
xhpcHistoryOrderService.addXhpcChargeOrder(null,xhpcChargeOrder.getSerialNumber(),2);
}
}
}
/** /**
* 标记异常大于创建4小时标记为异常 * 标记异常大于创建4小时标记为异常
* @param * @param

View File

@ -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.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; 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 com.xhpc.order.service.IXhpcHistoryOrderReconciliationStatusService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -25,6 +27,7 @@ public class XhpcHistoryOrderReconciliationStatusController extends BaseControll
* 修改对账状态 * 修改对账状态
* @return * @return
*/ */
@Log(title = "对账-修改对账状态", businessType = BusinessType.UPDATE)
@PostMapping("/status") @PostMapping("/status")
@ApiOperation(value = "修改对账状态") @ApiOperation(value = "修改对账状态")
public AjaxResult status(@RequestBody Map<String, Object> map) { public AjaxResult status(@RequestBody Map<String, Object> map) {

View File

@ -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.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; 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 com.xhpc.order.service.IXhpcHistoryOrderSortingStatusService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -27,6 +29,7 @@ public class XhpcHistoryOrderSortingStatusController extends BaseController {
* 修改清分状态 * 修改清分状态
* @return * @return
*/ */
@Log(title = "清分-修改清分状态", businessType = BusinessType.UPDATE)
@PostMapping("/status") @PostMapping("/status")
@ApiOperation(value = "修改清分状态") @ApiOperation(value = "修改清分状态")
public AjaxResult status(@RequestBody Map<String, Object> map) { public AjaxResult status(@RequestBody Map<String, Object> map) {

View File

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -42,9 +43,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getTimeIntervalPage") @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<Map<String, Object>> list = xhpcStatisticsService.getTimeIntervalPage(chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); List<Map<String, Object>> list = xhpcStatisticsService.getTimeIntervalPage(request,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -60,9 +61,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getDateIntervalPage") @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<Map<String, Object>> list = xhpcStatisticsService.getDateIntervalPage(chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); List<Map<String, Object>> list = xhpcStatisticsService.getDateIntervalPage(request,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
/** /**
@ -78,9 +79,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getStationIntervalPage") @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<Map<String, Object>> list = xhpcStatisticsService.getStationIntervalPage(chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type); List<Map<String, Object>> list = xhpcStatisticsService.getStationIntervalPage(request,chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -95,9 +96,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getOperatorIntervalPage") @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<Map<String, Object>> list = xhpcStatisticsService.getOperatorIntervalPage(operatorIds,operatorId,startTime,endTime,userId,type); List<Map<String, Object>> list = xhpcStatisticsService.getOperatorIntervalPage(request,operatorIds,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -112,10 +113,10 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getInternetUserIntervalPage") @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(); startPage();
List<Map<String, Object>> list = xhpcStatisticsService.getInternetUserIntervalPage(internetUserIds,internetUserId,startTime,endTime,userId,type); List<Map<String, Object>> list = xhpcStatisticsService.getInternetUserIntervalPage(request,internetUserIds,internetUserId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -132,9 +133,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getTerminalIntervalPage") @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<Map<String, Object>> list = xhpcStatisticsService.getTerminalIntervalPage(chargingStationId,terminalId,operatorId,startTime,endTime,userId,type); List<Map<String, Object>> list = xhpcStatisticsService.getTerminalIntervalPage(request,chargingStationId,terminalId,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -146,12 +147,12 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getChargingStationList") @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) { if (type == null || type==3) {
return AjaxResult.success(); 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 * @return
*/ */
@GetMapping("/getOperatorList") @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) { if (type == null || type==3) {
return AjaxResult.success(); 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 * @return
*/ */
@GetMapping("/getInternetUserIList") @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) { if (type == null || type==2) {
return AjaxResult.success(); 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 * @return
*/ */
@GetMapping("/getTerminalList") @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) { if (type == null || type == 3) {
return AjaxResult.success(); 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 * @return
*/ */
@GetMapping("/getSourceList") @GetMapping("/getSourceList")
public AjaxResult getSourceList(@RequestParam("userId") Long userId, @RequestParam("type") Integer type) { public AjaxResult getSourceList(HttpServletRequest request,@RequestParam("userId") Long userId, @RequestParam("type") Integer type) {
return xhpcStatisticsService.getSourceList(userId, type); return xhpcStatisticsService.getSourceList(request,userId, type);
} }
/** /**
@ -220,9 +221,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getSumSourceList") @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(); startPage();
List<Map<String, Object>> list = xhpcStatisticsService.getSumSourceList(startTime,endTime,internetUserIds,userId, type,chargingStationIds); List<Map<String, Object>> list = xhpcStatisticsService.getSumSourceList(request,startTime,endTime,internetUserIds,userId, type,chargingStationIds);
return getDataTable(list); return getDataTable(list);
} }
@ -242,8 +243,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/timeInterval/export") @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 { 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(response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.timeIntervalExport(request,response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
} }
/** /**
@ -258,8 +259,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/dateInterval/export") @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 { 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(response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.dateIntervalExport(request,response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
} }
/** /**
* 电站统计导出 * 电站统计导出
@ -274,8 +275,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/stationInterval/export") @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 { 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(response, chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.stationIntervalExport(request,response, chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
} }
/** /**
@ -289,8 +290,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/operatorInterval/export") @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 { 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(response, operatorIds,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.operatorIntervalExport(request,response, operatorIds,operatorId,startTime,endTime,userId,type);
} }
/** /**
@ -298,8 +299,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/internetUserInterval/export") @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 { 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(response, startTime,endTime,internetUserIds,userId,type,chargingStationIds); xhpcStatisticsService.getSumSourceListExport(request,response, startTime,endTime,internetUserIds,userId,type,chargingStationIds);
} }
@ -315,8 +316,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/terminalInterval/export") @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 { 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(response, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.terminalIntervalExport(request,response, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type);
} }
} }

View File

@ -69,7 +69,7 @@ public interface XhpcHistoryOrderMapper {
* @param historyOrderId * @param historyOrderId
* @return * @return
*/ */
Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("type") Integer type, @Param("chargingOrderId") Long chargingOrderId, @Param("tenantId") String tenantId); Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("source") Integer source, @Param("chargingOrderId") Long chargingOrderId, @Param("tenantId") String tenantId);
/** /**
* 历史订单记录PC * 历史订单记录PC
@ -112,4 +112,10 @@ public interface XhpcHistoryOrderMapper {
* 获取登陆用户信息 * 获取登陆用户信息
*/ */
Map<String, Object> getLandUser(@Param("userId")Long userId); Map<String, Object> getLandUser(@Param("userId")Long userId);
/**
* 查询启动订单表
*/
Map<String, Object> getchargingOrderById(@Param("chargingOrderId")Long chargingOrderId,@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);
} }

View File

@ -27,7 +27,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTimeIntervalPage(@Param("chargingStationIds") List<String> 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<Map<String, Object>> getTimeIntervalPage(@Param("chargingStationIds") List<String> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getDateIntervalPage(@Param("chargingStationIds") List<String> 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<Map<String, Object>> getDateIntervalPage(@Param("chargingStationIds") List<String> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getStationIntervalPage(@Param("chargingStationIds") List<String> chargingStationIds,@Param("operatorUserId") List<String> 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<Map<String, Object>> getStationIntervalPage(@Param("chargingStationIds") List<String> chargingStationIds,@Param("operatorUserId") List<String> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getOperatorIntervalPage(@Param("operatorUserId") List<String> operatorUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); List<Map<String, Object>> getOperatorIntervalPage(@Param("operatorUserId") List<String> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getInternetUserIntervalPage(@Param("internetIds") List<String> internetIds,@Param("internetUserId") Long internetUserId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); List<Map<String, Object>> getInternetUserIntervalPage(@Param("internetIds") List<String> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> 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<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getChargingStationList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getOperatorList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getInternetUserIList(@Param("internetUserId")Long internetUserId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> 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 * @return
*/ */
List<Map<String,String>> getInternetList(@Param("userId")Long userId); List<Map<String,String>> getInternetList(@Param("userId")Long userId,@Param("tenantId")String tenantId);
/** /**
@ -153,7 +153,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List<String> chargingStationIdList); List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId);
/** /**
* 获取登陆用户信息 * 获取登陆用户信息

View File

@ -19,7 +19,7 @@ public interface IXhpcHistoryOrderService {
/** /**
* 用户历史订单表 * 用户历史订单表
* @param userId * @param
* @return * @return
*/ */
List<Map<String,Object>> list(HttpServletRequest request); List<Map<String,Object>> list(HttpServletRequest request);

View File

@ -138,4 +138,9 @@ public interface IXhpcRealTimeOrderService {
*/ */
Map<String, Object> addOrderTime(CacheRealtimeData cacheRealtimeData, XhpcChargeOrder xhpcChargeOrder, Map<String, Object> addOrderTime(CacheRealtimeData cacheRealtimeData, XhpcChargeOrder xhpcChargeOrder,
String orderNo, Integer type); String orderNo, Integer type);
/**
* 获取一条实时数据
*/
XhpcRealTimeOrder getChargingOrderId(Long chargingOrderId,Integer type);
} }

View File

@ -6,6 +6,7 @@ import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -29,7 +30,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTimeIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getDateIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getStationIntervalPage(String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getOperatorIntervalPage(String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getInternetUserIntervalPage(String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTerminalIntervalPage(String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getSumSourceList(String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds); List<Map<String, Object>> 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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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 * @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流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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;
} }

View File

@ -1,5 +1,7 @@
package com.xhpc.order.service.impl; 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 cn.hutool.core.date.DateUtil;
import com.xhpc.common.api.PowerPileService; import com.xhpc.common.api.PowerPileService;
import com.xhpc.common.api.UserTypeService; 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.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcOrderRedisRecord; import com.xhpc.order.domain.XhpcOrderRedisRecord;
import com.xhpc.order.domain.XhpcRealTimeOrder;
import com.xhpc.order.mapper.XhpcChargeOrderMapper; import com.xhpc.order.mapper.XhpcChargeOrderMapper;
import com.xhpc.order.mapper.XhpcInternetUserMapper; import com.xhpc.order.mapper.XhpcInternetUserMapper;
import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcRealTimeOrderService;
import com.xhpc.system.api.model.LoginUser; import com.xhpc.system.api.model.LoginUser;
import org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi; import org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -58,6 +62,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
private TokenService tokenService; private TokenService tokenService;
@Autowired @Autowired
private UserTypeService userTypeService; private UserTypeService userTypeService;
@Autowired
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderServiceImpl.class);
//队列名称 //队列名称
@ -90,7 +96,29 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
public List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request) { public List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request) {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
startPage(); startPage();
return xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType()); List<Map<String, Object>> list = xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(), loginUser.getTenantId(), loginUser.getUserType());
if(list !=null && list.size()>0){
for (int i = 0; i <list.size() ; i++) {
Map<String, Object> map = list.get(i);
//获取该订单最后一条实时数据
Map<String, Object> cacheMap = redisService.getCacheMap("order:" + map.get("serialNumber").toString());
if(cacheMap !=null && cacheMap.size()>0){
List<CacheRealtimeData> CacheRealtimeDataList = (List<CacheRealtimeData>) 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 @Override
@ -572,19 +600,24 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
List<XhpcChargeOrder> list = xhpcChargeOrderMapper.getFourTimsStatus(); List<XhpcChargeOrder> list = xhpcChargeOrderMapper.getFourTimsStatus();
if(list !=null && list.size()>0){ if(list !=null && list.size()>0){
for (XhpcChargeOrder xhpcChargeOrder:list) { for (XhpcChargeOrder xhpcChargeOrder:list) {
CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + xhpcChargeOrder.getSerialNumber() + ".lord");
Long chargeOrderId = xhpcChargeOrder.getChargeOrderId(); Long chargeOrderId = xhpcChargeOrder.getChargeOrderId();
if(cacheRealtimeData ==null){ if(UserTypeUtil.INTERNET_TYPE.equals(xhpcChargeOrder.getSource())){
int count = xhpcChargeOrderMapper.getSerialNumberLike(xhpcChargeOrder.getSerialNumber().substring(0, 16), chargeOrderId); //标记异常
if(count>0){ xhpcChargeOrderMapper.updateStatus(2,chargeOrderId);
//有充电改为 由充电中变为启动充电中 }else{
xhpcChargeOrderMapper.updateStatus(-1,chargeOrderId); 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{ }else{
//标记异常
xhpcChargeOrderMapper.updateStatus(2,chargeOrderId); xhpcChargeOrderMapper.updateStatus(2,chargeOrderId);
} }
}else{
xhpcChargeOrderMapper.updateStatus(2,chargeOrderId);
} }
} }
} }

View File

@ -20,6 +20,7 @@ import com.xhpc.common.util.EvcsUtil;
import com.xhpc.common.util.UserTypeUtil; import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcHistoryOrder; import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.domain.XhpcRealTimeOrder;
import com.xhpc.order.dto.XhpcChargeHistoryOrder; import com.xhpc.order.dto.XhpcChargeHistoryOrder;
import com.xhpc.order.mapper.XhpcHistoryOrderMapper; import com.xhpc.order.mapper.XhpcHistoryOrderMapper;
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper; 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); R user = userTypeService.getUser(null, userid, userType, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null) { if (userMessage != null) {
startPage(); startPage();
return xhpcHistoryOrderMapper.list(userid,userType,tenantId); return xhpcHistoryOrderMapper.list(userid,userType,tenantId);
} }
@ -104,7 +105,95 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
@Override @Override
public AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId) { public AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId) {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(loginUser.getUserid(), historyOrderId, type, chargingOrderId,loginUser.getTenantId()));
Map<String, Object> map = xhpcHistoryOrderMapper.gethistotyOrderMessage(loginUser.getUserid(), historyOrderId, loginUser.getUserType(), chargingOrderId, loginUser.getTenantId());
if(map !=null){
return AjaxResult.success(map);
}
//查询最后一帧数据
if(chargingOrderId !=null){
Map<String, Object> stringObjectMap = xhpcHistoryOrderMapper.getchargingOrderById(chargingOrderId,loginUser.getUserid(),loginUser.getUserType(),loginUser.getTenantId());
if(stringObjectMap !=null){
//获取该订单最后一条实时数据
Map<String, Object> cacheMap = redisService.getCacheMap("order:" + stringObjectMap.get("serialNumber").toString());
List<CacheRealtimeData> list = (List<CacheRealtimeData>) 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 <list.size() ; i++) {
startData =list.get(i);
if(startData.getSoc()>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 @Override
@ -803,11 +892,41 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
return powerPriceTotal; 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); private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) {
BigDecimal multiply = powerPrice.multiply(v).setScale(2, BigDecimal.ROUND_DOWN); List<Map<String, Object>> reatTimeList = getReatTimeList(startTime,updateTime, rateModelId);
return multiply; for (int i = 0; i <reatTimeList.size() ; i++) {
int size = reatTimeList.size();
Map<String, Object> 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<size-1){
powerPriceTotal = powerPriceTotal.add(getRateTimeList(startTime1,endTime1,divide,powerFee));
}else{
powerPriceTotal = powerPriceTotal.add(getRateTimeList(startTime1,updateTime,divide,powerFee));
}
}
}
return powerPriceTotal;
} }
private BigDecimal getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice) {
long time = DateUtil.parse(endTime).getTime();
long time1= DateUtil.parse(startTime).getTime();
BigDecimal multiply = new BigDecimal(time-time1).divide(new BigDecimal(60000),4, BigDecimal.ROUND_DOWN).multiply(degree).setScale(4,BigDecimal.ROUND_DOWN);
BigDecimal bigDecimal = multiply.multiply(powerPrice).setScale(2, BigDecimal.ROUND_DOWN);
return bigDecimal;
}
} }

View File

@ -160,6 +160,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
//获取该订单最后一条实时数据 //获取该订单最后一条实时数据
Map<String, Object> cacheMap = redisService.getCacheMap("order:" + chargeOrder.getSerialNumber()); Map<String, Object> cacheMap = redisService.getCacheMap("order:" + chargeOrder.getSerialNumber());
List<CacheRealtimeData> list = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList"); List<CacheRealtimeData> list = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList");
CacheRealtimeData startData =new CacheRealtimeData(); CacheRealtimeData startData =new CacheRealtimeData();
CacheRealtimeData endData =new CacheRealtimeData(); CacheRealtimeData endData =new CacheRealtimeData();
@ -175,7 +176,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
Long rateModelId = chargeOrder.getRateModelId(); Long rateModelId = chargeOrder.getRateModelId();
if(endData !=null && endData.getAmountCharged() !=null){ if(endData !=null && endData.getAmountCharged() !=null && startData.getChargingTime()>0){
message.put("soc",endData.getSoc()); message.put("soc",endData.getSoc());
//最后一祯时间 //最后一祯时间
@ -220,6 +221,12 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
chargeOrder.setChargingTime(endRealTimeOrder.getChargingTime()); chargeOrder.setChargingTime(endRealTimeOrder.getChargingTime());
message.put("chargingTime",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.setStartTime(startTime);
chargeOrder.setEndTime(endTime); chargeOrder.setEndTime(endTime);
chargeOrder.setStartSoc(startRealTimeOrder.getSoc()); chargeOrder.setStartSoc(startRealTimeOrder.getSoc());
@ -233,6 +240,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
chargeOrder.setChargingDegree(chargingDegree); chargeOrder.setChargingDegree(chargingDegree);
chargeOrder.setType(0); chargeOrder.setType(0);
chargeOrder.setAmountCharged(endRealTimeOrder.getAmountCharged()); chargeOrder.setAmountCharged(endRealTimeOrder.getAmountCharged());
} }
Date startTime2 = chargeOrder.getStartTime(); Date startTime2 = chargeOrder.getStartTime();
@ -307,7 +315,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
//订单异常 //订单异常
xhpcChargeOrder.setStatus(2); xhpcChargeOrder.setStatus(2);
//异常原因 //异常原因
xhpcChargeOrder.setErroRemark("用户id:" + userId + "为空"); xhpcChargeOrder.setErroRemark("".equals(xhpcChargeOrder.getErroRemark())?"用户id:" + userId + "为空":xhpcChargeOrder.getErroRemark()+"用户id:" + userId + "为空");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder); xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
return AjaxResult.error("用户id:" + userId + "为空"); return AjaxResult.error("用户id:" + userId + "为空");
} }
@ -827,6 +835,11 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
return map; 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) { private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) {
List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime,updateTime, rateModelId); List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime,updateTime, rateModelId);
for (int i = 0; i <reatTimeList.size() ; i++) { for (int i = 0; i <reatTimeList.size() ; i++) {

View File

@ -8,17 +8,22 @@ import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService; import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsStation;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import com.xhpc.order.mapper.XhpcStatisticsServiceMapper; import com.xhpc.order.mapper.XhpcStatisticsServiceMapper;
import com.xhpc.order.service.IXhpcHistoryOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService;
import com.xhpc.order.service.IXhpcStatisticsService; import com.xhpc.order.service.IXhpcStatisticsService;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
@ -35,8 +40,11 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
private XhpcStatisticsServiceMapper xhpcStatisticsServiceMapper; private XhpcStatisticsServiceMapper xhpcStatisticsServiceMapper;
@Autowired @Autowired
private IXhpcHistoryOrderService xhpcHistoryOrderService; private IXhpcHistoryOrderService xhpcHistoryOrderService;
@Autowired
private TokenService tokenService;
@Override @Override
public List<Map<String, Object>> getTimeIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getTimeIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if (getJudge(internetUserId, operatorId, type)){ if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -45,26 +53,24 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
chargingStationId= Arrays.asList(chargingStationIds.split(",")); chargingStationId= Arrays.asList(chargingStationIds.split(","));
} }
//获取登陆用户 //获取登陆用户
Long logUserId = SecurityUtils.getUserId(); LoginUser loginUser = tokenService.getLoginUser(request);
List<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ SysUser sysUser = loginUser.getSysUser();
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); String tenantId = loginUser.getTenantId();
if(landUser !=null){ Long sysUserId = sysUser.getUserId();
startPage(); if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(landUser.get("userType") !=null){ startPage();
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站 //运营商看自己的场站
list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId); list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
}else{ }else{
//查询赋值的场站 //查询赋值的场站
list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,logUserId); list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
}
}
} }
}else{ }else{
startPage(); startPage();
list =xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,logUserId); list =xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId);
} }
List<Map<String, Object>> page =new ArrayList<>(); List<Map<String, Object>> page =new ArrayList<>();
if(list !=null && list.size()>0){ if(list !=null && list.size()>0){
@ -159,7 +165,7 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
return page; return page;
} }
@Override @Override
public List<Map<String, Object>> getDateIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getDateIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if (getJudge(internetUserId, operatorId, type)){ if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -167,35 +173,33 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationId= Arrays.asList(chargingStationIds.split(",")); 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<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); startPage();
if(landUser !=null){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
startPage(); Long logOperatorId = sysUser.getOperatorId();
if(landUser.get("userType") !=null){ //运营商看自己的场站
if("01".equals(landUser.get("userType").toString())){ list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); }else{
//运营商看自己的场站 //查询赋值的场站
list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId); list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
}else{
//查询赋值的场站
list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,logUserId);
}
}
} }
}else{ }else{
startPage(); startPage();
list =xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,logUserId); list =xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId);
} }
return list; return list;
} }
@Override @Override
public List<Map<String, Object>> getStationIntervalPage(String chargingStationIds, String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getStationIntervalPage(HttpServletRequest request,String chargingStationIds, String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if (getJudge(internetUserId, operatorId, type)){ if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -207,28 +211,24 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
if(!"".equals(operatorIds) && operatorIds !=null){ if(!"".equals(operatorIds) && operatorIds !=null){
operatorUserId= Arrays.asList(operatorIds.split(",")); operatorUserId= Arrays.asList(operatorIds.split(","));
} }
LoginUser loginUser = tokenService.getLoginUser(request);
//获取登陆用户 SysUser sysUser = loginUser.getSysUser();
Long logUserId = SecurityUtils.getUserId(); String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
List<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); startPage();
if(landUser !=null){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
startPage(); Long logOperatorId = sysUser.getOperatorId();
if(landUser.get("userType") !=null){ //运营商看自己的场站
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,1,logOperatorId,tenantId);
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); }else{
//运营商看自己的场站 //查询赋值的场站
list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,1,logOperatorId); list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,2,sysUserId,tenantId);
}else{
//查询赋值的场站
list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,2,logUserId);
}
}
} }
}else{ }else{
startPage(); 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 @Override
public List<Map<String, Object>> getOperatorIntervalPage(String operatorIds, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getOperatorIntervalPage(HttpServletRequest request,String operatorIds, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if(getJudge(null,operatorId,type)){ if(getJudge(null,operatorId,type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -244,35 +244,31 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
if(!"".equals(operatorIds) && operatorIds !=null){ if(!"".equals(operatorIds) && operatorIds !=null){
operatorUserId= Arrays.asList(operatorIds.split(",")); operatorUserId= Arrays.asList(operatorIds.split(","));
} }
LoginUser loginUser = tokenService.getLoginUser(request);
//获取登陆用户 SysUser sysUser = loginUser.getSysUser();
Long logUserId = SecurityUtils.getUserId(); String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
List<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); startPage();
if(landUser !=null){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
startPage(); Long logOperatorId = sysUser.getOperatorId();
if(landUser.get("userType") !=null){ //运营商看自己的场站
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); }else{
//运营商看自己的场站 //查询赋值的场站
list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 1,logOperatorId); list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
}else{
//查询赋值的场站
list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 2,logUserId);
}
}
} }
}else{ }else{
startPage(); startPage();
list =xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 0,logUserId); list =xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId);
} }
return list; return list;
} }
@Override @Override
public List<Map<String, Object>> getInternetUserIntervalPage(String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getInternetUserIntervalPage(HttpServletRequest request,String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type) {
if(getJudge(internetUserId,null,type)){ if(getJudge(internetUserId,null,type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -280,36 +276,38 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
if(!"".equals(internetUserIds) && internetUserIds !=null){ if(!"".equals(internetUserIds) && internetUserIds !=null){
internetIds= Arrays.asList(internetUserIds.split(",")); 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)){ // if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){
// startTime =date(1); // startTime =date(1);
// endTime =date(2); // endTime =date(2);
// } // }
return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,userId); return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,sysUserId,tenantId);
} }
@Override @Override
public List<Map<String, Object>> getTerminalIntervalPage(String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> 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<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ SysUser sysUser = loginUser.getSysUser();
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); String tenantId = loginUser.getTenantId();
if(landUser !=null){ Long sysUserId = sysUser.getUserId();
startPage(); if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(landUser.get("userType") !=null){ startPage();
if("01".equals(landUser.get("userType").toString())){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站 //运营商看自己的场站
list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 1,logOperatorId); list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
}else{ }else{
//查询赋值的场站 //查询赋值的场站
list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 2,logUserId); list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
}
}
} }
}else{ }else{
startPage(); 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 @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(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(logUserId !=1){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); Long logOperatorId = sysUser.getOperatorId();
if(landUser !=null){ //运营商看自己的场站
if(landUser.get("userType") !=null){ return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logOperatorId, 1,tenantId));
if("01".equals(landUser.get("userType").toString())){ }else{
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); //查询赋值的场站
//运营商看自己的场站 return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 2,tenantId));
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logOperatorId, 1));
}else{
//查询赋值的场站
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logUserId, 2));
}
}
} }
}else{ }else{
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logUserId, 0)); return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 0,tenantId));
} }
return AjaxResult.success();
} }
@Override @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(); LoginUser loginUser = tokenService.getLoginUser(request);
if(logUserId !=1){ SysUser sysUser = loginUser.getSysUser();
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); String tenantId = loginUser.getTenantId();
if(landUser !=null){ Long sysUserId = sysUser.getUserId();
if(landUser.get("userType") !=null){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if("01".equals(landUser.get("userType").toString())){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站 //运营商看自己的场站
return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logOperatorId, 1)); return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logOperatorId, 1,tenantId));
}else{ }else{
//查询赋值的场站 //查询赋值的场站
return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logUserId, 2)); return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 2,tenantId));
}
}
} }
}else{ }else{
return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logUserId, 0)); return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 0,tenantId));
} }
return AjaxResult.success();
} }
@Override @Override
public AjaxResult getInternetUserIList(Long internetUserId, Long userId, Integer type) { public AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId, Long userId, Integer type) {
return AjaxResult.success(xhpcStatisticsServiceMapper.getInternetUserIList(internetUserId, userId, 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 @Override
public AjaxResult getTerminalList(Long chargingStationId, Long userId, Integer type) { public AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId, Long userId, Integer type) {
//获取登陆用户
//获取登陆用户 LoginUser loginUser = tokenService.getLoginUser(request);
Long logUserId = SecurityUtils.getUserId(); SysUser sysUser = loginUser.getSysUser();
if(logUserId !=1){ String tenantId = loginUser.getTenantId();
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); Long sysUserId = sysUser.getUserId();
if(landUser !=null){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(landUser.get("userType") !=null){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
if("01".equals(landUser.get("userType").toString())){ Long logOperatorId = sysUser.getOperatorId();
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); //运营商看自己的场站
//运营商看自己的场站 return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logOperatorId, 1,tenantId));
return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logOperatorId, 1)); }else{
}else{ //查询赋值的场站
//查询赋值的场站 return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, sysUserId, 2,tenantId));
return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logUserId, 2));
}
}
} }
}else{ }else{
return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logUserId, 0)); return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, sysUserId, 0,tenantId));
} }
return AjaxResult.success();
} }
@Override @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<Map<String, String>> list = new ArrayList<>(); List<Map<String, String>> list = new ArrayList<>();
Map<String, Object> landUser = xhpcStatisticsServiceMapper.getLandUser(logUserId); if (UserTypeUtil.SYS_USER_TYPE_TWO.equals(sysUser.getUserType())) {
if (landUser != null) { list = xhpcStatisticsServiceMapper.getInternetList(sysUserId,tenantId);
if (landUser.get("userType") != null && "02".equals(landUser.get("userType").toString())) { }else{
list = xhpcStatisticsServiceMapper.getInternetList(logUserId); list = xhpcStatisticsServiceMapper.getInternetList(null,tenantId);
}else{ Map<String, String> map1 =new HashMap<>();
list = xhpcStatisticsServiceMapper.getInternetList(null); Map<String, String> map2 =new HashMap<>();
Map<String, String> map1 =new HashMap<>(); map1.put("name","微信");
Map<String, String> map2 =new HashMap<>(); map1.put("id","微信");
map1.put("name","微信"); map2.put("name","支付宝");
map1.put("id","微信"); map2.put("id","支付宝");
map2.put("name","支付宝"); list.add(map1);
map2.put("id","支付宝"); list.add(map2);
list.add(map1);
list.add(map2);
}
} }
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Override @Override
public List<Map<String, Object>> getSumSourceList(String startTime, String endTime, String sourceIds, Long userId, Integer type,String chargingStationIds) { public List<Map<String, Object>> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds, Long userId, Integer type,String chargingStationIds) {
List<String> sourceList =new ArrayList<>(); List<String> sourceList =new ArrayList<>();
if(!"".equals(sourceIds) && sourceIds !=null){ if(!"".equals(sourceIds) && sourceIds !=null){
sourceList= Arrays.asList(sourceIds.split(",")); sourceList= Arrays.asList(sourceIds.split(","));
@ -433,7 +421,11 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationIdList= Arrays.asList(chargingStationIds.split(",")); 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 @Override
@ -507,8 +499,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
@Override @Override
public void timeIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void timeIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getTimeIntervalPage(chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getTimeIntervalPage(request,chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -546,8 +538,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
@Override @Override
public void dateIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void dateIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getDateIntervalPage(chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getDateIntervalPage(request,chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -588,8 +580,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
} }
@Override @Override
public void stationIntervalExport(HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { 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<Map<String, Object>> list = getStationIntervalPage(chargingStationIds, operatorIds, internetUserId, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getStationIntervalPage(request,chargingStationIds, operatorIds, internetUserId, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -632,8 +624,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
} }
@Override @Override
public void operatorIntervalExport(HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void operatorIntervalExport(HttpServletRequest request,HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getOperatorIntervalPage(operatorIds, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getOperatorIntervalPage(request,operatorIds, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -676,9 +668,9 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
@Override @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<Map<String, Object>> list = getSumSourceList(startTime, endTime, sourceIds, userId, type,chargingStationIds); List<Map<String, Object>> list = getSumSourceList(request,startTime, endTime, sourceIds, userId, type,chargingStationIds);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -721,8 +713,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
@Override @Override
public void terminalIntervalExport(HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getTerminalIntervalPage(request,chargingStationId, terminalId, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);

View File

@ -327,15 +327,12 @@
cor.serial_number as serialNumber, cor.serial_number as serialNumber,
cs.name as chargingStationName, cs.name as chargingStationName,
ter.name as terminalName, ter.name as terminalName,
ho.history_order_id as historyOrderId,
ho.act_price as actPrice,
cor.charging_time as chargingTime, cor.charging_time as chargingTime,
cor.charging_degree as chargingDegree, cor.charging_degree as chargingDegree,
cor.status as status cor.status as status
from xhpc_charge_order as cor 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_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_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 where cor.status =2
and cor.del_flag =0 and cor.del_flag =0
and cor.user_id=#{userId} and cor.user_id=#{userId}
@ -647,7 +644,7 @@
from xhpc_terminal as xt from xhpc_terminal as xt
left join xhpc_charging_pile as xcp on xcp.serial_number = substring(#{serialNumber}, 1, 14) 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 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
</select> </select>
<select id="select3rdNameBy" resultType="map"> <select id="select3rdNameBy" resultType="map">

View File

@ -609,6 +609,9 @@
<if test="tenantId !=null and tenantId !=''"> <if test="tenantId !=null and tenantId !=''">
and ho.tenant_id =#{tenantId} and ho.tenant_id =#{tenantId}
</if> </if>
<if test="source !=null ">
and ho.source =#{source}
</if>
order by ho.create_time desc order by ho.create_time desc
</select> </select>
@ -668,6 +671,8 @@
when ho.charging_mode="2" then "恒大" when ho.charging_mode="2" then "恒大"
when ho.charging_mode="3" then "新电途" when ho.charging_mode="3" then "新电途"
when ho.charging_mode="4" then "小桔" when ho.charging_mode="4" then "小桔"
when ho.charging_mode="微信" then "微信"
when ho.charging_mode="支付宝" then "支付宝"
else "C端客户" else "C端客户"
end chargingModeName end chargingModeName
from xhpc_history_order as ho from xhpc_history_order as ho
@ -910,4 +915,58 @@
<select id="getLandUser" resultType="map"> <select id="getLandUser" resultType="map">
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId} select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
</select> </select>
<select id="getchargingOrderById" resultType="map">
select
co.serial_number AS serialNumber,
co.charging_time AS chargingTime,
co.charging_degree AS chargingDegree,
co.rate_model_id AS rateModelId,
DATE_FORMAT(co.start_time, '%m月%d日') AS daysOne,
DATE_FORMAT(co.start_time, '%H:%i:%s') AS timeOne,
DATE_FORMAT(co.end_time, '%m月%d日') AS daysTwo,
DATE_FORMAT(co.end_time, '%H:%i:%s') AS timeTwo,
te. NAME AS terminalName,
co. STATUS AS STATUS,
co.type AS type,
cs. NAME AS chargingStationName,
te. NAME AS terminalName,
CASE
WHEN co.type = 40 THEN
"APP远程停止"
WHEN co.type = 41 THEN
"SOC达到100%"
WHEN co.type = 42 THEN
"充电电量满足设定条件"
WHEN co.type = 43 THEN
"充电金额满足设定条件"
WHEN co.type = 44 THEN
"充电时间满足设定条件"
WHEN co.type = 45 THEN
"手动停止充电"
WHEN co.type = 46 THEN
"手动停止充电."
WHEN co.type = 47 THEN
"手动停止充电.."
WHEN co.type = 48 THEN
"急停停止充电"
WHEN co.type = 49 THEN
"手动停止充电..."
ELSE
"手动停止充电!"
END typeName
from xhpc_charge_order co
LEFT JOIN xhpc_terminal AS te ON te.terminal_id = co.terminal_id
LEFT JOIN xhpc_charging_station AS cs ON cs.charging_station_id = co.charging_station_id
where charge_order_id=#{chargingOrderId}
<if test="userId !=null">
and co.user_id = #{userId}
</if>
<if test="source !=null">
and co.source = #{source}
</if>
<if test="tenantId !=null and tenantId !=''">
and co.tenant_id = #{tenantId}
</if>
</select>
</mapper> </mapper>

View File

@ -101,6 +101,9 @@
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
group by status group by status
order by status order by status
</select> </select>
@ -145,6 +148,9 @@
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
group by DATE_FORMAT(create_time,'%Y-%m-%d') group by DATE_FORMAT(create_time,'%Y-%m-%d')
order by DATE_FORMAT(create_time,'%Y-%m-%d') desc order by DATE_FORMAT(create_time,'%Y-%m-%d') desc
</select> </select>
@ -199,6 +205,9 @@
#{operatorId} #{operatorId}
</foreach> </foreach>
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.charging_station_id group by ss.charging_station_id
</select> </select>
@ -244,6 +253,9 @@
<if test="type==2"> <if test="type==2">
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.operator_id group by ss.operator_id
</select> </select>
@ -286,6 +298,9 @@
<if test="type==3"> <if test="type==3">
and ss.internet_user_id =#{internetUserId} and ss.internet_user_id =#{internetUserId}
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.internet_user_id group by ss.internet_user_id
</select> </select>
@ -333,6 +348,9 @@
<if test="type==2"> <if test="type==2">
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.terminal_id group by ss.terminal_id
</select> </select>
@ -348,6 +366,9 @@
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
@ -357,13 +378,15 @@
name as operatorName name as operatorName
from xhpc_operator from xhpc_operator
where 1=1 where 1=1
<if test="type==1"> <if test="type==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 operator_id=#{userId})
</if> </if>
<if test="type==2"> <if test="type==2">
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 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}))
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
<select id="getInternetUserIList" resultType="map"> <select id="getInternetUserIList" resultType="map">
@ -375,6 +398,9 @@
<if test="type==2"> <if test="type==2">
and internet_user_id =#{internetUserId} and internet_user_id =#{internetUserId}
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
<select id="getTerminalList" resultType="map"> <select id="getTerminalList" resultType="map">
@ -389,7 +415,9 @@
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
<insert id="addStatisticsTime"> <insert id="addStatisticsTime">
@ -766,6 +794,9 @@
<if test="userId !=null"> <if test="userId !=null">
and internet_user_id=#{userId} and internet_user_id=#{userId}
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
<select id="getLandUser" resultType="map"> <select id="getLandUser" resultType="map">
@ -814,6 +845,9 @@
#{chargingStationId} #{chargingStationId}
</foreach> </foreach>
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.charging_mode group by ss.charging_mode
</select> </select>
</mapper> </mapper>

View File

@ -81,6 +81,10 @@
<version>3.0.0</version> <version>3.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -35,6 +35,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*; 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 javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -68,6 +70,7 @@ public class AlipayPaymentController {
private static final Logger logger = LoggerFactory.getLogger(AlipayPaymentController.class); private static final Logger logger = LoggerFactory.getLogger(AlipayPaymentController.class);
@Log(title = "支付宝-支付", businessType = BusinessType.INSERT)
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("/payment") @PostMapping("/payment")
@ApiOperation(value = "支付宝支付") @ApiOperation(value = "支付宝支付")

View File

@ -10,6 +10,8 @@ import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.utils.WXPayUtil; import com.xhpc.common.core.utils.WXPayUtil;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.data.down.StartChargingData; 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.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil; import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.domain.XhpcAppUser; import com.xhpc.payment.domain.XhpcAppUser;
@ -78,6 +80,7 @@ public class WxPaymentController {
private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class); private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class);
@Log(title = "微信-支付", businessType = BusinessType.INSERT)
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("/payment") @PostMapping("/payment")
@ApiOperation(value = "微信支付") @ApiOperation(value = "微信支付")

View File

@ -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.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; 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.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil; import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.domain.XhpcAppUser; import com.xhpc.payment.domain.XhpcAppUser;
@ -99,6 +101,7 @@ public class XhpcRefundAuditController extends BaseController {
* @param xhpcRefundAudit * @param xhpcRefundAudit
* @return * @return
*/ */
@Log(title = "退款-审核", businessType = BusinessType.UPDATE)
@PostMapping("/examine") @PostMapping("/examine")
@ApiOperation(value = "退款审核") @ApiOperation(value = "退款审核")
@Transactional @Transactional

View File

@ -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.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; 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.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil; import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.service.IXhpcCommonPayment; import com.xhpc.payment.service.IXhpcCommonPayment;
@ -44,6 +46,7 @@ public class XhpcRefundOrderController extends BaseController {
* *
* @return * @return
*/ */
@Log(title = "申请退款", businessType = BusinessType.INSERT)
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("/checkOut") @PostMapping("/checkOut")
@ApiOperation(value = "申请退款") @ApiOperation(value = "申请退款")

View File

@ -6,10 +6,13 @@ import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.service.BaseService; import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.security.service.TokenService; import com.xhpc.common.security.service.TokenService;
import com.xhpc.payment.controller.AlipayPaymentController;
import com.xhpc.payment.domain.XhpcUserAccountStatement; import com.xhpc.payment.domain.XhpcUserAccountStatement;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper; import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcUserAccountStatementService; import com.xhpc.payment.service.IXhpcUserAccountStatementService;
import com.xhpc.system.api.model.LoginUser; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -36,7 +39,7 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements
@Autowired @Autowired
private TokenService tokenService; 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 * @return
*/ */
@Override @Override
@ -64,13 +67,12 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements
R user = userTypeService.getUser(null, userid, userType, null, tenantId); R user = userTypeService.getUser(null, userid, userType, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null) { if (userMessage != null) {
startPage(); startPage();
return xhpcUserAccountStatementMapper.page(userid,userType,tenantId); return xhpcUserAccountStatementMapper.page(userid,userType,tenantId);
} }
} }
return list; return list;
//return xhpcUserAccountStatementMapper.page(appUserId);
} }
/** /**
@ -115,7 +117,7 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements
/** /**
* 用户流水列表 * 用户流水列表
* *
* @param appUserId C端用户id * @param C端用户id
* @return * @return
*/ */
@Override @Override
@ -129,7 +131,7 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements
R user = userTypeService.getUser(null, userid, userType, null, tenantId); R user = userTypeService.getUser(null, userid, userType, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null) { if (userMessage != null) {
return xhpcUserAccountStatementMapper.list(userid,userType,tenantId); return xhpcUserAccountStatementMapper.list(userid,userType,tenantId);
} }
} }

View File

@ -139,10 +139,10 @@
and xau.app_user_id = #{appUserId} and xau.app_user_id = #{appUserId}
</if> </if>
<if test="tenantId != null and tenantId != ''"> <if test="tenantId != null and tenantId != ''">
and xau.tenant_id = #{tenantId} and xuas.tenant_id = #{tenantId}
</if> </if>
<if test="source!= null"> <if test="source!= null">
and xau.source = #{source} and xuas.source = #{source}
</if> </if>
ORDER BY xuas.create_time DESC ORDER BY xuas.create_time DESC
</select> </select>
@ -188,10 +188,10 @@
and xau.app_user_id = #{appUserId} and xau.app_user_id = #{appUserId}
</if> </if>
<if test="tenantId != null and tenantId != ''"> <if test="tenantId != null and tenantId != ''">
and xau.tenant_id = #{tenantId} and xuas.tenant_id = #{tenantId}
</if> </if>
<if test="source!= null"> <if test="source!= null">
and xau.source = #{source} and xuas.source = #{source}
</if> </if>
ORDER BY xuas.create_time DESC ORDER BY xuas.create_time DESC
</select> </select>

View File

@ -1,4 +1,4 @@
package com.xhpc.pp.mapper; package com.xhpc.mapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;

View File

@ -11,7 +11,7 @@ import com.xhpc.common.data.down.StartChargingData;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.logic.RateModelRequestLogic; 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.server.ChargingPileServer;
import com.xhpc.pp.utils.HexUtils; import com.xhpc.pp.utils.HexUtils;
import com.xhpc.pp.utils.security.CRCCalculator; import com.xhpc.pp.utils.security.CRCCalculator;

View File

@ -8,18 +8,41 @@ import java.util.Date;
@Data @Data
public class XhpcDeviceMessage { public class XhpcDeviceMessage {
/**
* 消息ID
*/
private Long deviceMessageId; private Long deviceMessageId;
/**
* 设备类型
*/
private String type; private String type;
/**
* 设备编码
*/
private String serialNumber; private String serialNumber;
/**
* 充电订单号
*/
private String chargeOrderNo;
/**
* 报文内容
*/
private String content; private String content;
private String replyContent; /**
* 状态
*/
private Integer status; private Integer status;
/**
* 备注描述
*/
private String remark;
private Date createTime; private Date createTime;
private String createBy; private String createBy;
@ -28,5 +51,4 @@ public class XhpcDeviceMessage {
private String updateBy; private String updateBy;
private String remark;
} }

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.BalanceUpdateReplyData; import com.xhpc.common.data.up.BalanceUpdateReplyData;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; 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.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,7 @@ import java.util.Map;
public class BmsChargerInterruptDataLogic implements ServiceLogic { public class BmsChargerInterruptDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -31,18 +27,13 @@ public class BmsChargerInterruptDataLogic implements ServiceLogic {
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电阶段充电机中止报文"; String remark = "充电桩与 BMS 充电阶段充电机中止报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> 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(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo()); deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,6 @@ import java.util.Map;
public class BmsChargingCompletedDataLogic implements ServiceLogic { public class BmsChargingCompletedDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargingCompletedDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargingCompletedDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -32,12 +27,6 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic {
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电结束阶段报文"; String remark = "充电桩与 BMS 充电结束阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> 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(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
@ -45,6 +34,7 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic {
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,6 @@ import java.util.Map;
public class BmsChargingConfigDataLogic implements ServiceLogic { public class BmsChargingConfigDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargingConfigDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargingConfigDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -33,11 +28,6 @@ public class BmsChargingConfigDataLogic implements ServiceLogic {
String remark = "充电桩与 BMS 参数配置阶段报文"; String remark = "充电桩与 BMS 参数配置阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> 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(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
@ -45,6 +35,7 @@ public class BmsChargingConfigDataLogic implements ServiceLogic {
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);

View File

@ -1,16 +1,17 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,18 +19,23 @@ import java.util.Map;
public class BmsChargingDataLogic implements ServiceLogic { public class BmsChargingDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargingDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargingDataLogic.class);
@Autowired @Resource
private XhpcMessageMapper xhpcMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
msg.setChargeOrderNo((String) req.get("orderNo")); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
msg.setRemark("充电桩与 BMS 充电过程 BMS 信息"); deviceMessage.setSerialNumber(sp.getPileNo());
xhpcMessageMapper.insertItemsBy(msg); 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); return new ServiceResult(false);
} }

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,6 @@ import java.util.Map;
public class BmsChargingHandshakeDataLogic implements ServiceLogic { public class BmsChargingHandshakeDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargingHandshakeDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargingHandshakeDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -33,11 +28,6 @@ public class BmsChargingHandshakeDataLogic implements ServiceLogic {
String remark = "充电桩与 BMS 充电握手阶段报文"; String remark = "充电桩与 BMS 充电握手阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> 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(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
@ -45,6 +35,7 @@ public class BmsChargingHandshakeDataLogic implements ServiceLogic {
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);

Some files were not shown because too many files have changed in this diff Show More