修改小程序用户流水、订单
This commit is contained in:
parent
427a8cff0a
commit
db283b781d
@ -278,3 +278,6 @@ ALTER TABLE `xhpc_user_privilege`
|
||||
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||
ALTER TABLE `xhpc_vin_blacklist`
|
||||
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||
|
||||
ALTER TABLE `xhpc_user_account_statement`
|
||||
ADD COLUMN `source` INT(4) NULL DEFAULT '0' COMMENT '订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)' AFTER `tenant_id`;
|
||||
|
||||
@ -190,8 +190,16 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
||||
if (xhpcChargingPile.getSerialNumber() == null) {
|
||||
return AjaxResult.error("桩编号不能为空");
|
||||
}
|
||||
if (xhpc.getSerialNumber() != xhpc.getSerialNumber()) {
|
||||
return AjaxResult.error("桩编号不能编辑");
|
||||
if (!xhpc.getSerialNumber().equals(xhpc.getSerialNumber())) {
|
||||
//删除桩
|
||||
HashSet<String> set = new HashSet<>();
|
||||
set.add(xhpc.getSerialNumber());
|
||||
R r = powerPileService.deletePileWhitelist(xhpc.getChargingStationId(), set);
|
||||
if(r.getCode() !=200){
|
||||
//数据回滚-手动回滚
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("删除之前桩号缓存失败,请稍后在试");
|
||||
}
|
||||
}
|
||||
if (xhpcChargingPile.getGunNumber() == null || xhpcChargingPile.getGunNumber() > 26) {
|
||||
return AjaxResult.error("终端数量不能大于26");
|
||||
@ -221,6 +229,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
||||
}
|
||||
}
|
||||
xhpcChargingPileMapper.updaeXhpcChargingPile(xhpcChargingPile);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
package com.xhpc.general.controller;
|
||||
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.general.constant.AliyunTemplate;
|
||||
import com.xhpc.general.constant.AliyunTemplateKeyWord;
|
||||
import com.xhpc.general.service.IXhpcSmsService;
|
||||
@ -22,20 +25,33 @@ public class XhpcSmsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IXhpcSmsService xhpcSmsService;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
/**
|
||||
* 注册获取手机号验证码
|
||||
*/
|
||||
@GetMapping(value = "/getLogonPhoneCode")
|
||||
public AjaxResult getLogonPhoneCode(@RequestParam("phone") String phone) {
|
||||
public AjaxResult getLogonPhoneCode(@RequestParam("phone") String phone,String tenantId) {
|
||||
|
||||
String signatureName = null;
|
||||
String templateId = null;
|
||||
|
||||
signatureName = "小华充电";
|
||||
templateId = "SMS_226786362";
|
||||
|
||||
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId, null);
|
||||
if(phone !=null || "".equals(phone)){
|
||||
if(!UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||
//C端用户
|
||||
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId,null);
|
||||
}else if (UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) || UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||
R user = userTypeService.getUser(phone, null, null, null,tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
return xhpcSmsService.getLogonPhoneCode(map.get("phone").toString(), signatureName, templateId,map.get("account").toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("1003", "请输入正确的手机号或账号");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getList")
|
||||
|
||||
@ -105,10 +105,10 @@ public class XhpcChargeOrderController extends BaseController {
|
||||
* 用户历史订单列表接口
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(@RequestParam Long userId)
|
||||
public TableDataInfo list(HttpServletRequest request)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String,Object>> list = xhpcHistoryOrderService.list(userId);
|
||||
List<Map<String,Object>> list = xhpcHistoryOrderService.list(request);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -457,8 +457,17 @@ public class XhpcPileOrderController extends BaseController {
|
||||
map.put("code", 500);
|
||||
map.put("userId", xhpcChargeOrder.getUserId());
|
||||
JSONObject json = new JSONObject(map);
|
||||
//消息对了内容
|
||||
webSocketService.getMessage(userId+"",json.toString());
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
String message ="";
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.USER+userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.COMMUNIT+userId;
|
||||
}else{
|
||||
message=tenantId+UserTypeUtil.CUSTOMERS+userId;
|
||||
}
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
}
|
||||
logger.info("异常桩实时数据发送WebSocket成功>>>>>orderNo:" + orderNo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public interface XhpcHistoryOrderMapper {
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> list(@Param("userId") Long userId);
|
||||
List<Map<String, Object>> list(@Param("userId") Long userId,@Param("source") Integer source,@Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
|
||||
@ -22,7 +22,7 @@ public interface IXhpcHistoryOrderService {
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> list(Long userId);
|
||||
List<Map<String,Object>> list(HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 更新 历史订单信息
|
||||
|
||||
@ -77,9 +77,20 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> list(Long userId) {
|
||||
|
||||
return xhpcHistoryOrderMapper.list(userId);
|
||||
public List<Map<String, Object>> list(HttpServletRequest request) {
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
Long userid = loginUser.getUserid();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
Integer userType = loginUser.getUserType();
|
||||
R user = userTypeService.getUser(null, userid, userType, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
|
||||
if (userMessage == null) {
|
||||
return xhpcHistoryOrderMapper.list(userid,userType,tenantId);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -554,6 +554,12 @@
|
||||
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
||||
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
|
||||
where ho.status=0 and ho.del_flag=0 and ho.user_id =#{userId}
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and ho.tenant_id =#{tenantId}
|
||||
</if>
|
||||
<if test="source !=null">
|
||||
and ho.source =#{source}
|
||||
</if>
|
||||
order by ho.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -26,27 +27,25 @@ public class XhpcUserAccountStatementController extends BaseController {
|
||||
/**
|
||||
* 用户流水分页列表
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "用户流水分页列表")
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(@RequestParam Long appUserId) {
|
||||
public TableDataInfo page(HttpServletRequest request) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcUserAccountStatementService.page(appUserId);
|
||||
List<Map<String, Object>> list = iXhpcUserAccountStatementService.page(request);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户流水列表
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "用户流水列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(@RequestParam Long appUserId) {
|
||||
List<Map<String, Object>> list = iXhpcUserAccountStatementService.list(appUserId);
|
||||
public AjaxResult list(HttpServletRequest request) {
|
||||
List<Map<String, Object>> list = iXhpcUserAccountStatementService.list(request);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ public interface XhpcUserAccountStatementMapper {
|
||||
* @param appUserId C端用户id
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> page(@Param("appUserId") Long appUserId);
|
||||
public List<Map<String, Object>> page(@Param("appUserId") Long appUserId,@Param("source") Integer source,@Param("tenantId")String tenantId);
|
||||
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ public interface XhpcUserAccountStatementMapper {
|
||||
* @param appUserId C端用户id
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> list(@Param("appUserId") Long appUserId);
|
||||
public List<Map<String, Object>> list(@Param("appUserId") Long appUserId,@Param("source") Integer source,@Param("tenantId")String tenantId);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xhpc.payment.service;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -25,13 +26,12 @@ public interface IXhpcUserAccountStatementService {
|
||||
* @param appUserId C端用户id
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> page(Long appUserId);
|
||||
public List<Map<String, Object>> page(HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 用户流水列表
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> list(Long appUserId);
|
||||
public List<Map<String, Object>> list(HttpServletRequest request);
|
||||
}
|
||||
@ -1,15 +1,21 @@
|
||||
package com.xhpc.payment.service.impl;
|
||||
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcUserAccountStatementService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -24,6 +30,11 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
|
||||
|
||||
@Autowired
|
||||
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增 用户流水
|
||||
@ -43,8 +54,21 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> page(Long appUserId) {
|
||||
return xhpcUserAccountStatementMapper.page(appUserId);
|
||||
public List<Map<String, Object>> page(HttpServletRequest request) {
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
Long userid = loginUser.getUserid();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
Integer userType = loginUser.getUserType();
|
||||
R user = userTypeService.getUser(null, userid, userType, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
|
||||
if (userMessage == null) {
|
||||
return xhpcUserAccountStatementMapper.page(userid,userType,tenantId);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
//return xhpcUserAccountStatementMapper.page(appUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,7 +115,20 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> list(Long appUserId) {
|
||||
return xhpcUserAccountStatementMapper.list(appUserId);
|
||||
public List<Map<String, Object>> list(HttpServletRequest request) {
|
||||
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
Long userid = loginUser.getUserid();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
Integer userType = loginUser.getUserType();
|
||||
R user = userTypeService.getUser(null, userid, userType, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
|
||||
if (userMessage == null) {
|
||||
return xhpcUserAccountStatementMapper.list(userid,userType,tenantId);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,6 +132,12 @@
|
||||
<if test="appUserId != null and appUserId != ''">
|
||||
and xau.app_user_id = #{appUserId}
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
and xau.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="source!= null">
|
||||
and xau.source = #{source}
|
||||
</if>
|
||||
ORDER BY xuas.create_time DESC
|
||||
</select>
|
||||
|
||||
@ -175,6 +181,12 @@
|
||||
<if test="appUserId != null and appUserId != ''">
|
||||
and xau.app_user_id = #{appUserId}
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
and xau.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="source!= null">
|
||||
and xau.source = #{source}
|
||||
</if>
|
||||
ORDER BY xuas.create_time DESC
|
||||
</select>
|
||||
<select id="getUserHistotyChargeOrder" resultType="String">
|
||||
|
||||
@ -97,5 +97,5 @@ public interface XhpcAppUserMapper {
|
||||
* @param openid
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getUserLoginTime(@Param("type")Integer type,@Param("openid")String openid);
|
||||
Map<String, Object> getUserLoginTime(@Param("type")Integer type,@Param("openid")String openid,@Param("tenantId")String tenantId);
|
||||
}
|
||||
|
||||
@ -161,6 +161,8 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
xhpcAppUserMapper.update(info);
|
||||
}
|
||||
}
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(info.getAppUserId(),info.getPhone(),UserTypeUtil.USER_TYPE,openid,Integer.valueOf(type),null,tenantId);
|
||||
return R.fail(HttpStatus.ALREADY_EXISTING, "账号已存在");
|
||||
}
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
@ -391,7 +393,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
String type = StringUtils.valueOf(map.get("type"));
|
||||
String openid = StringUtils.valueOf(map.get("openid"));
|
||||
String tenantId = StringUtils.valueOf(map.get("tenantId"));
|
||||
Map<String, Object> userLoginTime = xhpcAppUserMapper.getUserLoginTime(Integer.valueOf(type), openid);
|
||||
Map<String, Object> userLoginTime = xhpcAppUserMapper.getUserLoginTime(Integer.valueOf(type), openid,tenantId);
|
||||
if(userLoginTime ==null){
|
||||
return R.fail(HttpStatus.USER_LOGIN, "请重新登录");
|
||||
}
|
||||
|
||||
@ -318,5 +318,9 @@
|
||||
from xhpc_user_login
|
||||
where type = #{type}
|
||||
and open_id = #{openid}
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and tenant_id=#{tenantId}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user