diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java index 4508fe61..0597c235 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java @@ -27,9 +27,9 @@ public interface UserTypeService { /** - * 根据用户类型,用户id,充值记录,增加流水 - * @param money 充值金额 - * @param userId 充值用户 + * 根据用户类型,用户id,充值退款记录,增加流水 + * @param money 充值退款金额 + * @param userId 充值退款用户 * @param userType 用户类型 * @param tenantId 租户id * @param type 充值渠道(1微信 2支付宝 3平台) diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java index da87eb51..f213967b 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java @@ -72,5 +72,13 @@ public class UserTypeUtil { */ public static final Integer RECHARGE_STATUS_TWO = 2; + /** + * 退款订单审核-无 + */ + public static final Integer REFUND_APPLICATION_ZERO = 0; + /** + * 退款订单审核-有 + */ + public static final Integer REFUND_APPLICATION_ONE = 1; } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcChargeOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcChargeOrderMapper.java index c106d027..f682d2e6 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcChargeOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcChargeOrderMapper.java @@ -54,12 +54,12 @@ public interface XhpcChargeOrderMapper { /** * 判断用户是否在充电中 */ - String countXhpcRealTimeOrder(@Param("userId")Long userId); + String countXhpcRealTimeOrder(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId); /** * 判断用户是否有异常订单未处理 */ - int countXhpcChargeOrder(@Param("userId")Long userId); + int countXhpcChargeOrder(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId); /** * 获取终端信息 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java index e6ca05bb..0438ae16 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java @@ -124,7 +124,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { return AjaxResult.error(1100, "金额小于5元,不能充电,请充值后再进行充电"); } //充电用户是否存在异常的订单 - int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId); + int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId,userType,tenantId); if (j > 0) { return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决"); } @@ -133,7 +133,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { return AjaxResult.error(1101, "你有申请退款订单在审核中,需要充电请取消申请退款"); } //充电用户是否在充电中 - String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId); + String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId,userType,tenantId); if (!"".equals(i) && i!=null) { return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息"); } @@ -246,8 +246,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { xhpcChargeOrder.setTerminalId(xhpcTerminal.getTerminalId()); xhpcChargeOrder.setGunId(xhpcTerminal.getSerialNumber()); xhpcChargeOrder.setSerialNumber(orderNo); - xhpcChargeOrder.setSource(0); + xhpcChargeOrder.setSource(userType); xhpcChargeOrder.setStatus(-1); + xhpcChargeOrder.setTenantId(tenantId); if (xhpcChargingPileById != null && xhpcChargingPileById.get("power") != null) { xhpcChargeOrder.setPower(xhpcChargingPileById.get("power").toString()); } diff --git a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml index 5571b791..ea99137c 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml @@ -23,6 +23,3 @@ spring: # 共享配置 shared-configs: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} -logging: - level: - com.xhpc.order.mapper: debug \ No newline at end of file diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml index 7d3ef5a2..ece34bd9 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml @@ -128,11 +128,31 @@ update xhpc_app_user set balance=#{balance} where app_user_id=#{userId} @@ -230,6 +230,12 @@ AND xro.type = #{type} + + AND xro.source = #{source} + + + and xro.user_id=#{userId} + ORDER BY xro.create_time DESC diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundAuditMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundAuditMapper.xml index 0b78d504..b747274e 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundAuditMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundAuditMapper.xml @@ -90,4 +90,38 @@ ORDER BY xra.create_time DESC + + + + UPDATE xhpc_community_personnel + + surplus_money = #{surplusMoney}, + is_refund_application = #{isRefundApplication}, + + WHERE community_personnel_id = #{communityPersonnelId} + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml index 99a16e8e..d3d5154b 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml @@ -171,7 +171,7 @@ @@ -302,11 +308,31 @@ + + + UPDATE xhpc_community_personnel set is_refund_application=#{isRefundApplication} where community_personnel_id=#{userId} + \ No newline at end of file diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml index ce2dd28a..0f020fd3 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml @@ -69,7 +69,10 @@ remark, - source + source, + + + tenant_id @@ -116,7 +119,10 @@ #{remark}, - #{source} + #{source}, + + + #{tenantId}, diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java index 146449dc..d8999905 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java @@ -286,8 +286,8 @@ public class XhpcAppUserController extends BaseController { */ @ApiOperation("注销账号") @PostMapping("/logout") - public R logout(String phone, String code) { - return iXhpcAppUserUserService.logout(phone, code); + public R logout(HttpServletRequest request,String phone, String code) { + return iXhpcAppUserUserService.logout(request,phone, code); } @@ -315,7 +315,6 @@ public class XhpcAppUserController extends BaseController { @PostMapping("/batteryProtect") public R batteryProtect(HttpServletRequest request,@RequestBody Map map) { if(map !=null){ - Integer soc = Integer.parseInt(map.get("soc").toString()); Integer socProtect = Integer.parseInt(map.get("socProtect").toString()); Integer userType = Integer.parseInt(map.get("userType").toString()); diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcAppUserMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcAppUserMapper.java index 6d28be21..3e5085af 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcAppUserMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcAppUserMapper.java @@ -3,6 +3,7 @@ package com.xhpc.user.mapper; import com.xhpc.user.domain.XhpcAppUser; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; import java.util.Map; @@ -81,7 +82,7 @@ public interface XhpcAppUserMapper { /** * 记录登录用户的最后一次数据 */ - int addUserLoginTime(@Param("appUserId")Long appUserId, @Param("account")String account, @Param("userType")Integer userType, @Param("openId")String openId,@Param("type")Integer type,@Param("status")Integer status,@Param("tenantId")String tenantId); + int addUserLoginTime(@Param("appUserId")Long appUserId, @Param("account")String account, @Param("userType")Integer userType, @Param("openId")String openId, @Param("type")Integer type, @Param("status")Integer status, @Param("tenantId")String tenantId, @Param("createTime") Date createTime); /** * 修改社区用户信息 diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcAppUserUserService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcAppUserUserService.java index 42812998..32c75c39 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcAppUserUserService.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcAppUserUserService.java @@ -97,7 +97,7 @@ public interface IXhpcAppUserUserService { * @param code * @return */ - public R logout(String phone, String code); + public R logout(HttpServletRequest request,String phone, String code); /** * 设置小程序用户自动退款功能 diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java index d527c3c7..09124672 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java @@ -162,7 +162,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { } } //添加最后一次登录数据 - xhpcAppUserMapper.addUserLoginTime(info.getAppUserId(),info.getPhone(),UserTypeUtil.USER_TYPE,openid,Integer.valueOf(type),null,tenantId); + xhpcAppUserMapper.addUserLoginTime(info.getAppUserId(),info.getPhone(),UserTypeUtil.USER_TYPE,openid,Integer.valueOf(type),null,tenantId,new Date()); return R.fail(HttpStatus.ALREADY_EXISTING, "账号已存在"); } XhpcAppUser xhpcAppUser = new XhpcAppUser(); @@ -259,7 +259,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { } } //添加最后一次登录数据 - xhpcAppUserMapper.addUserLoginTime(appUserId,username,userInfo.getUserType(),openid,Integer.valueOf(type),null,tenantId); + xhpcAppUserMapper.addUserLoginTime(appUserId,username,userInfo.getUserType(),openid,Integer.valueOf(type),null,tenantId,new Date()); redisService.deleteObject("pvToken:" + username); // 获取登录token @@ -323,7 +323,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { redisService.deleteObject("pvToken:" + user.getPhone()); //添加最后一次登录数据 - xhpcAppUserMapper.addUserLoginTime(user.getAppUserId(),username,userInfo.getUserType(),openid,Integer.valueOf(type),UserConstants.LOGIN,tenantId); + xhpcAppUserMapper.addUserLoginTime(user.getAppUserId(),username,userInfo.getUserType(),openid,Integer.valueOf(type),UserConstants.LOGIN,tenantId,new Date()); // 获取登录token return R.ok(tokenService.createToken(userInfo)); } @@ -356,7 +356,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { } xhpcAppUserMapper.update(appUser); //添加最后一次登录数据 - xhpcAppUserMapper.addUserLoginTime(appUser.getAppUserId(),username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId); + xhpcAppUserMapper.addUserLoginTime(appUser.getAppUserId(),username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId,new Date()); } }else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){ if (StatusConstants.OPERATION_WX_TYPE.equals(type)) { @@ -365,7 +365,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { xhpcAppUserMapper.updateCommunityPersonnel(userid,null,null,null,UserConstants.NO_LOGIN); } //添加最后一次登录数据 - xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId); + xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId,new Date()); }else if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){ if (StatusConstants.OPERATION_WX_TYPE.equals(type)) { xhpcAppUserMapper.updateCustomersPersonnel(userid,null,null,UserConstants.NO_LOGIN,null); @@ -373,7 +373,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { xhpcAppUserMapper.updateCustomersPersonnel(userid,null,null,null,UserConstants.NO_LOGIN); } //添加最后一次登录数据 - xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId); + xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId,new Date()); } } // 删除用户缓存记录 @@ -440,10 +440,8 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { map.put("servicePhone",servicePhone); map.put("activity",1); map.put("activitySize",1); - map.put("activityImg","https://www.scxhua.cn/static/img/logo1.8460b7f4.png"); - map.put("socSize",98); - map.put("socUser",80); - map.put("socProtect",1); + map.put("activityImg","https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/bunengshanchu/1.png"); + map.put("socSize",redisService.getCacheObject("global:SOC")); return AjaxResult.success(map); }else{ @@ -460,7 +458,8 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { */ @Override @Transactional - public R logout(String phone, String code) { + public R logout(HttpServletRequest request,String phone, String code) { + if (StringUtils.isEmpty(code)) { return R.fail(HttpStatus.NOT_NULL, "验证码不能为空"); } @@ -471,11 +470,19 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { if (!code.equalsIgnoreCase(captcha)) { return R.fail(HttpStatus.ERROR_STATUS, "验证码错误"); } - XhpcAppUser xhpcAppUser = xhpcAppUserMapper.getAppUserByPhone(phone); - if (StringUtils.isNull(xhpcAppUser)) { - return R.fail(HttpStatus.ERROR_STATUS, "用户不存在"); + LoginUser loginUser = tokenService.getLoginUser(request); + Long userid = loginUser.getUserid(); + Integer userType = loginUser.getUserType(); + String tenantId = loginUser.getTenantId(); + if(UserTypeUtil.USER_TYPE.equals(userType)){ + XhpcAppUser xhpcAppUser = xhpcAppUserMapper.getAppUserByPhone(phone); + if (StringUtils.isNull(xhpcAppUser)) { + return R.fail(HttpStatus.ERROR_STATUS, "用户不存在"); + } + xhpcAppUserMapper.deleteById(xhpcAppUser.getAppUserId()); + }else{ + return R.fail(HttpStatus.ERROR_STATUS, "用户不能注销"); } - xhpcAppUserMapper.deleteById(xhpcAppUser.getAppUserId()); redisService.deleteObject("pvToken:" + phone); return R.ok(); } @@ -507,11 +514,8 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { @Override public R batteryProtect(HttpServletRequest request, Integer soc,Integer socProtect,Integer userType) { LoginUser loginUser = logUserUtils.getLogUser(request); - Object version = redisService.getCacheObject("global:version"); - Object servicePhone = redisService.getCacheObject("global:phone"); //根据不同的用户类型查询不同的信息 Long userid = loginUser.getUserid(); - R user = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null,loginUser.getTenantId()); if(user !=null && user.getData() !=null){ Map map = (Map)user.getData(); @@ -525,7 +529,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { }else if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){ xhpcAppUserMapper.updateCustomersSocProtect(userid,socProtect,soc); } - return R.fail(HttpStatus.ERROR_STATUS, "设置失败"); + return R.fail(HttpStatus.SUCCESS, "设置成功"); } return R.fail(HttpStatus.ERROR_STATUS, "设置失败"); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java index a1dcd9ab..0df70871 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java @@ -48,6 +48,10 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { @Override public AjaxResult addCommunity(XhpcCommunity xhpcCommunity) { + boolean judge = judgeXhpcCommunity(xhpcCommunity); + if(!judge){ + return AjaxResult.error("参数必填"); + } //名称重复不能入库 Map communityById = xhpcCommunityMapper.getCommunityById(null, xhpcCommunity.getName(), null); if(communityById !=null){ @@ -84,6 +88,11 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { @Override public AjaxResult updateCommunity(XhpcCommunity xhpcCommunity) { + + boolean judge = judgeXhpcCommunity(xhpcCommunity); + if(!judge){ + return AjaxResult.error("参数必填"); + } //名称重复不能入库 Map communityById = xhpcCommunityMapper.getCommunityById(xhpcCommunity.getCommunityId(), xhpcCommunity.getName(), 2); if(communityById !=null){ @@ -118,6 +127,10 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { @Override @Transactional public AjaxResult addCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel) { + boolean judge = judgeXhpcCommunityPersonnel(xhpcCommunityPersonnel); + if(!judge){ + return AjaxResult.error("参数必填"); + } String phone = xhpcCommunityPersonnel.getPhone(); String account = xhpcCommunityPersonnel.getAccount(); Map communityPersonnelById = xhpcCommunityMapper.getCommunityPersonnelById(null, phone, account, 3); @@ -149,6 +162,10 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { @Override public AjaxResult updateCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel) { + boolean judge = judgeXhpcCommunityPersonnel(xhpcCommunityPersonnel); + if(!judge){ + return AjaxResult.error("参数必填"); + } Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId(); String phone = xhpcCommunityPersonnel.getPhone(); String account = xhpcCommunityPersonnel.getAccount(); @@ -217,4 +234,38 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService { } return AjaxResult.error("充值金额必需大于0"); } + + public boolean judgeXhpcCommunity(XhpcCommunity xhpcCommunity){ + + if(xhpcCommunity.getName()==null || "".equals(xhpcCommunity.getName())){ + return false; + } + if(xhpcCommunity.getContactName()==null || "".equals(xhpcCommunity.getContactName())){ + return false; + } + if(xhpcCommunity.getContactPhone()==null || "".equals(xhpcCommunity.getContactPhone())){ + return false; + } + if(xhpcCommunity.getAddress()==null || "".equals(xhpcCommunity.getAddress())){ + return false; + } + return true; + } + + public boolean judgeXhpcCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel){ + + if(xhpcCommunityPersonnel.getName()==null || "".equals(xhpcCommunityPersonnel.getName())){ + return false; + } + if(xhpcCommunityPersonnel.getAccount()==null || "".equals(xhpcCommunityPersonnel.getAccount()) || !"ST".equals(xhpcCommunityPersonnel.getAccount().substring(0,2))){ + return false; + } + if(xhpcCommunityPersonnel.getPhone()==null || "".equals(xhpcCommunityPersonnel.getPhone()) || xhpcCommunityPersonnel.getPhone().length()!=11){ + return false; + } + + return true; + } + + } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java index 6e0a20c8..0a0c2e67 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java @@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.system.api.model.LoginUser; +import com.xhpc.user.domain.XhpcCommunity; import com.xhpc.user.domain.XhpcCustomers; import com.xhpc.user.domain.XhpcCustomersPersonnel; import com.xhpc.user.mapper.XhpcCustomersMapper; @@ -53,7 +54,10 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService { @Override public AjaxResult addCustomers(HttpServletRequest request, XhpcCustomers xhpcCustomers) { - + boolean b = judgeXhpcCustomers(xhpcCustomers); + if(b){ + return AjaxResult.error("参数比传"); + } //名称重复不能入库 Map communityById = xhpcCustomersMapper.getCustomersById(null, xhpcCustomers.getName(), null); if(communityById !=null){ @@ -109,6 +113,10 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService { @Override public AjaxResult updateCustomers(XhpcCustomers xhpcCustomers) { + boolean b = judgeXhpcCustomers(xhpcCustomers); + if(b){ + return AjaxResult.error("参数比传"); + } //名称重复不能入库 Map customersById = xhpcCustomersMapper.getCustomersById(xhpcCustomers.getCustomersId(), xhpcCustomers.getName(), 2); if(customersById !=null){ @@ -135,6 +143,10 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService { @Override public AjaxResult addCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel) { + boolean b = judgeXhpcCustomersPersonnel(xhpcCustomersPersonnel); + if(b){ + return AjaxResult.error("参数比传"); + } String phone = xhpcCustomersPersonnel.getPhone(); String account = xhpcCustomersPersonnel.getAccount(); Map communityPersonnelById = xhpcCustomersMapper.getCustomersPersonnelById(null, phone, account, 3); @@ -147,9 +159,11 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService { } } BigDecimal rechargeMoney = xhpcCustomersPersonnel.getRechargeMoney(); - if(new BigDecimal(0).compareTo(rechargeMoney)==-1){ - //增加社区用户的剩余金额 - xhpcCustomersPersonnel.setSurplusMoney(rechargeMoney); + if(rechargeMoney !=null){ + if(new BigDecimal(0).compareTo(rechargeMoney)==-1){ + //增加社区用户的剩余金额 + xhpcCustomersPersonnel.setSurplusMoney(rechargeMoney); + } } xhpcCustomersMapper.addCustomersPersonnel(xhpcCustomersPersonnel); //增加一条充值记录 @@ -166,6 +180,10 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService { @Override public AjaxResult updateCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel) { + boolean b = judgeXhpcCustomersPersonnel(xhpcCustomersPersonnel); + if(b){ + return AjaxResult.error("参数比传"); + } Long customersPersonnelId = xhpcCustomersPersonnel.getCustomersPersonnelId(); String phone = xhpcCustomersPersonnel.getPhone(); String account = xhpcCustomersPersonnel.getAccount(); @@ -231,4 +249,36 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService { public void updateCustomersPersonnelStatus(XhpcCustomersPersonnel xhpcCustomersPersonnel) { xhpcCustomersMapper.updateCustomersPersonnelStatus(xhpcCustomersPersonnel.getCustomersPersonnelId(),xhpcCustomersPersonnel.getStatus()); } + + public boolean judgeXhpcCustomers(XhpcCustomers xhpcCustomers){ + + if(xhpcCustomers.getName()==null || "".equals(xhpcCustomers.getName())){ + return false; + } + if(xhpcCustomers.getContactName()==null || "".equals(xhpcCustomers.getContactName())){ + return false; + } + if(xhpcCustomers.getContactPhone()==null || "".equals(xhpcCustomers.getContactPhone())){ + return false; + } + if(xhpcCustomers.getAddress()==null || "".equals(xhpcCustomers.getAddress())){ + return false; + } + return true; + } + + public boolean judgeXhpcCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel){ + + if(xhpcCustomersPersonnel.getName()==null || "".equals(xhpcCustomersPersonnel.getName())){ + return false; + } + if(xhpcCustomersPersonnel.getAccount()==null || "".equals(xhpcCustomersPersonnel.getAccount()) || "BE".equals(xhpcCustomersPersonnel.getAccount().substring(0,2))){ + return false; + } + if(xhpcCustomersPersonnel.getPhone()==null || "".equals(xhpcCustomersPersonnel.getPhone()) || xhpcCustomersPersonnel.getPhone().length() !=11){ + return false; + } + return true; + } + } diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml index fae76807..b1c3105a 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml @@ -296,5 +296,5 @@ #{source}, -= + diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml index 77f5dadb..cd7d2321 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml @@ -277,7 +277,10 @@ status, - tenant_id + tenant_id, + + + create_time, @@ -302,6 +305,9 @@ #{tenantId}, + + #{createTime}, + @@ -338,6 +344,7 @@ and tenant_id=#{tenantId} + order by create_time desc limit 1 diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommonMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommonMapper.xml index c100293e..ccb3e0c2 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommonMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommonMapper.xml @@ -12,7 +12,7 @@ phone as phone, is_refund_application as isRefundApplication, is_refund as isRefund, - soc as soc, + soc as socUser, balance as balance, avatar as avatar, status, @@ -24,6 +24,7 @@ concat(0) as userType, concat("C") as userTypeName, tenant_id tenantId, + soc_protect socProtect, create_time as createTime from xhpc_app_user where del_flag=0 @@ -45,7 +46,7 @@ phone as phone, is_refund_application as isRefundApplication, is_refund as isRefund, - soc as soc, + soc as socUser, surplus_money as balance, avatar as avatar, status, @@ -56,6 +57,7 @@ tenant_id tenantId, del_flag delFlag, concat(2) as userType, + soc_protect socProtect, concat("ST") as userTypeName, (select count(charging_station_id) from xhpc_mechanism where community_id=mechanism_id and source=0 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number, @@ -81,7 +83,7 @@ phone as phone, is_refund_application as isRefundApplication, is_refund as isRefund, - soc as soc, + soc as socUser, surplus_money as balance, avatar as avatar, status, @@ -92,6 +94,7 @@ del_flag delFlag, tenant_id tenantId, concat(3) as userType, + soc_protect socProtect, concat("BE") as userTypeName, (select count(charging_station_id) from xhpc_mechanism where customers_id=mechanism_id and source=1 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number, diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml index c5849223..38fa96e1 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml @@ -379,6 +379,7 @@ update_time = #{updateTime}, update_by = #{updateBy}, remark = #{remark}, + is_refund_application = #{isRefundApplication}, where community_personnel_id=#{communityPersonnelId} @@ -390,4 +391,5 @@ update xhpc_community_personnel set status=#{status} where community_personnel_id=#{communityPersonnelId} +