Commit 0b153558 by 杨林龙

Merge remote-tracking branch 'origin/master'

2 parents b6b24709 c0de9051
package cn.com.glsx.app.modules.controller;
import cn.com.glsx.app.modules.model.param.UpdateWxUserInfoBO;
import cn.com.glsx.app.modules.service.UserService;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping(value = "/individual")
@Api(value = "我的", tags = {"我的"})
public class IndividualController {
@Autowired
private UserService userService;
@ApiOperation("更新微信资料")
@PostMapping("/updateWxUserInfo")
public R operate(@RequestBody UpdateWxUserInfoBO userInfoBO) {
userService.updateWxUserInfo(userInfoBO);
return R.ok();
}
}
package cn.com.glsx.app.modules.model.param;
import lombok.Data;
@Data
public class UpdateWxUserInfoBO {
private String nickName;
private String avatarUrl;
private String gender;
private String language;
private String province;
private String city;
private String country;
}
......@@ -32,6 +32,9 @@ public class DataShareService {
private UserService userService;
public Long shareVehicle(Long vehicleId) {
// TODO: 2022/7/20 校验车辆存在性及车辆数据权限
Long cTerminalUserId = userService.getCTerminalUserId();
UserSharedData sharedData = userSharedDataMapper.selectByCreatedByAndContentId(cTerminalUserId, vehicleId);
......
package cn.com.glsx.app.modules.service;
import cn.com.glsx.admin.common.constant.UserConstants;
import cn.com.glsx.app.common.enums.LoginType;
import cn.com.glsx.app.common.exception.AppServerException;
import cn.com.glsx.app.modules.entity.User;
import cn.com.glsx.app.modules.entity.UserThirdAuth;
import cn.com.glsx.app.modules.entity.UserWechatAccount;
import cn.com.glsx.app.modules.mapper.UserLocalAccountMapper;
import cn.com.glsx.app.modules.mapper.UserMapper;
import cn.com.glsx.app.modules.mapper.UserThirdAuthMapper;
import cn.com.glsx.app.modules.mapper.UserWechatAccountMapper;
import cn.com.glsx.app.modules.model.AppUser;
import cn.com.glsx.app.modules.model.CTerminalUserModel;
import cn.com.glsx.app.modules.model.param.UpdateWxUserInfoBO;
import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.hutool.core.lang.UUID;
import com.glsx.plat.common.utils.ObjectUtils;
......@@ -21,6 +26,7 @@ import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
......@@ -39,6 +45,9 @@ public class UserService {
private UserLocalAccountMapper userLocalAccountMapper;
@Resource
private UserThirdAuthMapper userThirdAuthMapper;
@Resource
private UserWechatAccountMapper userWechatAccountMapper;
/**
......@@ -147,4 +156,17 @@ public class UserService {
return userModelList.stream().collect(Collectors.toMap(CTerminalUserModel::getUserId, Function.identity()));
}
public void updateWxUserInfo(UpdateWxUserInfoBO userInfoBO) {
UserThirdAuth userThirdAuth = userThirdAuthMapper.selectByLoginTypeAndUserId(LoginType.WECHAT.getType(), getCTerminalUserId());
if (userThirdAuth != null) {
UserWechatAccount wechatAccount = userWechatAccountMapper.selectByAuthId(userThirdAuth.getId());
if (wechatAccount != null) {
wechatAccount.setWechatName(userInfoBO.getNickName());
wechatAccount.setAvatar(userInfoBO.getAvatarUrl());
wechatAccount.setUpdatedDate(new Date());
userWechatAccountMapper.updateByPrimaryKeySelective(wechatAccount);
}
}
}
}
......@@ -33,7 +33,7 @@
</select>
<select id="selectByUserIds" resultType="cn.com.glsx.app.modules.model.CTerminalUserModel">
select tcuar.user_id userId, tcu.rel_user_id relUserId, tcuta.openid account, tcuwa.wechat_name username, tcuwa.wechat_avatar avatar
select tcuar.user_id userId, tcu.rel_user_id relUserId, tcuta.openid account, ifnull(tcuwa.wechat_name, 'wechat_user') username, tcuwa.wechat_avatar avatar
from t_cust_user_auth_rel tcuar
inner join t_cust_user_third_auth tcuta on tcuar.auth_id = tcuta.id
left join t_cust_user tcu on tcuar.user_id = tcu.id
......
......@@ -90,8 +90,8 @@
tv.vin,
tv.owner_name as ownerName,
tw.partner_order_no workOrderNo,
group_concat(tvd.sn) as sns,
group_concat(td.source) as sources,
group_concat(distinct td.sn order by td.source desc) as sns,
group_concat(distinct td.source order by td.source desc) as sources,
tcusd.permit_type as permitType,
group_concat(tvs.receiver_id) as receiverIds
from t_vehicle tv
......@@ -137,33 +137,33 @@
<select id="selectVehicleDeviceByVehicleId" resultType="cn.com.glsx.app.modules.model.view.VehicleDeviceDTO">
select tv.id,
tv.vin,
tv.owner_name ownerName,
tw.partner_order_no workOrderNo,
group_concat(tvd.sn) as sns,
group_concat(td.source) as sources
tv.vin,
tv.owner_name ownerName,
tw.partner_order_no workOrderNo,
group_concat(tvd.sn) as sns,
group_concat(td.source) as sources
from t_vehicle tv
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id
left join t_device td on td.sn = tvd.sn
left join t_workorder tw on tw.id = tv.workorder_id
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id
left join t_device td on td.sn = tvd.sn
left join t_workorder tw on tw.id = tv.workorder_id
where tv.del_flag = 0
and tvd.del_flag = 0
and tvd.bind_status = 1
and tv.id = #{vehicleId}
and tvd.del_flag = 0
and tvd.bind_status = 1
and tv.id = #{vehicleId}
group by tv.id
order by tv.id desc
</select>
<select id="getAllTrackAlarmDataByAuth" resultType="cn.com.glsx.app.modules.model.view.TrackAlarmVO">
select tv.id as vehicleId,
tv.owner_name as ownerName,
tv.vin,
tvd.sn
select tv.id as vehicleId,
tv.owner_name as ownerName,
tv.vin,
tvd.sn
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.del_flag = 0
and tvd.bind_status = 1
and tvd.del_flag = 0
</select>
<select id="getAllDeviceSnByAuth" resultType="String">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!