提交 24e68618 作者: 刘明祎-运维用途

修改bug

流水线 #7794 已通过 于阶段
in 2 分 7 秒
package com.mmc.iuav.user.model.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author han
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TeamMessageDO{
/**
* 飞手ID
*/
private Integer pilotId;
/**
* 飞手的用户ID
*/
private Integer pilotUserId;
/**
* 飞手的团队管理员ID
*/
private Integer pilotMessageId;
}
......@@ -16,4 +16,7 @@ public class FlyingTeam{
private Integer backUserId;
@ApiModelProperty(value = "后台对应的公司名称")
private String companyName;
@ApiModelProperty(value = "对应的管理员id")
private Integer messageId;
}
......@@ -113,4 +113,10 @@ public class PilotCertificationDTO {
private String flyingTeam;
@ApiModelProperty(value = "飞手团队对应的后台id")
private Integer backUserId;
@ApiModelProperty(value = "飞手团队管理员id")
private Integer messageId;
@ApiModelProperty(value = "是否是管理员")
private int isAdmin;
}
......@@ -64,4 +64,7 @@ public class PilotCertificationQO implements Serializable {
@ApiModelProperty(value = "飞手团队的后台id")
private Integer backUserId;
@ApiModelProperty(value = "查询的飞手是否要有团队 1有团队 0 没有")
private int isTeam;
}
......@@ -93,6 +93,7 @@ public class UserAccountVO implements Serializable {
@ApiModelProperty(value = "飞手所属的飞手团队信息")
private CompanyInfoVO companyInfoVO;
@ApiModelProperty(value = "用户对应的后台用户id")
private Integer backUserId;
}
......@@ -111,4 +111,10 @@ public class WxController extends BaseController {
public ResultBody moveSubUserUnionIdToTest() {
return wxService.moveSubUserUnionIdToTest();
}
@ApiOperation(value = "同步微信公众号用户数据")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("moveSubUser")
public ResultBody moveSubUser() {
return wxService.moveSubUser();
}
}
......@@ -5,7 +5,7 @@ import com.mmc.iuav.group.Page;
import com.mmc.iuav.group.Update;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.controller.BaseController;
import com.mmc.iuav.user.entity.dronepilot.PilotCertificationDO;
import com.mmc.iuav.user.model.dto.TeamMessageDO;
import com.mmc.iuav.user.model.dto.RoleInfoDTO;
import com.mmc.iuav.user.model.dto.dronepilot.*;
import com.mmc.iuav.user.model.qo.dronepilot.*;
......@@ -13,7 +13,6 @@ import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import com.mmc.iuav.user.model.vo.PilotAuditSumVO;
import com.mmc.iuav.user.model.vo.dronepilot.PilotCertificationVO;
import com.mmc.iuav.user.service.dronepilot.PilotCertificationService;
import com.sun.xml.bind.v2.TODO;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -201,4 +200,17 @@ public class PilotCertificationController extends BaseController {
return certificationService.selectPilotIdList(this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "查询飞手的团队管理员的ID")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = Integer.class)})
@GetMapping("/selectPilotTeamManagerId")
public Integer selectPilotTeamManagerId(@RequestParam Integer pilotUserId){
return certificationService.selectPilotTeam(pilotUserId);
}
;
@ApiOperation(value = "查询飞手的手机号")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = Integer.class)})
@GetMapping("/getPilotApplyPhone")
public String getPilotApplyPhone(@RequestParam Integer userAccountId){
return certificationService.getPilotApplyPhone(userAccountId);
}
}
......@@ -22,4 +22,6 @@ public interface UserSubInfoDao {
void removeUserSubInfo(String openId);
void updateUserSubInfo(UserSubInfoDO subInfo);
String getUserOpenidByUnionId(String unionId);
}
......@@ -2,10 +2,8 @@ package com.mmc.iuav.user.dao.dronepilot;
import com.mmc.iuav.user.entity.CompanyInfoDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.dronepilot.PilotAbilityDO;
import com.mmc.iuav.user.entity.dronepilot.PilotCertificationDO;
import com.mmc.iuav.user.entity.dronepilot.PilotCertificationLogDO;
import com.mmc.iuav.user.entity.dronepilot.PilotReasonDO;
import com.mmc.iuav.user.entity.dronepilot.*;
import com.mmc.iuav.user.model.dto.TeamMessageDO;
import com.mmc.iuav.user.model.dto.dronepilot.FlyingTeam;
import com.mmc.iuav.user.model.qo.dronepilot.*;
import com.mmc.iuav.user.model.vo.dronepilot.PilotAbilityVO;
......@@ -152,9 +150,24 @@ public interface PilotCertificationDao {
/**
* 根据小程序的用户id查找对应的后台id
* @param userId
* @return {@link Integer}
*/
Integer selectBackUserIdByUserId(Integer userId);
/**
* 获取审核通过飞手的电话号码
* @param pilotId 飞手表id
* @return {@link String}
*/
String getPilotApplyPhone(Integer pilotId);
String getUserPhone(Integer userAccountId);
/**
* 通过通过飞手ID查询飞手的团队信息
*/
Integer selectPilotTeam(Integer pilotUserId);
TeamMessageDO selectPilotTeamInfo(Integer pilotUserId);
}
......@@ -117,7 +117,6 @@ public class PilotCertificationDO {
@ApiModelProperty(value = "飞手头像", example = "http://")
private String userImg;
public PilotCertificationDO(PilotCertificationVO pilotCertificationVO, Integer userAccountId) {
this.id = pilotCertificationVO.getId();
this.licenseType = pilotCertificationVO.getLicenseType();
......
......@@ -109,6 +109,8 @@ public interface WxService {
ResultBody moveSubUserUnionIdToTest();
ResultBody moveSubUser();
ResultBody getUserPortrait();
}
......@@ -2,13 +2,13 @@ package com.mmc.iuav.user.service.dronepilot;
import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.TeamMessageDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotAbilityDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationInteriorDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotReasonDTO;
import com.mmc.iuav.user.model.qo.dronepilot.*;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import com.mmc.iuav.user.model.vo.dronepilot.PilotCertificationVO;
import java.util.List;
......@@ -59,4 +59,13 @@ public interface PilotCertificationService {
ResultBody deletePilotFromTeam(Integer pilotId);
List<Integer> selectPilotIdList(Integer backUserId);
/**
* 通过通过飞手用户ID查询飞手的团队信息
*/
Integer selectPilotTeam(Integer pilotUserId);
/**
* 通过用户id查询用户的手机号
*/
String getPilotApplyPhone(Integer userAccountId);
}
......@@ -17,10 +17,12 @@ import com.mmc.iuav.user.dao.userpoints.UserPointsDao;
import com.mmc.iuav.user.dao.userpoints.UserPointsDetailsDao;
import com.mmc.iuav.user.entity.CompanyInfoDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.UserSubInfoDO;
import com.mmc.iuav.user.entity.dronepilot.*;
import com.mmc.iuav.user.entity.userpoints.UserPointsDO;
import com.mmc.iuav.user.entity.userpoints.UserPointsDetails;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.TeamMessageDO;
import com.mmc.iuav.user.model.dto.dronepilot.*;
import com.mmc.iuav.user.model.qo.dronepilot.*;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
......@@ -32,6 +34,7 @@ import com.mmc.iuav.user.model.vo.userpoints.UserPointsVO;
import com.mmc.iuav.user.service.WxService;
import com.mmc.iuav.user.service.dronepilot.PilotCertificationService;
import com.mmc.iuav.user.util.SmsUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
......@@ -154,7 +157,18 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
}
pilotList = pilotList.stream().filter(t -> t.getPilotAbility() != null).collect(Collectors.toList());
}
List<PilotCertificationDTO> collect = pilotList.stream().map(PilotCertificationDO::buildPilotCertificationDTO).collect(Collectors.toList());
List<PilotCertificationDTO> collect = pilotList.stream().map(PilotCertificationDO::buildPilotCertificationDTO).
map(pilotCertificationDTO -> {
//展示每个飞手所属团队名称
FlyingTeam flyingTeam = certificationDao.selectCompanyNameByFlyingUserId(pilotCertificationDTO .getUserAccountId());
if(flyingTeam != null){
pilotCertificationDTO.setFlyingTeam(flyingTeam.getCompanyName());
pilotCertificationDTO.setBackUserId(flyingTeam.getBackUserId());
pilotCertificationDTO.setMessageId(flyingTeam.getMessageId());
}
return pilotCertificationDTO;
})
.collect(Collectors.toList());
collect = collect.stream().skip((pageNo - 1) * param.getPageSize()).limit(param.getPageSize()).
collect(Collectors.toList());
......@@ -208,6 +222,13 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
certificationDO.setAge(getAgeByBirth(certificationDO.getBirthday()));
PilotCertificationDTO pilotCertificationDTO = certificationDO.buildPilotCertificationDTO();
//展示每个飞手所属团队名称
FlyingTeam flyingTeam = certificationDao.selectCompanyNameByFlyingUserId(pilotCertificationDTO .getUserAccountId());
if(flyingTeam != null){
pilotCertificationDTO.setFlyingTeam(flyingTeam.getCompanyName());
pilotCertificationDTO.setBackUserId(flyingTeam.getBackUserId());
}
return pilotCertificationDTO;
}
......@@ -252,12 +273,17 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
List<PilotCertificationDTO> collects = pilotList.stream().map(PilotCertificationDO::buildPilotCertificationDTO).collect(Collectors.toList());
for (PilotCertificationDTO certificationDTO:collects) {
Integer userAccountId = certificationDTO.getUserAccountId();
if (certificationDao.selectCompanyByUserId(userAccountId) < 1) {
continue;
}else {
//说明飞手是有团队的
if (certificationDao.selectCompanyByUserId(userAccountId) > 1) {
TeamMessageDO teamMessageDO = certificationDao.selectPilotTeamInfo(userAccountId);
//判断飞手是不是管理员
if (Objects.equals(teamMessageDO.getPilotMessageId(), userAccountId)){
certificationDTO.setIsAdmin(1);
}
FlyingTeam flyingTeam = certificationDao.selectCompanyNameByFlyingUserId(userAccountId);
certificationDTO.setFlyingTeam(flyingTeam.getCompanyName());
certificationDTO.setBackUserId(flyingTeam.getBackUserId());
}
}
Integer backUserId = param.getBackUserId();
......@@ -303,6 +329,7 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
param.setOperatorUserId(userLoginInfoFromRedis.getUserAccountId());
certificationDao.updateAuditStatus(param);
//审核通过
if (param.getAuditStatus() == 1) {
String pilotApplyPhone = certificationDao.getPilotApplyPhone(param.getId());
......@@ -312,13 +339,15 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
WxMsgVO ws = new WxMsgVO();
String unionId = userAccountDO.getUnionId();
// 查询对应的openId(touser)
String touser = userSubInfoDao.getUserSubInfoByUnionId(unionId).getOpenId();
String touser = userSubInfoDao.getUserOpenidByUnionId(unionId);
if(touser != null){
JSONObject jsonObject = spellMsg("飞手执照及能力认证","审核通过");
ws.setTouser(touser);
ws.setTemplateId("9qvgBhfW9yoQJY91iMfhrog8y5eZUPSbo9PLvQzS_vk");
ws.setDataObject(jsonObject);
wxService.sendSubTemplateMsg(ws);
}
}
PilotCertificationLogDO pilotCertificationLog = new PilotCertificationLogDO(userAccountDO.getId(), userLoginInfoFromRedis.getUserAccountId(), CertificationMessage.match(param.getAuditStatus()));
certificationDao.insertPilotLog(pilotCertificationLog);
......@@ -664,6 +693,16 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
return userIdList;
}
@Override
public Integer selectPilotTeam(Integer pilotUserId) {
return certificationDao.selectPilotTeam(pilotUserId);
}
@Override
public String getPilotApplyPhone(Integer userAccountId) {
return certificationDao.getUserPhone(userAccountId);
}
public JSONObject spellMsg(String name, String result){
JSONObject data=new JSONObject();
......
......@@ -149,6 +149,7 @@ public class UserAccountServiceImpl implements UserAccountService {
CompanyInfoVO companyInfoVO = companyInfoDO.buildCompanyInfoVO();
userAccountVO.setCompanyInfoVO(companyInfoVO);
}
userAccountVO.setBackUserId(certificationDao.selectBackUserIdByUserId(userAccountId));
return userAccountVO;
}
......
......@@ -255,8 +255,8 @@ public class WxServiceImpl implements WxService {
try {
accessToken = this.getSubStableAccessToken();
if (StringUtils.isBlank(ws.getTouser())) {
String unionId = userServiceDao.getUserAccountById(ws.getUserAccountId()).getUnionId();
String touser = userSubInfoDao.getUserSubInfoByUnionId(unionId).getOpenId();
String unionId = userServiceDao.getUserAccountById(ws.getUserAccountId()).getUnionId();// 查询对应的openId(touser)
String touser = userSubInfoDao.getUserOpenidByUnionId(unionId);
ws.setTouser(touser);
}
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
......@@ -389,7 +389,7 @@ public class WxServiceImpl implements WxService {
@Override
public ResultBody moveSubUserUnionIdToTest() {
String accessToken = this.getSubStableAccessToken();
String url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=" + accessToken + "&next_openid=" + "oB6kk6obNektxM62mjj9PJHPtcME";
String url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=" + accessToken;
String jsonStr = HttpsRequestUtil.httpsGet(url, null);
log.info("all users:{}", jsonStr);
JSONObject obj = JSONObject.parseObject(jsonStr);
......@@ -397,7 +397,7 @@ public class WxServiceImpl implements WxService {
int count = 0;
for (String openid : lists) {
UserSubInfoDO userSubInfo = userSubInfoDao.getUserSubInfo(openid);
if (userSubInfo != null) {
if (userSubInfo != null && userSubInfo.getUnionId() == null ) {
String InfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + accessToken + "&openid=" + openid
+ "&lang=zh_CN";
String jsonStr1 = HttpsRequestUtil.httpsGet(InfoUrl, null);
......@@ -410,7 +410,35 @@ public class WxServiceImpl implements WxService {
log.info("User count: {}", count);
return ResultBody.success();
}
@Override
public ResultBody moveSubUser() {
String accessToken = this.getSubStableAccessToken();
String url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=" + accessToken;
String jsonStr = HttpsRequestUtil.httpsGet(url, null);
log.info("all users:{}", jsonStr);
JSONObject obj = JSONObject.parseObject(jsonStr);
List<String> lists = JSONArray.parseArray(obj.getJSONObject("data").get("openid").toString(), String.class);
int count = 0;
for (String openid : lists) {
Integer integer = userSubInfoDao.countUserSubInfo(openid);
if (integer == 0) {
count++;
UserSubInfoDO sub = new UserSubInfoDO();
sub.setOpenId(openid);
sub.setRegStatus(1);
sub.setDeleted(0);
sub.setCreateTime(new Date());
String InfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + accessToken + "&openid=" + openid
+ "&lang=zh_CN";
String jsonStr1 = HttpsRequestUtil.httpsGet(InfoUrl, null);
JSONObject obj1 = JSONObject.parseObject(jsonStr1);
sub.setUnionId(obj1.getString("unionid"));
userSubInfoDao.insertUserSubInfo(sub);
}
}
log.info("User count: {}", count);
return ResultBody.success();
}
@Override
public ResultBody getUserPortrait() {
......
......@@ -251,16 +251,19 @@ public class WithdrawalServiceImpl implements WithdrawalService {
String userPhone = userServiceDao.getUserPhoneByUserId(applyInfo.getUserAccountId());
SmsUtil.sendPassWithdrawalApply(userPhone);
// // 公众号消息通知提现成功
// WxMsgVO ws = new WxMsgVO();
// String unionId = userServiceDao.getUserAccountById(applyInfo.getUserAccountId()).getUnionId();
// // 查询对应的openId(touser)
// String touser = userSubInfoDao.getUserSubInfoByUnionId(unionId).getOpenId();
// JSONObject jsonObject = spellMsg(applyInfo.getEmpName(), applyInfo.getPayAmount(), applyInfo.getPayAccount());
// ws.setTouser(touser);
// ws.setTemplateId("y6PHvZownxqR5hf4dSXaa2Lp1jeq3ccytd6G-kUQla4");
// ws.setDataObject(jsonObject);
// wxService.sendSubTemplateMsg(ws);
// 公众号消息通知提现成功
WxMsgVO ws = new WxMsgVO();
String unionId = userServiceDao.getUserAccountById(applyInfo.getUserAccountId()).getUnionId();
// 查询对应的openId(touser)
UserSubInfoDO info = userSubInfoDao.getUserSubInfoByUnionId(unionId);
if(info != null && info.getOpenId() != null){
String touser = info.getOpenId();
JSONObject jsonObject = spellMsg(applyInfo.getEmpName(), applyInfo.getPayAmount(), applyInfo.getPayAccount());
ws.setTouser(touser);
ws.setTemplateId("y6PHvZownxqR5hf4dSXaa2Lp1jeq3ccytd6G-kUQla4");
ws.setDataObject(jsonObject);
wxService.sendSubTemplateMsg(ws);
}
return ResultBody.success();
}
......
......@@ -14,7 +14,7 @@ public class SmsUtil {
public static String ALIYUN_OSS_ACCESS_KEY_ID = "LTAI5tS3GNPRZAkG9LCQBZmc";
public static String ALIYUN_OSS_ACCESS_KEY_SECRET = "ZkPrv1u2mN2DmOIc7GfPKRuy4Risqe";
public static String CLOUD_JOIN_WEBSITE = "云享飞Pro";
public static String CLOUD_JOIN_WEBSITE = "云享飞";
private static String ENDPOINT = "dysmsapi.aliyuncs.com";
/**
......
......@@ -41,6 +41,11 @@
from user_sub_info u
where u.open_id = #{openId} and is_deleted = 0
</select>
<select id="getUserOpenidByUnionId" resultType="java.lang.String">
select usi.open_id
from user_sub_info usi
where usi.union_id = #{unionId} and usi.is_deleted=0
</select>
<insert id="insertUserSubInfo" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.iuav.user.entity.UserSubInfoDO">
......
......@@ -195,7 +195,11 @@
<if test="backUserId != null">
and pjt.back_user_id = #{backUserId} and pjt.pilot_status = 1
</if>
<if test="isTeam == 1">
and pjt.back_user_id is not null and pjt.pilot_status = 1
</if>
order by pc.update_time desc, pc.create_time desc
limit #{pageNo}, #{pageSize}
</select>
<select id="getPilotAuditSum" resultType="java.lang.Integer">
......@@ -504,9 +508,13 @@
</select>
<select id="selectCompanyNameByFlyingUserId"
resultType="com.mmc.iuav.user.model.dto.dronepilot.FlyingTeam">
select company_name,back_user_id from company_info ci
select ci.company_name,
cbu.back_user_account_id as backUserId,
cm.user_account_id as messageId
from company_info ci
inner join company_back_user cbu on ci.id = cbu.company_info_id
inner join pilot_join_team pjt on cbu.back_user_account_id = pjt.back_user_id
inner join company_member cm on ci.id = cm.company_info_id
where pjt.pilot_user_id = #{userId}
</select>
<select id="selectPilotIdList" resultType="java.lang.Integer">
......@@ -524,5 +532,29 @@
select phone_num from pilot_certification pc left join user_account ua on pc.user_account_id = ua.id
where pc.id = #{pilotId}
</select>
<select id="selectPilotTeam" resultType="java.lang.Integer">
SELECT cm.user_account_id
FROM pilot_join_team p
JOIN company_back_user cb ON p.back_user_id = cb.back_user_account_id
JOIN company_member cm ON cb.company_info_id = cm.company_info_id
WHERE p.pilot_user_id = #{pilotUserId};
</select>
<select id="selectPilotTeamInfo" resultType="com.mmc.iuav.user.model.dto.TeamMessageDO">
SELECT p.pilot_user_id AS pilotUserId, cm.user_account_id AS pilotMessageId
FROM pilot_join_team p
JOIN company_back_user cb ON p.back_user_id = cb.back_user_account_id
JOIN company_member cm ON cb.company_info_id = cm.company_info_id
WHERE p.pilot_user_id = #{pilotUserId};
</select>
<select id="getUserPhone" resultType="java.lang.String">
select phone_num
from user_account
where id = #{userAccountId}
</select>
<select id="selectBackUserIdByUserId" resultType="java.lang.Integer">
select back_user_account_id from company_back_user
inner join company_member on company_member.company_info_id = company_back_user.company_info_id
where company_member.user_account_id = #{userId}
</select>
</mapper>
......@@ -18,4 +18,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms
newTag: acba4adbfd695fa1204f8c66b0ab9f477675509a
newTag: 5c727b883a2c9784cc7d6d066f5d45300c217b34
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论