diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysUser.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysUser.java index fd5df93e..f7d73f4f 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysUser.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysUser.java @@ -121,6 +121,9 @@ public class SysUser extends BaseEntity /** 角色ID */ private Long roleId; + /** 菜单组 */ + private Long[] menuIds; + public SysUser() { @@ -369,6 +372,16 @@ public class SysUser extends BaseEntity this.internetUserId = internetUserId; } + public Long[] getMenuIds() { + + return menuIds; + } + + public void setMenuIds(Long[] menuIds) { + + this.menuIds = menuIds; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java index 03a0da35..d3de72c4 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java @@ -14,10 +14,8 @@ import com.xhpc.common.security.annotation.PreAuthorize; import com.xhpc.system.api.domain.SysRole; import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.model.LoginUser; -import com.xhpc.system.service.ISysPermissionService; -import com.xhpc.system.service.ISysPostService; -import com.xhpc.system.service.ISysRoleService; -import com.xhpc.system.service.ISysUserService; +import com.xhpc.system.service.*; +import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -25,6 +23,8 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -49,6 +49,11 @@ public class SysUserController extends BaseController { @Autowired private ISysPermissionService permissionService; + @Autowired + private IXhpcDataDimensionService dataDimensionService; + + + /** * 获取用户列表 */ @@ -196,7 +201,7 @@ public class SysUserController extends BaseController { @PutMapping("/resetPwd") public AjaxResult resetPwd(@RequestBody SysUser user) { userService.checkUserAllowed(user); - user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + user.setPassword(SecurityUtils.encryptPassword("123456")); user.setUpdateBy(SecurityUtils.getUsername()); return toAjax(userService.resetPwd(user)); } @@ -238,5 +243,40 @@ public class SysUserController extends BaseController { return success(); } + /** + * 获取菜单下拉树列表(已废弃) + */ + @GetMapping("/treeselect") + public AjaxResult treeselect(){ + return AjaxResult.success(dataDimensionService.buildMenuTreeSelect()); + } + + /** + * 获取数据维度(已废弃) + */ + @GetMapping(value = "/roleMenuTreeselect") + public AjaxResult roleMenuTreeselect(String userId){ + + Long userIds = SecurityUtils.getUserId(); + SysUser user = userService.selectUserById(userIds); + if("00".equals(user.getUserType())){ + AjaxResult ajax = AjaxResult.success(); + if("".equals(userId) || userId ==null){ + ajax.put("checkedKeys", new ArrayList<>()); + }else{ + ajax.put("checkedKeys", dataDimensionService.selectByUserId(Long.valueOf(userId))); + } + ajax.put("menus", dataDimensionService.buildMenuTreeSelect()); + return ajax; + } + AjaxResult ajax = AjaxResult.error(); + ajax.put("checkedKeys", new ArrayList<>()); + ajax.put("menus", new ArrayList<>()); + return ajax; + } + + + + } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/XhpcUserPrivilegeController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/XhpcUserPrivilegeController.java index 4ce0b206..4e77ad27 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/XhpcUserPrivilegeController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/XhpcUserPrivilegeController.java @@ -73,7 +73,9 @@ public class XhpcUserPrivilegeController extends BaseController { Long userId = list.get(0).getUserId(); iXhpcUserPrivilegeService.deleteByIds(userId); for (XhpcUserPrivilege xhpcUserPrivilege : list) { - iXhpcUserPrivilegeService.insert(xhpcUserPrivilege); + if(xhpcUserPrivilege.getChargingStationId() !=null){ + iXhpcUserPrivilegeService.insert(xhpcUserPrivilege); + } } } return AjaxResult.success(); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/domain/XhpcDataDimension.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/domain/XhpcDataDimension.java new file mode 100644 index 00000000..e8c7cf52 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/domain/XhpcDataDimension.java @@ -0,0 +1,75 @@ +package com.xhpc.system.domain; + +import com.xhpc.common.core.web.domain.BaseEntity; +import io.swagger.models.auth.In; + +/** + * 数据维度 + * @author yuyang + * @date 2021/10/26 14:10 + * @Version 1.0 + */ +public class XhpcDataDimension extends BaseEntity { + + /** 数据维度ID */ + private Long dataDimensionId; + /** 用户ID */ + private Long userId; + /** 场站ID */ + private Long chargingStationId; + /** 状态(0显示 1隐藏) */ + private Integer status; + /** 删除状态(0显示 1隐藏) */ + private Integer delFlag; + + public Long getDataDimensionId() { + + return dataDimensionId; + } + + public void setDataDimensionId(Long dataDimensionId) { + + this.dataDimensionId = dataDimensionId; + } + + public Long getUserId() { + + return userId; + } + + public void setUserId(Long userId) { + + this.userId = userId; + } + + public Long getChargingStationId() { + + return chargingStationId; + } + + public void setChargingStationId(Long chargingStationId) { + + this.chargingStationId = chargingStationId; + } + + public Integer getStatus() { + + return status; + } + + public void setStatus(Integer status) { + + this.status = status; + } + + public Integer getDelFlag() { + + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + + this.delFlag = delFlag; + } + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/mapper/XhpcDataDimensionMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/mapper/XhpcDataDimensionMapper.java new file mode 100644 index 00000000..e85043ed --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/mapper/XhpcDataDimensionMapper.java @@ -0,0 +1,31 @@ +package com.xhpc.system.mapper; + +import com.xhpc.system.domain.XhpcDataDimension; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/10/26 14:16 + * @Version 1.0 + */ +public interface XhpcDataDimensionMapper { + + /** + * 根据用户ID查询菜单树信息 + * + * @param userId 用户ID + * @return 选中菜单列表 + */ + public List selectByUserId(@Param("userId")Long userId); + + + /** + * 获取所有运营商 + * + * @return 菜单列表 + */ + public List> buildMenuTreeSelect(); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/IXhpcDataDimensionService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/IXhpcDataDimensionService.java new file mode 100644 index 00000000..e15bffe6 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/IXhpcDataDimensionService.java @@ -0,0 +1,34 @@ +package com.xhpc.system.service; + +import com.xhpc.system.domain.SysMenu; +import com.xhpc.system.domain.XhpcDataDimension; +import com.xhpc.system.domain.vo.TreeSelect; + +import java.util.List; + +/** + * @author yuyang + * @date 2021/10/26 14:15 + * @Version 1.0 + */ +public interface IXhpcDataDimensionService { + + + /** + * 根据用户ID查询菜单树信息 + * + * @param userId 用户ID + * @return 选中菜单列表 + */ + public List selectByUserId(Long userId); + + + /** + * 查询数据维度菜单列表 + * + * @return 菜单列表 + */ + public List buildMenuTreeSelect(); + + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/XhpcDataDimensionServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/XhpcDataDimensionServiceImpl.java new file mode 100644 index 00000000..6707a434 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/XhpcDataDimensionServiceImpl.java @@ -0,0 +1,66 @@ +package com.xhpc.system.service.impl; + +import com.xhpc.system.api.domain.SysUser; +import com.xhpc.system.domain.SysMenu; +import com.xhpc.system.domain.XhpcDataDimension; +import com.xhpc.system.domain.vo.TreeSelect; +import com.xhpc.system.mapper.XhpcDataDimensionMapper; +import com.xhpc.system.service.IXhpcDataDimensionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/10/26 14:16 + * @Version 1.0 + */ +@Service +public class XhpcDataDimensionServiceImpl implements IXhpcDataDimensionService { + + + @Autowired + private XhpcDataDimensionMapper xhpcDataDimensionMapper; + + @Override + public List selectByUserId(Long userId) { + + return xhpcDataDimensionMapper.selectByUserId(userId); + } + + @Override + public List buildMenuTreeSelect() { + List treeSelectList =new ArrayList(); + //拼接树 + //获取所有运营商和场站 + List> list = xhpcDataDimensionMapper.buildMenuTreeSelect(); + + if(list !=null && list.size()>0){ + for (int i = 0; i map = list.get(i); + treeSelect.setId(Long.valueOf(map.get("operatorId").toString())); + treeSelect.setLabel(map.get("operatorName").toString()); + if(map.get("chargingStationId") !=null){ + String[] ids = map.get("chargingStationId").toString().split(","); + String[] names = map.get("chargingStationName").toString().split(","); + List treeSelectList1 =new ArrayList(); + for (int j = 0; j + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml index 57f7f759..459f9e1d 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -32,6 +32,8 @@ + + @@ -240,6 +242,8 @@ ct.reminder_instructions as reminderInstructions, ct.client_visible as clientVisible, ct.img_id as imgId, + ct.service_tel as serviceTel, + ct.park_nums as parkNums, GROUP_CONCAT(DISTINCT xdbs.dict_value ORDER BY xdbs.create_time ASC separator ',' ) serviceFacilitiesName, GROUP_CONCAT(DISTINCT xdbp.dict_value ORDER BY xdbp.create_time ASC separator ',' ) peripheryFacilitiesName from xhpc_charging_station as ct diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/SmsService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/SmsService.java index 957e310f..84b5a077 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/SmsService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/SmsService.java @@ -5,6 +5,7 @@ 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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import java.util.Map; @@ -18,6 +19,6 @@ import java.util.Map; public interface SmsService { @PostMapping("/sms/send") - R sendNotice(@RequestParam(value = "phone") String phone, @RequestParam(value = "content") String content, Map paramMap); + R sendNotice(@RequestBody Map paramMap); } diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/SmsFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/SmsFallbackFactory.java index 86edcea9..0156a7f1 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/SmsFallbackFactory.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/SmsFallbackFactory.java @@ -23,7 +23,7 @@ public class SmsFallbackFactory implements FallbackFactory { logger.error("短信发送服务调用失败:{} //fallback", cause.getMessage()); return new SmsService() { @Override - public R sendNotice(String phone, String content, Map paramMap) { + public R sendNotice(Map paramMap) { return R.fail("短信发送失败:" + cause.getMessage()); } diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcChargingStation.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcChargingStation.java index 6df37a5e..a5ef6e5c 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcChargingStation.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcChargingStation.java @@ -31,11 +31,11 @@ public class XhpcChargingStation extends BaseEntity { /** 建设场所 */ @Excel(name = "建设场所") - private String constructionSite; + private Integer constructionSite; /** 电站类型 */ @Excel(name = "电站类型") - private String stationType; + private Integer stationType; /** 服务设施 */ @Excel(name = "服务设施") @@ -105,6 +105,18 @@ public class XhpcChargingStation extends BaseEntity { */ private String operatorIdEvcs; + /** + * 站点电话 + */ + private String serviceTel; + + + /** + *侧位数量 + */ + private String parkNums; + + public String getOperatorIdEvcs() { return operatorIdEvcs; @@ -151,19 +163,6 @@ public class XhpcChargingStation extends BaseEntity { { return type; } - public void setConstructionSite(String constructionSite) - { - this.constructionSite = constructionSite; - } - - public String getConstructionSite() - { - return constructionSite; - } - public void setServiceFacilities(String serviceFacilities) - { - this.serviceFacilities = serviceFacilities; - } public String getServiceFacilities() { @@ -308,14 +307,49 @@ public class XhpcChargingStation extends BaseEntity { this.reminderInstructions = reminderInstructions; } - public String getStationType() { + public Integer getConstructionSite() { + + return constructionSite; + } + + public void setConstructionSite(Integer constructionSite) { + + this.constructionSite = constructionSite; + } + + public Integer getStationType() { return stationType; } - public void setStationType(String stationType) { + public void setStationType(Integer stationType) { this.stationType = stationType; } + public void setServiceFacilities(String serviceFacilities) { + + this.serviceFacilities = serviceFacilities; + } + + public String getServiceTel() { + + return serviceTel; + } + + public void setServiceTel(String serviceTel) { + + this.serviceTel = serviceTel; + } + + public String getParkNums() { + + return parkNums; + } + + public void setParkNums(String parkNums) { + + this.parkNums = parkNums; + } + } diff --git a/xhpc-modules/xhpc-general/pom.xml b/xhpc-modules/xhpc-general/pom.xml index 859ec3dd..b54d7477 100644 --- a/xhpc-modules/xhpc-general/pom.xml +++ b/xhpc-modules/xhpc-general/pom.xml @@ -19,14 +19,13 @@ 8 - + com.aliyun dysmsapi20170525 2.0.5 - com.alibaba.cloud diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java index 8de95283..5d09fe6f 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java @@ -45,48 +45,33 @@ public class XhpcSmsController extends BaseController { } @PostMapping(value = "/send") - public void send(@RequestParam(required = false) String phone, String content, @RequestBody Map paramMap) { + public void send(@RequestBody Map paramMap) { String signatureName = null; String templateId = null; //方便使用PostMan调用接口测试 - if (phone != null && content != null) { - //判断内容是什么,调用相应的模板 - if (content.contains("电量为")) { - signatureName = "小华充电"; - templateId = "SMS_226945037"; - } else if (content.contains("总费用为")) { - signatureName = "小华充电"; - templateId = "SMS_226786374"; - } else if (content.contains("余额小于")) { - signatureName = "小华充电"; - templateId = "SMS_226935795"; - } else if (content.contains("设定的SOC")) { - signatureName = "小华充电"; - templateId = "SMS_227005968"; - } - } else { - phone = paramMap.get("phone"); - content = paramMap.get("content"); - paramMap.remove("phone"); - paramMap.remove("content"); - //判断内容是什么,调用相应的模板 - if (content.contains("电量为")) { - signatureName = "小华充电"; - templateId = "SMS_226945037"; - } else if (content.contains("总费用为")) { - signatureName = "小华充电"; - templateId = "SMS_226786374"; - } else if (content.contains("余额小于")) { - signatureName = "小华充电"; - templateId = "SMS_226935795"; - } else if (content.contains("设定的SOC")) { - signatureName = "小华充电"; - templateId = "SMS_227005968"; - } + + String phone = paramMap.get("phone"); + String content = paramMap.get("content"); + paramMap.remove("phone"); + paramMap.remove("content"); + //判断内容是什么,调用相应的模板 + if (content.contains("电量为")) { + signatureName = "小华充电"; + templateId = "SMS_226945037"; + } else if (content.contains("总费用为")) { + signatureName = "小华充电"; + templateId = "SMS_226786374"; + } else if (content.contains("余额小于")) { + signatureName = "小华充电"; + templateId = "SMS_226935795"; + } else if (content.contains("设定的SOC")) { + signatureName = "小华充电"; + templateId = "SMS_227005968"; } + xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap); } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java index 461a3b5d..06d7e023 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java @@ -108,7 +108,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService { return AjaxResult.error(1012, "服务器繁忙,请稍后再试"); } } catch (Exception e) { - //e.printStackTrace(); + e.printStackTrace(); xhpcSms.setStatus(3); xhpcSmsMapper.addXhpcSms(xhpcSms); return AjaxResult.error(1010,"服务器繁忙,请稍后再试"); @@ -195,12 +195,12 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService { //获取发送结果状态码 String statusCode = sendSmsResponse.getBody().getCode(); //获取短信的Biz号 - String bizId = sendSmsResponse.getBody().getBizId(); + //String bizId = sendSmsResponse.getBody().getBizId(); //获取短信的发送日期,并将其转换为yyyyMMdd的格式 - String date = sendSmsResponse.getHeaders().get("date"); - Date realDate = new Date(date); - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); - String formatData = sdf.format(realDate); + //String date = sendSmsResponse.getHeaders().get("date"); + //Date realDate = new Date(date); + //SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + //String formatData = sdf.format(realDate); //获取实际的模板内容 String templateContent = getTemplateContent(templateId, paramMap); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java index 70942bdc..9f7a2b23 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java @@ -154,6 +154,14 @@ public class XhpcChargeOrderController extends BaseController { data.put("parkingInstructions","充电完成请尽快离场,超时车位占用费10元/小时"); map.put("data", data); }else{ + try{ + String c = orderMessage.get("electricCurrent").toString(); + String v = orderMessage.get("voltage").toString(); + BigDecimal decimal1 = new BigDecimal(v).multiply(new BigDecimal(c)).setScale(2, BigDecimal.ROUND_DOWN); + orderMessage.put("power",decimal1); + }catch (Exception e){ + e.printStackTrace(); + } map.put("data",orderMessage); } JSONObject json = new JSONObject(map); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index 54ba1137..d2ccb552 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -80,7 +80,7 @@ public class XhpcHistoryOrderController extends BaseController { * 终端统计 */ @GetMapping("/test3") - //@Scheduled(cron = "0 0 12 * * ?") + @Scheduled(cron = "0 0 12 * * ?") public void test3(){ add(100,3); } @@ -88,7 +88,7 @@ public class XhpcHistoryOrderController extends BaseController { * 场站统计 */ @GetMapping("/test2") - //@Scheduled(cron = "0 0 11 * * ?") + @Scheduled(cron = "0 0 11 * * ?") public void test2(){ add(100,2); } @@ -97,7 +97,7 @@ public class XhpcHistoryOrderController extends BaseController { * 日期统计 */ @GetMapping("/test1") - //@Scheduled(cron = "0 0 00 * * ?") + @Scheduled(cron = "0 0 00 * * ?") public void test1(){ //获取500条待统计历史订单 //跨时段,跨费率,计费模型 @@ -171,7 +171,7 @@ public class XhpcHistoryOrderController extends BaseController { * 小时统计 */ @GetMapping("/test") - //@Scheduled(cron = "0 */1 * * * ?") + @Scheduled(cron = "0 */1 * * * ?") public void test(){ //获取500条待统计历史订单 //跨时段,跨费率,计费模型 @@ -275,7 +275,7 @@ public class XhpcHistoryOrderController extends BaseController { * 24小时异常订单自动结算 */ @GetMapping("/test4") - //@Scheduled(cron = "0 0/5 * * * ?") + @Scheduled(cron = "0 0/5 * * * ?") public void test4(){ //获取异常的订单 24小时之外的异常订单 List xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2, 0); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index 5781d21a..897fc8df 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -380,13 +380,15 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { HashMap paramMap = new HashMap<>(); paramMap.put("elec", xhpcChargeOrder.getEndSoc()); paramMap.put("sumMoney", actPrice.toString()); - String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; - smsService.sendNotice(user.get("phone").toString(), content, paramMap); + paramMap.put("phone", user.get("phone").toString()); + paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"); + smsService.sendNotice(paramMap); }else { HashMap paramMap = new HashMap<>(); paramMap.put("sumMoney", actPrice.toString()); - String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; - smsService.sendNotice(user.get("phone").toString(), content, paramMap); + paramMap.put("phone", user.get("phone").toString()); + paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"); + smsService.sendNotice(paramMap); } } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index 9848f1c2..40717d59 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -386,13 +386,15 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { HashMap paramMap = new HashMap<>(); paramMap.put("elec", xhpcChargeOrder.getEndSoc()); paramMap.put("sumMoney", actPrice.toString()); - String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; - smsService.sendNotice(user.get("phone").toString(), content, paramMap); + paramMap.put("phone", user.get("phone").toString()); + paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"); + smsService.sendNotice(paramMap); }else { HashMap paramMap = new HashMap<>(); paramMap.put("sumMoney", actPrice.toString()); - String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; - smsService.sendNotice(user.get("phone").toString(), content, paramMap); + paramMap.put("phone", user.get("phone").toString()); + paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"); + smsService.sendNotice(paramMap); } } } @@ -569,6 +571,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { } BigDecimal v = new BigDecimal(cacheRealtimeData.getWorkingVoltage()).divide(new BigDecimal(10)); BigDecimal c = new BigDecimal(cacheRealtimeData.getWorkingCurrent()).divide(new BigDecimal(10)); + BigDecimal decimal1 = v.multiply(c).setScale(2, BigDecimal.ROUND_DOWN); xhpcRealTimeOrder.setVoltage(v); xhpcRealTimeOrder.setElectricCurrent(c); xhpcRealTimeOrder.setGunLineTemperature(cacheRealtimeData.getGunLineTemperature()); @@ -648,7 +651,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { data.put("chargingTime",xhpcRealTimeOrder.getChargingTime()); data.put("electricCurrent",c); data.put("voltage", v); - data.put("power", xhpcChargeOrder.getPower()); + data.put("power", decimal1); data.put("chargingDegree", chargingDegree); data.put("remainingTime",xhpcRealTimeOrder.getRemainingTime()); data.put("serialNumber",orderNo.substring(0,16)); diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java index 24a2f685..0526c16b 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java @@ -92,10 +92,13 @@ public class WxPaymentController { } } //用户信息id - String userId = StringUtils.valueOf(map.get("userId")); - if (StringUtils.isEmpty(userId)) { - return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空"); + if(map.get("userId") ==null || "".equals(map.get("userId").toString())){ + return AjaxResult.error(HttpStatus.NOT_NULL, "请在我的里面进行充值"); } + String userId = StringUtils.valueOf(map.get("userId")); +// if (StringUtils.isEmpty(userId)) { +// return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空"); +// } Map refundOrder = iXhpcRefundOrderService.getNotRefundOrder(Long.parseLong(userId)); if (StringUtils.isNotNull(refundOrder)) { return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款"); diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java index 4cbeecd0..3606b645 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java @@ -36,8 +36,11 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.web.bind.annotation.*; @@ -72,6 +75,7 @@ public class XhpcRefundAuditController extends BaseController { @Autowired private Environment environment; + private static final Logger logger = LoggerFactory.getLogger(XhpcRefundAuditController.class); /** * 退款审核 * @@ -83,6 +87,11 @@ public class XhpcRefundAuditController extends BaseController { @Transactional public AjaxResult info(@RequestBody XhpcRefundAudit xhpcRefundAudit) { + return getAjaxResult(xhpcRefundAudit); + } + + private AjaxResult getAjaxResult(XhpcRefundAudit xhpcRefundAudit) { + Long refundOrderId = xhpcRefundAudit.getRefundOrderId(); Map map = iXhpcRefundOrderService.info(refundOrderId); @@ -499,4 +508,32 @@ public class XhpcRefundAuditController extends BaseController { refundOrder.setStatus(status); iXhpcRefundOrderService.update(refundOrder); } + + + /** + * 定时任务,每5分钟,扫描一次,退款订单金额小于100,自动审核通过 + * + */ + @Scheduled(cron = "0 */5 * * * ?") + @GetMapping("/moneyPage") + public void moneyPage(){ + try { + List list = iXhpcRefundOrderService.moneyPage(); + if(list !=null && list.size()>0){ + for (int i = 0; i moneyPage(); } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java index 75a10dfa..732abd5b 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java @@ -81,4 +81,8 @@ public interface IXhpcRefundOrderService { */ int countXhpcChargeOrder(Long userId); + /** + * 定时任务,每5分钟,扫描一次,退款订单金额小于100,自动审核通过 + */ + public List moneyPage(); } \ No newline at end of file diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java index 0667bbc2..6a33e7d7 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java @@ -143,4 +143,10 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService { return xhpcRefundOrderMapper.countXhpcChargeOrder(userId); } + @Override + public List moneyPage() { + + return xhpcRefundOrderMapper.moneyPage(); + } + } \ 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 bf35408f..ed647a80 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml @@ -231,4 +231,10 @@ + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java index 150f1ddf..3fc1cfed 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java @@ -147,9 +147,9 @@ public class RealtimeDataLogic implements ServiceLogic { if (r.getCode() == 200) { HashMap paramMap = new HashMap<>(); paramMap.put("battery", stopSoc.toString()); - smsService.sendNotice(tel, "【小华充电】尊敬的用户,你的车辆已充电达至设定的SOC(" - .concat(stopSoc.toString()) - .concat("%)已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。"), paramMap); + paramMap.put("phone", tel); + paramMap.put("content", "【小华充电】尊敬的用户,你的车辆已充电达至设定的SOC("+stopSoc.toString()+"%)已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。"); + smsService.sendNotice(paramMap); cacheOrder.put("socalerted", "true"); } } @@ -160,7 +160,9 @@ public class RealtimeDataLogic implements ServiceLogic { if (alerted == null && tel != null) { HashMap paramMap = new HashMap<>(); paramMap.put("money", "5"); - smsService.sendNotice(tel, "【小华充电】尊敬的用户,你的账户余额小于5元,为不影响您的正常充电,请您尽快充值交费,谢谢。", paramMap); + paramMap.put("phone", tel); + paramMap.put("content", "【小华充电】尊敬的用户,你的账户余额小于5元,为不影响您的正常充电,请您尽快充值交费,谢谢。"); + smsService.sendNotice(paramMap); cacheOrder.put("lt5alerted", "true"); } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java index 090455f2..69f3c09d 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java @@ -57,7 +57,7 @@ public class XhpcInternetUserController extends BaseController { Long[] role = new Long[1]; role[0] = 4L; sysUser.setRoleIds(role); - if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName()) > 0) { + if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName(),null) > 0) { return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在"); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorController.java index a555b603..cf958405 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcOperatorController.java @@ -87,7 +87,7 @@ public class XhpcOperatorController extends BaseController { Long[] roleIds = new Long[1]; roleIds[0] = 3L; sysUser.setRoleIds(roleIds); - if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName()) > 0) { + if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName(),null) > 0) { return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在"); } iXhpcOperatorService.insert(xhpcOperator); diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java index 7bd444c3..38a8b554 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java @@ -18,11 +18,12 @@ import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.Arrays; import java.util.List; import java.util.Map; /** - * 运营商 + * 用户管理 * * @author ruoyi */ @@ -36,6 +37,7 @@ public class XhpcUserController extends BaseController { @Autowired private IXhpcOperatorService iXhpcOperatorService; + /** * 获取平台用户分页列表 */ @@ -54,7 +56,7 @@ public class XhpcUserController extends BaseController { @RequiresRoles("admin") @PostMapping("/pc/add") public AjaxResult pcAdd(@RequestBody SysUser sysUser) { - if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName()) > 0) { + if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName(),null) > 0) { return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在"); } SysRole role = new SysRole(); @@ -64,15 +66,16 @@ public class XhpcUserController extends BaseController { iXhpcUserService.insertRole(role); sysUser.setPhonenumber(sysUser.getUserName()); sysUser.setDeptId(103L); - sysUser.setDataPowerType(StatusConstants.SON_POWER_TYPE); + sysUser.setDataPowerType(StatusConstants.ALL_POWER_TYPE); sysUser.setUserType(StatusConstants.SYSTEM_USER_TYPE); sysUser.setCreateBy(SecurityUtils.getUsername()); - sysUser.setPassword(sysUser.getUserName()); sysUser.setAvatar("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png"); + sysUser.setPassword("123456"); Long[] roles = new Long[1]; roles[0] = role.getRoleId(); sysUser.setRoleIds(roles); iXhpcUserService.insertUser(sysUser); + return AjaxResult.success(); } @@ -86,10 +89,11 @@ public class XhpcUserController extends BaseController { if (null == sysUser.getUserId()) { return AjaxResult.error(HttpStatus.NOT_NULL, "用户id不能为空"); } - if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName()) > 0) { + if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName(),sysUser.getUserId()) > 0) { return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在"); } - iXhpcUserService.insertUser(sysUser); + + iXhpcUserService.updateUser(sysUser); return AjaxResult.success(); } @@ -126,7 +130,7 @@ public class XhpcUserController extends BaseController { if (null == sysUser.getOperatorId()) { return AjaxResult.error(HttpStatus.NOT_NULL, "所属运营商不能为空"); } - if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName()) > 0) { + if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName(),null) > 0) { return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在"); } SysRole role = new SysRole(); @@ -204,4 +208,44 @@ public class XhpcUserController extends BaseController { iXhpcOperatorService.removeUser(Long.parseLong(userId)); return AjaxResult.success(); } + + + /** + * 重置密码 + */ + @PostMapping("/reset") + public AjaxResult reset(@RequestParam Long userId){ + + Long userIds = SecurityUtils.getUserId(); + SysUser sysUser = iXhpcUserService.pcInfo(userIds); + if("00".equals(sysUser.getUserType())){ + SysUser user = iXhpcUserService.pcInfo(userId); + user.setPassword("123456"); + iXhpcUserService.updateUser(user); + }else{ + return AjaxResult.error("无访问权限"); + } + + return AjaxResult.success(); + } + + + + + private void addXhpcDataDimension(Long[] menuIds,Long userId){ + if(menuIds !=null){ + //添加数据维度 + System.out.println(menuIds.toString()); + if(menuIds !=null && menuIds.length>0){ + for (int i = 0; i 99990 && "9999".equals(menuId.toString().substring(0,4))){ + continue; + } + iXhpcUserService.addXhpcDataDimension(userId,menuId); + } + } + } + } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcUserMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcUserMapper.java index 1d31faa2..1f7a0ef0 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcUserMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcUserMapper.java @@ -128,7 +128,20 @@ public interface XhpcUserMapper { * @param userName 用户名称 * @return 结果 */ - public int checkUserNameUnique(String userName); + public int checkUserNameUnique(@Param("userName")String userName,@Param("userId")Long userId); + /** + * 保存数据维度 + * @param userId + * @param chargingStationId + */ + public void addXhpcDataDimension(@Param("userId")Long userId,@Param("chargingStationId")Long chargingStationId); + + + /** + * 删除数据维度 + * @param userId + */ + public void updateXhpcDataDimension(@Param("userId")Long userId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcUserService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcUserService.java index 0d41e13d..e5328c98 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcUserService.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcUserService.java @@ -37,7 +37,7 @@ public interface IXhpcUserService { * @param userId 用户id * @return 结果 */ - public Map pcInfo(Long userId); + public SysUser pcInfo(Long userId); /** * 获取运营商用户分页列表 @@ -105,7 +105,7 @@ public interface IXhpcUserService { * @param userName 账号 * @return */ - public int checkUserNameUnique(String userName); + public int checkUserNameUnique(String userName,Long userId); /** * 修改保存用户信息 @@ -114,4 +114,18 @@ public interface IXhpcUserService { * @return 结果 */ public int updateUser(SysUser user); + + /** + * 保存数据维度 + * @param userId + * @param chargingStationId + */ + public void addXhpcDataDimension(Long userId,Long chargingStationId); + + + /** + * 删除数据维度 + * @param userId + */ + public void updateXhpcDataDimension(Long userId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java index f47d8d26..a00f39d9 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 @@ -126,6 +126,18 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { } XhpcAppUser info = xhpcAppUserMapper.getAppUserByPhone(phone); if (StringUtils.isNotNull(info)) { + //判断openid是否存在,不存在重新补充 + if (StatusConstants.OPERATION_WX_TYPE.equals(type)) { + if (StringUtils.isEmpty(info.getWeixinOpenId())) { + info.setWeixinOpenId(openid); + xhpcAppUserMapper.update(info); + } + } else { + if (StringUtils.isEmpty(info.getAlipayOpenId())) { + info.setAlipayOpenId(openid); + xhpcAppUserMapper.update(info); + } + } return R.fail(HttpStatus.ALREADY_EXISTING, "账号已存在"); } XhpcAppUser xhpcAppUser = new XhpcAppUser(); diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserServiceImpl.java index 7b664a87..d9b48025 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserServiceImpl.java @@ -58,8 +58,8 @@ public class XhpcUserServiceImpl implements IXhpcUserService { * @return 结果 */ @Override - public Map pcInfo(Long userId) { - return xhpcUserMapper.pcInfo(userId); + public SysUser pcInfo(Long userId) { + return xhpcUserMapper.selectUserByUserId(userId); } /** @@ -147,8 +147,8 @@ public class XhpcUserServiceImpl implements IXhpcUserService { * @return */ @Override - public int checkUserNameUnique(String userName) { - return xhpcUserMapper.checkUserNameUnique(userName); + public int checkUserNameUnique(String userName,Long userId) { + return xhpcUserMapper.checkUserNameUnique(userName,userId); } @@ -203,4 +203,16 @@ public class XhpcUserServiceImpl implements IXhpcUserService { public int updateUser(SysUser user) { return xhpcUserMapper.update(user); } + + @Override + public void addXhpcDataDimension(Long userId, Long chargingStationId) { + xhpcUserMapper.addXhpcDataDimension(userId,chargingStationId); + } + + @Override + public void updateXhpcDataDimension(Long userId) { + xhpcUserMapper.updateXhpcDataDimension(userId); + } + + } diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml index 9dd38418..d981d2fe 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml @@ -87,7 +87,7 @@ @@ -281,6 +281,18 @@ + + + insert into xhpc_data_dimension(user_id, charging_station_id) values(#{userId},#{chargingStationId}) + + + + update xhpc_data_dimension set del_flag = 1 where user_id = #{userId} +