提交 66149061 作者: 余乾开

Merge branch 'develop'

...@@ -77,8 +77,9 @@ jobs: ...@@ -77,8 +77,9 @@ jobs:
git config user.name "Chuck" git config user.name "Chuck"
git config user.email "Chuck@users.noreply.github.com" git config user.email "Chuck@users.noreply.github.com"
git remote set-url origin "$GITLAB_URL" git remote set-url origin "$GITLAB_URL"
git commit -am "generated Image update" git commit -am "Update Image Tag"
git push origin develop git tag -a $TAG -m "日常迭代"
git push origin develop --tags
- name: Send Error Notification by WeChat - name: Send Error Notification by WeChat
if: ${{ failure() }} if: ${{ failure() }}
......
...@@ -78,8 +78,9 @@ jobs: ...@@ -78,8 +78,9 @@ jobs:
git config user.name "Chuck" git config user.name "Chuck"
git config user.email "Chuck@users.noreply.github.com" git config user.email "Chuck@users.noreply.github.com"
git remote set-url origin "$GITLAB_URL" git remote set-url origin "$GITLAB_URL"
git commit -am "generated Image update" git commit -am "Update Image Tag"
git push origin master git tag -a $TAG -m "日常迭代"
git push origin master --tags
- name: Send Error Notification by WeChat - name: Send Error Notification by WeChat
if: ${{ failure() }} if: ${{ failure() }}
......
package com.mmc.iuav.user.model.dto; package com.mmc.iuav.user.model.dto;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -26,5 +27,7 @@ public class LoginSuccessDTO implements Serializable { ...@@ -26,5 +27,7 @@ public class LoginSuccessDTO implements Serializable {
private String phoneNum; private String phoneNum;
private String userName; private String userName;
private String nickName; private String nickName;
private CompanyInfoVO companyInfoVO;
// private RoleInfoDTO roleInfo; // private RoleInfoDTO roleInfo;
} }
package com.mmc.iuav.user.model.qo;
import com.mmc.iuav.group.Insert;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Page;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author: zj
* @Date: 2023/7/3 16:28
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInfoQO implements Serializable {
private static final long serialVersionUID = -6148830939232702460L;
@ApiModelProperty(value = "单位id", hidden = true)
private Integer companyInfoId;
@ApiModelProperty(value = "单位名称", example = "科比特")
private String companyName;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
...@@ -66,7 +66,8 @@ public class BUserAccountVO implements Serializable { ...@@ -66,7 +66,8 @@ public class BUserAccountVO implements Serializable {
@Email @Email
private String email; private String email;
@ApiModelProperty(value = "所属公司ID",example = "1", hidden = true) @ApiModelProperty(value = "所属公司ID",example = "0")
@NotNull(message = "所属公司不能为空", groups = {Create.class})
private Integer companyId; private Integer companyId;
@ApiModelProperty(value = "账号类型:0合伙人 1员工", example = "1", hidden = true) @ApiModelProperty(value = "账号类型:0合伙人 1员工", example = "1", hidden = true)
......
...@@ -55,4 +55,6 @@ public class BackUserAccountVO implements Serializable { ...@@ -55,4 +55,6 @@ public class BackUserAccountVO implements Serializable {
private String tagName; private String tagName;
@ApiModelProperty(value = "地址") @ApiModelProperty(value = "地址")
private String address; private String address;
@ApiModelProperty(value = "单位信息")
private CompanyInfoVO companyInfoVO;
} }
...@@ -23,7 +23,7 @@ import java.io.Serializable; ...@@ -23,7 +23,7 @@ import java.io.Serializable;
public class CompanyAuthVO implements Serializable { public class CompanyAuthVO implements Serializable {
private static final long serialVersionUID = 3584743219477515646L; private static final long serialVersionUID = 3584743219477515646L;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
@NotNull(message = "id创建修改不能为空", groups = { Update.class }) @NotNull(message = "id不能为空", groups = { Update.class })
private Integer id; private Integer id;
@ApiModelProperty(value = "用户id", hidden = true) @ApiModelProperty(value = "用户id", hidden = true)
//@NotNull(message = "用户id不能为空", groups = { Insert.class, Update.class}) //@NotNull(message = "用户id不能为空", groups = { Insert.class, Update.class})
......
package com.mmc.iuav.user.model.vo;
import com.mmc.iuav.group.Insert;
import com.mmc.iuav.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author: zj
* @Date: 2023/7/3 16:04
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInfoVO implements Serializable {
private static final long serialVersionUID = 3247519744829926132L;
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = { Update.class })
private Integer id;
@ApiModelProperty(value = "单位类型,0科比特,1加盟公司", example = "0")
@NotNull(message = "单位类型不能为空", groups = { Insert.class })
private Integer companyType;
@ApiModelProperty(value = "单位名称", example = "科比特")
@NotNull(message = "单位名称不能为空", groups = { Insert.class })
private String companyName;
@ApiModelProperty(value = "单位全称", example = "浙江科比特创新科技有限公司")
private String fullName;
@ApiModelProperty(value = "省份名称", example = "广东省")
@NotNull(message = "省份名称不能为空", groups = { Insert.class })
private String province;
@ApiModelProperty(value = "城市名称", example = "深圳市")
@NotNull(message = "城市名称不能为空", groups = { Insert.class })
private String city;
@ApiModelProperty(value = "县区名称", example = "南山区")
@NotNull(message = "县区名称不能为空", groups = { Insert.class })
private String district;
@ApiModelProperty(value = "详细地址", example = "西丽街道万科云城国际创新谷6栋")
@NotNull(message = "详细地址不能为空", groups = { Insert.class })
private String address;
@ApiModelProperty(value = "联系人", example = "lx")
private String companyUserName;
@ApiModelProperty(value = "联系电话", example = "13925255742")
private String phoneNum;
@ApiModelProperty(value = "备注")
private String remark;
}
...@@ -19,6 +19,9 @@ public enum ResultEnum implements BaseErrorInfoInterface{ ...@@ -19,6 +19,9 @@ public enum ResultEnum implements BaseErrorInfoInterface{
LOGIN_ACCOUNT_NOT_EXIT_ERROR("5005", "账号不存在"), LOGIN_ACCOUNT_NOT_EXIT_ERROR("5005", "账号不存在"),
LOGIN_PASSWORD_ERROR("5006", "密码错误"), LOGIN_PASSWORD_ERROR("5006", "密码错误"),
LOGIN_ACCOUNT_STATUS_ERROR("5008", "未登录"), LOGIN_ACCOUNT_STATUS_ERROR("5008", "未登录"),
REMOVE_COMPANY_BINDING_ERROR("5009", "删除失败,该单位有绑定账号"),
REMOVE_COMPANY_TASK_ERROR("5010", "删除失败,该单位有绑定服务"),
COMPANY_NAME_EXIST_ERROR("5011", "单位名称已存在"),
//微信相关 //微信相关
PASSWORD_INCONSISTENT("5026", "新密码与确认密码不一致,请确认一致"), PASSWORD_INCONSISTENT("5026", "新密码与确认密码不一致,请确认一致"),
......
package com.mmc.iuav.user.client;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
/**
* @author: zj
* @Date: 2023/7/4 13:46
*/
@Component
public class PmsClient {
@Value("${iuav.pms.uri}")
private String pmsAppUri;
@Autowired
private RestTemplate restTemplate;
public Integer countCompanyTasks(Integer id, String token) {
HttpHeaders headers = new HttpHeaders();
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(null, headers);
ResponseEntity<ResultBody> responseEntity = restTemplate.exchange(pmsAppUri+"/pms/backstage/work/queryWorkServiceCount" + "?companyId=" + id, HttpMethod.GET, entity, ResultBody.class);
ResultBody body = responseEntity.getBody();
if (body.getCode().equals(ResultEnum.SUCCESS.getResultCode())){
Integer count = (Integer) body.getResult();
return count;
}
return null;
}
}
...@@ -18,6 +18,7 @@ public class WxConstant { ...@@ -18,6 +18,7 @@ public class WxConstant {
public final static String subscribe = "subscribe"; public final static String subscribe = "subscribe";
public final static String unsubscribe = "unsubscribe"; public final static String unsubscribe = "unsubscribe";
public static final String IUAV_MINI_PROGRAM_ACCESS_TOKEN = "IUAV_MINI_PROGRAM_ACCESS_TOKEN"; public static final String IUAV_MINI_PROGRAM_ACCESS_TOKEN = "IUAV_MINI_PROGRAM_ACCESS_TOKEN";
public static final String IUAV_MINI_PROGRAM_STABLE_ACCESS_TOKEN = "IUAV_MINI_PROGRAM_STABLE_ACCESS_TOKEN";
public static final String SHARE_FLY_SUB_ACCESS_TOKEN = "SHARE_FLY_SUB_ACCESS_TOKEN"; public static final String SHARE_FLY_SUB_ACCESS_TOKEN = "SHARE_FLY_SUB_ACCESS_TOKEN";
......
package com.mmc.iuav.user.controller;
import com.mmc.iuav.group.Insert;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.qo.CompanyInfoQO;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import com.mmc.iuav.user.service.CompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author: zj
* @Date: 2023/7/3 15:35
*/
@Api(tags = "单位管理")
@RequestMapping("/company/")
@RestController
public class CompanyController extends BaseController{
@Autowired
private CompanyService companyService;
@ApiOperation(value = "新增")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("add")
public ResultBody add(@Validated(Insert.class) @RequestBody CompanyInfoVO companyInfo){
return companyService.addCompanyInfo(companyInfo);
}
@ApiOperation(value = "移除")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@GetMapping("remove")
public ResultBody remove(@RequestParam Integer id, @RequestHeader String token){
return companyService.removeCompanyInfo(id, token);
}
@ApiOperation(value = "修改")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("update")
public ResultBody update(@RequestBody CompanyInfoVO companyInfo){
return companyService.updateCompanyInfo(companyInfo);
}
@ApiOperation(value = "单位查询")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CompanyInfoVO.class) })
@GetMapping("getCompanyInfoById")
public ResultBody<CompanyInfoVO> getCompanyInfoById(@RequestParam Integer id){
return companyService.getCompanyInfoById(id);
}
@ApiOperation(value = "单位列表")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CompanyInfoVO.class) })
@PostMapping("listCompanyPage")
public ResultBody<CompanyInfoVO> listCompanyPage(@RequestBody CompanyInfoQO companyInfoQO, HttpServletRequest request){
return companyService.listCompanyPage(companyInfoQO, this.getUserLoginInfoFromRedis(request));
}
@ApiIgnore
@ApiOperation(value = "单位列表-后台使用")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CompanyInfoVO.class) })
@PostMapping("listCompanyPageBack")
public List<CompanyInfoVO> listCompanyPageBack(@RequestBody CompanyInfoQO companyInfoQO){
return companyService.listCompanyPageBack(companyInfoQO);
}
}
package com.mmc.iuav.user.dao;
import com.mmc.iuav.user.entity.CompanyBackUserDO;
import com.mmc.iuav.user.entity.CompanyInfoDO;
import com.mmc.iuav.user.model.qo.CompanyInfoQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author: zj
* @Date: 2023/7/3 15:39
*/
@Mapper
public interface CompanyDao {
/**
* 添加单位
* @param companyInfoDO
*/
void addCompanyInfo(CompanyInfoDO companyInfoDO);
/**
* 移除单位
* @param id
*/
void removeCompanyInfo(Integer id);
/**
* 修改单位
* @param companyInfoDO
*/
void updateCompanyInfo(CompanyInfoDO companyInfoDO);
/**
* 单位查询
* @param id
* @return
*/
CompanyInfoDO getCompanyInfoById(Integer id);
/**
* 单位数量查询
* @param param
* @return
*/
int countListCompanyPage(CompanyInfoQO param);
/**
* 单位列表
* @param param
* @return
*/
List<CompanyInfoDO> listCompanyPage(CompanyInfoQO param);
/**
* 通过用户ID获取单位信息
* @param backUserAccountId
* @return
*/
CompanyInfoDO getCompanyInfoByBackUserAccountId(Integer backUserAccountId);
/**
* 添加绑定关系
* @param companyBackUserDO
*/
void addCompanyBackUser(CompanyBackUserDO companyBackUserDO);
/**
* 修改绑定关系
* @param companyBackUserDO
*/
void updateCompanyBackUser(CompanyBackUserDO companyBackUserDO);
/**
* 查询单位绑定的账号数量
* @param id
* @return
*/
int countCompanyBackUser(Integer id);
/**
* 通过用户id获取单位信息
* @param backUserIds
* @return
*/
List<CompanyInfoDO> listCompanyInfoByUID(@Param("backUserIds") List<Integer> backUserIds);
/**
* 查询同名单位个数
* @param id
* @param companyName
* @return
*/
int countCompanyNames(Integer id, String companyName);
}
package com.mmc.iuav.user.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author: zj
* @Date: 2023/7/3 15:57
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CompanyBackUserDO implements Serializable {
private static final long serialVersionUID = -4532624718082935780L;
private Integer id;
private Integer backUserAccountId;
private Integer companyInfoId;
}
package com.mmc.iuav.user.entity;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author: zj
* @Date: 2023/7/3 15:56
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CompanyInfoDO implements Serializable {
private static final long serialVersionUID = -533935402556556571L;
private Integer id;
private Integer companyType;
private String companyName;
private String fullName;
private String province;
private String city;
private String district;
private String address;
private String companyUserName;
private String phoneNum;
private String remark;
private Integer backUserAccountId;
public CompanyInfoVO buildCompanyInfoVO() {
return CompanyInfoVO.builder().id(id).companyType(companyType).companyName(companyName).fullName(fullName).province(province)
.city(city).district(district).address(address).companyUserName(companyUserName).phoneNum(phoneNum).remark(remark).build();
}
public CompanyInfoDO(CompanyInfoVO companyInfo) {
this.id = companyInfo.getId();
this.companyType = companyInfo.getCompanyType();
this.companyName = companyInfo.getCompanyName();
this.fullName = companyInfo.getFullName();
this.province = companyInfo.getProvince();
this.city = companyInfo.getCity();
this.district = companyInfo.getDistrict();
this.address = companyInfo.getAddress();
this.companyUserName = companyInfo.getCompanyUserName();
this.phoneNum = companyInfo.getPhoneNum();
this.remark = companyInfo.getRemark();
}
}
package com.mmc.iuav.user.service;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.entity.CompanyBackUserDO;
import com.mmc.iuav.user.entity.CompanyInfoDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.qo.CompanyInfoQO;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import java.util.List;
/**
* @author: zj
* @Date: 2023/7/3 15:39
*/
public interface CompanyService {
/**
* 新增
* @param companyInfo
* @return
*/
ResultBody addCompanyInfo(CompanyInfoVO companyInfo);
/**
* 移除
* @param id
* @param token
* @return
*/
ResultBody removeCompanyInfo(Integer id, String token);
/**
* 修改
* @param companyInfo
* @return
*/
ResultBody updateCompanyInfo(CompanyInfoVO companyInfo);
/**
* 单位查询
* @param id
* @return
*/
ResultBody getCompanyInfoById(Integer id);
/**
* 单位列表
* @param companyInfoQO
* @param userLoginInfoFromRedis
* @return
*/
ResultBody<CompanyInfoVO> listCompanyPage(CompanyInfoQO companyInfoQO, LoginSuccessDTO userLoginInfoFromRedis);
/**
* 通过用户id获取单位信息
* @param backUserAccountId
* @return
*/
CompanyInfoVO getCompanyInfoByBackUserAccountId(Integer backUserAccountId);
/**
* 添加绑定关系
* @param companyBackUserDO
*/
void addCompanyBackUser(CompanyBackUserDO companyBackUserDO);
/**
* 修改绑定关系
* @param companyBackUserDO
*/
void updateCompanyBackUser(CompanyBackUserDO companyBackUserDO);
List<CompanyInfoVO> listCompanyPageBack(CompanyInfoQO companyInfoQO);
/**
* 通过用户id获取单位信息
* @param backUserIds
* @return
*/
List<CompanyInfoDO> listCompanyInfoByUID(List<Integer> backUserIds);
}
...@@ -33,6 +33,12 @@ public interface WxService { ...@@ -33,6 +33,12 @@ public interface WxService {
String getAccessToken(); String getAccessToken();
/** /**
* 获取稳定AccessToken
* @return
*/
String getStableAccessToken() throws Exception;
/**
* 获取公众号AccessToken * 获取公众号AccessToken
* @return * @return
*/ */
......
...@@ -5,7 +5,6 @@ import com.alibaba.fastjson2.JSONObject; ...@@ -5,7 +5,6 @@ import com.alibaba.fastjson2.JSONObject;
import com.mmc.iuav.auth.JwtConstant; import com.mmc.iuav.auth.JwtConstant;
import com.mmc.iuav.auth.JwtUtil; import com.mmc.iuav.auth.JwtUtil;
import com.mmc.iuav.general.CodeUtil; import com.mmc.iuav.general.CodeUtil;
import com.mmc.iuav.http.BizException;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum; import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.auth.PwdUtil; import com.mmc.iuav.user.auth.PwdUtil;
...@@ -19,12 +18,10 @@ import com.mmc.iuav.user.enums.UserAccountStatus; ...@@ -19,12 +18,10 @@ import com.mmc.iuav.user.enums.UserAccountStatus;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO; import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.qo.LoginUserQO; import com.mmc.iuav.user.model.qo.LoginUserQO;
import com.mmc.iuav.user.model.vo.AppUserSucVO; import com.mmc.iuav.user.model.vo.AppUserSucVO;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import com.mmc.iuav.user.model.vo.UserAccountVO; import com.mmc.iuav.user.model.vo.UserAccountVO;
import com.mmc.iuav.user.model.vo.WxLoginVO; import com.mmc.iuav.user.model.vo.WxLoginVO;
import com.mmc.iuav.user.service.AuthService; import com.mmc.iuav.user.service.*;
import com.mmc.iuav.user.service.BackUserAccountService;
import com.mmc.iuav.user.service.UserAccountService;
import com.mmc.iuav.user.service.WxService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -61,6 +58,9 @@ public class AuthServiceImpl implements AuthService { ...@@ -61,6 +58,9 @@ public class AuthServiceImpl implements AuthService {
private CompanyAuthDao companyAuthDao; private CompanyAuthDao companyAuthDao;
@Autowired @Autowired
private CompanyService companyService;
@Autowired
private PayClient payClient; private PayClient payClient;
@Transactional @Transactional
...@@ -84,21 +84,6 @@ public class AuthServiceImpl implements AuthService { ...@@ -84,21 +84,6 @@ public class AuthServiceImpl implements AuthService {
unionId = json.getString(WxConstant.UNION_ID); unionId = json.getString(WxConstant.UNION_ID);
openId = json.getString(WxConstant.OPEN_ID); openId = json.getString(WxConstant.OPEN_ID);
sessionKey = json.getString(WxConstant.SESSION_KEY); sessionKey = json.getString(WxConstant.SESSION_KEY);
}else if (wxLoginVO.getFromPort().equals(WxConstant.WEB)){
//获取access_token接口,里面包含unionId
String pcWxJson = wxService.pcLogin(wxLoginVO);
if (StringUtils.isBlank(pcWxJson)) {
return ResultBody.error(ResultEnum.APPLET_PORT_TYPE_ERROR);
}
log.info("wx pcLogin msg==>" + JSONObject.toJSONString(pcWxJson));
JSONObject json = JSON.parseObject(pcWxJson);
if (!json.containsKey(WxConstant.OPEN_ID) ||!json.containsKey(WxConstant.SESSION_KEY)) {
log.error("wx pcLogin error==>" + JSONObject.toJSONString(json));
return ResultBody.error(ResultEnum.APPLET_LOGIN_ERROR, json);
}
unionId = json.getString(WxConstant.UNION_ID);
openId = json.getString(WxConstant.OPEN_ID);
sessionKey = json.getString(WxConstant.SESSION_KEY);
}else { }else {
return ResultBody.error(ResultEnum.PARAM_ERROR); return ResultBody.error(ResultEnum.PARAM_ERROR);
} }
...@@ -160,14 +145,14 @@ public class AuthServiceImpl implements AuthService { ...@@ -160,14 +145,14 @@ public class AuthServiceImpl implements AuthService {
if (!loginPwd.equals(user.getPassword())) { if (!loginPwd.equals(user.getPassword())) {
return ResultBody.error(ResultEnum.LOGIN_PASSWORD_ERROR); return ResultBody.error(ResultEnum.LOGIN_PASSWORD_ERROR);
} }
// 查询单位信息
CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(user.getId());
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put(JwtConstant.USER_ACCOUNT_ID, user.getId()); map.put(JwtConstant.USER_ACCOUNT_ID, user.getId());
//map.put(JwtConstant.ROLE_ID, 0);
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.M_TOKEN); map.put(JwtConstant.TOKEN_TYPE, JwtConstant.M_TOKEN);
String token = JwtUtil.createJwt(map); String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(user.getId()).accountNo(user.getAccountNo()).uid(user.getId() +"") LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(user.getId()).accountNo(user.getAccountNo()).uid(user.getId() +"")
.userName(user.getUserName()).nickName(user.getUserName()).phoneNum(user.getPhoneNum()).portType(0).build(); .userName(user.getUserName()).nickName(user.getUserName()).phoneNum(user.getPhoneNum()).portType(0).companyInfoVO(companyInfoVO == null ? null : companyInfoVO).build();
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO), token, JSONObject.toJSONString(loginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS); JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
......
package com.mmc.iuav.user.service.impl; package com.mmc.iuav.user.service.impl;
import com.mmc.iuav.general.CodeUtil;
import com.mmc.iuav.page.PageResult; import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum; import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.auth.PwdUtil; import com.mmc.iuav.user.auth.PwdUtil;
import com.mmc.iuav.user.dao.BackUserAccountDao; import com.mmc.iuav.user.dao.BackUserAccountDao;
import com.mmc.iuav.user.entity.BackUserAccountDO; import com.mmc.iuav.user.entity.BackUserAccountDO;
import com.mmc.iuav.user.entity.CompanyBackUserDO;
import com.mmc.iuav.user.entity.CompanyInfoDO;
import com.mmc.iuav.user.model.qo.BUserAccountQO; import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.vo.BUserAccountVO; import com.mmc.iuav.user.model.vo.BUserAccountVO;
import com.mmc.iuav.user.model.vo.BackUserAccountVO; import com.mmc.iuav.user.model.vo.BackUserAccountVO;
import com.mmc.iuav.user.service.BackUserAccountService; import com.mmc.iuav.user.service.BackUserAccountService;
import com.mmc.iuav.user.service.CompanyService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -28,6 +31,9 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -28,6 +31,9 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
@Autowired @Autowired
private BackUserAccountDao backUserAccountDao; private BackUserAccountDao backUserAccountDao;
@Autowired
private CompanyService companyService;
@Override @Override
public ResultBody insertBAccount(BUserAccountVO bUserAccountVO) { public ResultBody insertBAccount(BUserAccountVO bUserAccountVO) {
if (!bUserAccountVO.getPassWord().equals(bUserAccountVO.getAlertPwd())) { if (!bUserAccountVO.getPassWord().equals(bUserAccountVO.getAlertPwd())) {
...@@ -46,6 +52,13 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -46,6 +52,13 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
return ResultBody.error(ResultEnum.PWD_CREATE_ERROR); return ResultBody.error(ResultEnum.PWD_CREATE_ERROR);
} }
backUserAccountDao.insertBackUserAccount(backUserAccountDO); backUserAccountDao.insertBackUserAccount(backUserAccountDO);
// 添加单位信息
if (bUserAccountVO.getCompanyId() != null){
CompanyBackUserDO companyBackUserDO = new CompanyBackUserDO();
companyBackUserDO.setBackUserAccountId(backUserAccountDO.getId());
companyBackUserDO.setCompanyInfoId(bUserAccountVO.getCompanyId());
companyService.addCompanyBackUser(companyBackUserDO);
}
return ResultBody.success(); return ResultBody.success();
} }
...@@ -61,6 +74,13 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -61,6 +74,13 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
} }
BackUserAccountDO userAccountDO = new BackUserAccountDO(bUserAccountVO); BackUserAccountDO userAccountDO = new BackUserAccountDO(bUserAccountVO);
backUserAccountDao.updateBackUserAccount(userAccountDO); backUserAccountDao.updateBackUserAccount(userAccountDO);
// 修改单位信息
if (bUserAccountVO.getCompanyId() != null){
CompanyBackUserDO companyBackUserDO = new CompanyBackUserDO();
companyBackUserDO.setBackUserAccountId(userAccountDO.getId());
companyBackUserDO.setCompanyInfoId(bUserAccountVO.getCompanyId());
companyService.updateCompanyBackUser(companyBackUserDO);
}
return ResultBody.success(); return ResultBody.success();
} }
...@@ -79,7 +99,19 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -79,7 +99,19 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
Integer pageNo = param.getPageNo(); Integer pageNo = param.getPageNo();
param.buildCurrentPage(); param.buildCurrentPage();
List<BackUserAccountDO> users = backUserAccountDao.listBackUserAccount(param); List<BackUserAccountDO> users = backUserAccountDao.listBackUserAccount(param);
List<Integer> backUserIds = users.stream().map(BackUserAccountDO::getId).collect(Collectors.toList());
List<BackUserAccountVO> collect = users.stream().map(BackUserAccountDO::buildBackUserAccountVO).collect(Collectors.toList()); List<BackUserAccountVO> collect = users.stream().map(BackUserAccountDO::buildBackUserAccountVO).collect(Collectors.toList());
List<CompanyInfoDO> companyInfoDOList = companyService.listCompanyInfoByUID(backUserIds);
if (!companyInfoDOList.isEmpty()){
Map<Integer, CompanyInfoDO> userCompanyNameMap = companyInfoDOList.stream().collect(Collectors.toMap(CompanyInfoDO::getBackUserAccountId, k -> k, (v1, v2) -> v2));
collect.forEach(d -> {
CompanyInfoDO companyInfoDO = userCompanyNameMap.get(d.getId());
if (companyInfoDO != null){
d.setCompanyName(companyInfoDO.getCompanyName());
d.setCompanyInfoVO(companyInfoDO.buildCompanyInfoVO());
}
});
}
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, collect)); return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, collect));
} }
......
package com.mmc.iuav.user.service.impl;
import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.client.PmsClient;
import com.mmc.iuav.user.dao.CompanyDao;
import com.mmc.iuav.user.entity.CompanyBackUserDO;
import com.mmc.iuav.user.entity.CompanyInfoDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.qo.CompanyInfoQO;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import com.mmc.iuav.user.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author: zj
* @Date: 2023/7/3 15:39
*/
@Service
public class CompanyServiceImpl implements CompanyService {
@Autowired
private CompanyDao companyDao;
@Autowired
private PmsClient pmsClient;
@Override
public ResultBody addCompanyInfo(CompanyInfoVO companyInfo) {
int count = companyDao.countCompanyNames(companyInfo.getId(), companyInfo.getCompanyName());
if (count > 0) {
return ResultBody.error(ResultEnum.COMPANY_NAME_EXIST_ERROR);
}
CompanyInfoDO companyInfoDO = new CompanyInfoDO(companyInfo);
companyDao.addCompanyInfo(companyInfoDO);
return ResultBody.success();
}
@Override
public ResultBody removeCompanyInfo(Integer id, String token) {
// 查询绑定账号数量是否大于0
int backAccountCount = companyDao.countCompanyBackUser(id);
if (backAccountCount > 0){
return ResultBody.error(ResultEnum.REMOVE_COMPANY_BINDING_ERROR);
}
// 查询绑定服务数量是否大于0
Integer taskCount = pmsClient.countCompanyTasks(id, token);
if ( taskCount == null || taskCount > 0){
return ResultBody.error(ResultEnum.REMOVE_COMPANY_TASK_ERROR);
}
companyDao.removeCompanyInfo(id);
return ResultBody.success();
}
@Override
public ResultBody updateCompanyInfo(CompanyInfoVO companyInfo) {
int count = companyDao.countCompanyNames(companyInfo.getId(), companyInfo.getCompanyName());
if (count > 0) {
return ResultBody.error(ResultEnum.COMPANY_NAME_EXIST_ERROR);
}
CompanyInfoDO companyInfoDO = new CompanyInfoDO(companyInfo);
companyDao.updateCompanyInfo(companyInfoDO);
return ResultBody.success();
}
@Override
public ResultBody getCompanyInfoById(Integer id) {
CompanyInfoDO companyInfoDO = companyDao.getCompanyInfoById(id);
if (companyInfoDO != null){
return ResultBody.success(companyInfoDO.buildCompanyInfoVO());
}
return ResultBody.success();
}
@Override
public ResultBody<CompanyInfoVO> listCompanyPage(CompanyInfoQO param, LoginSuccessDTO loginSuccessDTO) {
CompanyInfoDO companyInfoDO = companyDao.getCompanyInfoByBackUserAccountId(loginSuccessDTO.getUserAccountId());
if (companyInfoDO != null && !companyInfoDO.getCompanyType().equals(0)){
param.setCompanyInfoId(companyInfoDO.getId());
}
int count = companyDao.countListCompanyPage(param);
if (count == 0){
return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<CompanyInfoDO> companyInfoDOS = companyDao.listCompanyPage(param);
List<CompanyInfoVO> companyInfoVOList = companyInfoDOS.stream().map(CompanyInfoDO::buildCompanyInfoVO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, companyInfoVOList));
}
@Override
public CompanyInfoVO getCompanyInfoByBackUserAccountId(Integer backUserAccountId) {
CompanyInfoDO companyInfoDO = companyDao.getCompanyInfoByBackUserAccountId(backUserAccountId);
if (companyInfoDO != null) {
return companyInfoDO.buildCompanyInfoVO();
}
return null;
}
@Override
public void addCompanyBackUser(CompanyBackUserDO companyBackUserDO) {
companyDao.addCompanyBackUser(companyBackUserDO);
}
@Override
public void updateCompanyBackUser(CompanyBackUserDO companyBackUserDO) {
companyDao.updateCompanyBackUser(companyBackUserDO);
}
@Override
public List<CompanyInfoVO> listCompanyPageBack(CompanyInfoQO param) {
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<CompanyInfoDO> companyInfoDOS = companyDao.listCompanyPage(param);
List<CompanyInfoVO> companyInfoVOList = companyInfoDOS.stream().map(CompanyInfoDO::buildCompanyInfoVO).collect(Collectors.toList());
return companyInfoVOList;
}
@Override
public List<CompanyInfoDO> listCompanyInfoByUID(List<Integer> backUserIds) {
List<CompanyInfoDO> companyInfoDOList = companyDao.listCompanyInfoByUID(backUserIds);
return companyInfoDOList;
}
}
...@@ -10,7 +10,6 @@ import com.mmc.iuav.user.dao.UserServiceDao; ...@@ -10,7 +10,6 @@ import com.mmc.iuav.user.dao.UserServiceDao;
import com.mmc.iuav.user.entity.CooperationTagDO; import com.mmc.iuav.user.entity.CooperationTagDO;
import com.mmc.iuav.user.entity.UserAccountDO; import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.UserRcdDO; import com.mmc.iuav.user.entity.UserRcdDO;
import com.mmc.iuav.user.entity.UserTagDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO; import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO; import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.UserAccountQO; import com.mmc.iuav.user.model.qo.UserAccountQO;
...@@ -25,7 +24,6 @@ import org.springframework.stereotype.Service; ...@@ -25,7 +24,6 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
......
...@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -82,6 +83,35 @@ public class WxServiceImpl implements WxService { ...@@ -82,6 +83,35 @@ public class WxServiceImpl implements WxService {
} }
@Override @Override
public String getStableAccessToken() {
//token有效期为7200s,需要保存起来,先从redis中获取accessToken,没有则请求获取
String accessToken = stringRedisTemplate.opsForValue().get(WxConstant.IUAV_MINI_PROGRAM_STABLE_ACCESS_TOKEN);
if (StringUtils.isBlank(accessToken)){
Map<String, String> params = new HashMap<String, String>();
params.put("grant_type", "client_credential");
params.put("appid", userSystemConstant.getWxAppId());
params.put("secret", userSystemConstant.getWxAppSecret());
String stableAccessTokenUrl = "https://api.weixin.qq.com/cgi-bin/stable_token";
String res = null;
try {
res = HttpsRequestUtil.httpsRequest(stableAccessTokenUrl, "POST", null, JSONObject.toJSONString(params));
} catch (Exception e) {
e.printStackTrace();
}
JSONObject tokenResult = JSONObject.parseObject(res);
if (res.indexOf("access_token") == -1) {
return null;
}
accessToken = tokenResult.getString("access_token");
long expiresIn = tokenResult.getLong("expires_in");
//保存进redis
stringRedisTemplate.opsForValue().set(WxConstant.IUAV_MINI_PROGRAM_STABLE_ACCESS_TOKEN, accessToken, expiresIn, TimeUnit.SECONDS);
return accessToken;
}
return accessToken;
}
@Override
public String getSubAccessToken() { public String getSubAccessToken() {
//token有效期为7200s,需要保存起来,先从redis中获取accessToken,没有则请求获取 //token有效期为7200s,需要保存起来,先从redis中获取accessToken,没有则请求获取
String accessToken = stringRedisTemplate.opsForValue().get(WxConstant.SHARE_FLY_SUB_ACCESS_TOKEN); String accessToken = stringRedisTemplate.opsForValue().get(WxConstant.SHARE_FLY_SUB_ACCESS_TOKEN);
...@@ -201,7 +231,7 @@ public class WxServiceImpl implements WxService { ...@@ -201,7 +231,7 @@ public class WxServiceImpl implements WxService {
public ResultBody getUnLimitedQRCode(String path, String scene) { public ResultBody getUnLimitedQRCode(String path, String scene) {
String base64 = ""; String base64 = "";
try { try {
String accessToken = this.getAccessToken(); String accessToken = this.getStableAccessToken();
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("scene", scene); param.put("scene", scene);
param.put("page", path); param.put("page", path);
...@@ -219,7 +249,7 @@ public class WxServiceImpl implements WxService { ...@@ -219,7 +249,7 @@ public class WxServiceImpl implements WxService {
@Override @Override
public ResultBody sendAppletMsg(AppletMsgVO appletMsgVO) { public ResultBody sendAppletMsg(AppletMsgVO appletMsgVO) {
String accessToken = this.getAccessToken(); String accessToken = this.getStableAccessToken();
if (StringUtils.isBlank(accessToken)){ if (StringUtils.isBlank(accessToken)){
return ResultBody.error(ResultEnum.WX_ACCESS_TOKEN_ERROR.getResultCode(), return ResultBody.error(ResultEnum.WX_ACCESS_TOKEN_ERROR.getResultCode(),
ResultEnum.WX_ACCESS_TOKEN_ERROR.getResultMsg()); ResultEnum.WX_ACCESS_TOKEN_ERROR.getResultMsg());
...@@ -238,7 +268,7 @@ public class WxServiceImpl implements WxService { ...@@ -238,7 +268,7 @@ public class WxServiceImpl implements WxService {
@Override @Override
public String createUrlLink(String path, String query) { public String createUrlLink(String path, String query) {
try { try {
String accessToken = this.getAccessToken(); String accessToken = this.getStableAccessToken();
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("path", path); param.put("path", path);
param.put("env_version", userSystemConstant.getEnvVersion()); param.put("env_version", userSystemConstant.getEnvVersion());
...@@ -259,12 +289,14 @@ public class WxServiceImpl implements WxService { ...@@ -259,12 +289,14 @@ public class WxServiceImpl implements WxService {
@Override @Override
public String getUserPhoneNumber(Integer id, String code) { public String getUserPhoneNumber(Integer id, String code) {
try { try {
String accessToken = this.getAccessToken(); String accessToken = this.getStableAccessToken();
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("code", code); param.put("code", code);
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + accessToken; String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + accessToken;
String res = HttpHelper.httpPost(url, param.toString()); String res = HttpHelper.httpPost(url, param.toString());
JSONObject result = JSONObject.parseObject(res); JSONObject result = JSONObject.parseObject(res);
log.info("param: id:{},code:{}", id, code);
log.info("getUserPhoneNumber: " + result.toString());
if (result.getString("errcode").equals("0")) { if (result.getString("errcode").equals("0")) {
String phone_info = result.getString("phone_info"); String phone_info = result.getString("phone_info");
JSONObject phoneInfoObject = JSONObject.parseObject(phone_info); JSONObject phoneInfoObject = JSONObject.parseObject(phone_info);
......
...@@ -70,4 +70,6 @@ third-party: ...@@ -70,4 +70,6 @@ third-party:
iuav: iuav:
pay: pay:
uri: http://payment-svc:8088 uri: http://payment-svc:8088
\ No newline at end of file pms:
uri: http://pms-svc:8099
\ No newline at end of file
...@@ -41,4 +41,6 @@ third-party: ...@@ -41,4 +41,6 @@ third-party:
iuav: iuav:
pay: pay:
uri: http://127.0.0.1:8088 uri: http://127.0.0.1:8088
\ No newline at end of file pms:
uri: http://127.0.0.1:8099
\ No newline at end of file
...@@ -70,4 +70,6 @@ third-party: ...@@ -70,4 +70,6 @@ third-party:
iuav: iuav:
pay: pay:
uri: http://payment-svc:8088 uri: http://payment-svc:8088
\ No newline at end of file pms:
uri: http://pms-svc:8099
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.iuav.user.dao.CompanyDao">
<insert id="addCompanyInfo" useGeneratedKeys="true" keyProperty="id" parameterType="com.mmc.iuav.user.entity.CompanyInfoDO">
insert into company_info(company_type,company_name,full_name,province,city,district,address,company_user_name,phone_num,remark,create_time)
values (#{companyType}, #{companyName}, #{fullName}, #{province}, #{city}, #{district}, #{address}, #{companyUserName}, #{phoneNum}, #{remark}, NOW())
</insert>
<insert id="addCompanyBackUser" parameterType="com.mmc.iuav.user.entity.CompanyBackUserDO" keyProperty="id" useGeneratedKeys="true">
insert into company_back_user(back_user_account_id, company_info_id, create_time)
values (#{backUserAccountId}, #{companyInfoId}, NOW())
</insert>
<update id="removeCompanyInfo">
update company_info set is_deleted = 1 where id = #{id}
</update>
<update id="updateCompanyInfo">
update company_info
<set>
<if test="companyType != null">
company_type = #{companyType},
</if>
<if test="companyName != null">
company_name = #{companyName},
</if>
<if test="fullName != null">
full_name = #{fullName},
</if>
<if test="province != null">
province = #{province},
</if>
<if test="city != null">
city = #{city},
</if>
<if test="district != null">
district = #{district},
</if>
<if test="address != null">
address = #{address},
</if>
<if test="companyUserName != null">
company_user_name = #{companyUserName},
</if>
<if test="phoneNum != null">
phone_num = #{phoneNum},
</if>
<if test="remark != null">
remark = #{remark}
</if>
</set>
where
id = #{id}
</update>
<update id="updateCompanyBackUser">
update company_back_user set company_info_id = #{companyInfoId} where back_user_account_id = #{backUserAccountId}
</update>
<select id="getCompanyInfoById" resultType="com.mmc.iuav.user.entity.CompanyInfoDO">
select id, company_type, company_name, full_name, province, city, district, address, company_user_name, phone_num, remark, create_time
from company_info
where id = #{id} and is_deleted = 0
</select>
<select id="countListCompanyPage" resultType="java.lang.Integer" parameterType="com.mmc.iuav.user.model.qo.CompanyInfoQO">
select count(*) from company_info
where is_deleted = 0
<if test="companyName != null">
and company_name like CONCAT("%",#{companyName},"%")
</if>
<if test="companyInfoId != null">
and id = #{companyInfoId}
</if>
</select>
<select id="listCompanyPage" resultType="com.mmc.iuav.user.entity.CompanyInfoDO" parameterType="com.mmc.iuav.user.model.qo.CompanyInfoQO">
select id, company_type, company_name, full_name, province, city, district, address, company_user_name, phone_num, remark, create_time
from company_info
where is_deleted = 0
<if test="companyName != null">
and company_name like CONCAT("%",#{companyName},"%")
</if>
<if test="companyInfoId != null">
and id = #{companyInfoId}
</if>
order by create_time desc
limit #{pageNo}, #{pageSize}
</select>
<select id="getCompanyInfoByBackUserAccountId" resultType="com.mmc.iuav.user.entity.CompanyInfoDO">
SELECT ci.id, ci.company_type, ci.company_name, ci.full_name, ci.province, ci.city, ci.district, ci.address, ci.company_user_name,
ci.phone_num, ci.remark, ci.create_time
FROM company_info ci INNER JOIN company_back_user cbu ON ci.id = cbu.company_info_id
WHERE cbu.back_user_account_id = #{backUserAccountId} and ci.is_deleted = 0
</select>
<select id="countCompanyBackUser" resultType="java.lang.Integer">
select count(*) from company_info ci
INNER JOIN company_back_user cbu ON ci.id = cbu.company_info_id
INNER JOIN back_user_account bua ON cbu.back_user_account_id = bua.id
where ci.id = #{id} and ci.is_deleted = 0 and bua.is_deleted = 0
</select>
<select id="listCompanyInfoByUID" resultType="com.mmc.iuav.user.entity.CompanyInfoDO">
SELECT ci.id, ci.company_type, ci.company_name, ci.full_name, ci.province, ci.city, ci.district, ci.address, ci.company_user_name,
ci.phone_num, ci.remark, ci.create_time, cbu.back_user_account_id
FROM company_info ci INNER JOIN company_back_user cbu ON ci.id = cbu.company_info_id
WHERE ci.is_deleted = 0
<if test="backUserIds != null">
<foreach collection="backUserIds" item="backUserAccountId" open="and cbu.back_user_account_id in (" close=")" separator=",">
#{backUserAccountId}
</foreach>
</if>
</select>
<select id="countCompanyNames" resultType="java.lang.Integer">
select count(*) from company_info ci
where ci.is_deleted = 0 and ci.company_name = #{companyName}
<if test="id != null">
and ci.id != #{id}
</if>
</select>
</mapper>
\ No newline at end of file
...@@ -18,3 +18,5 @@ data-filter: ...@@ -18,3 +18,5 @@ data-filter:
- /userapp/wx/wxSendMessage - /userapp/wx/wxSendMessage
- /userapp/user-account/feignListUserAccountIds - /userapp/user-account/feignListUserAccountIds
- /userapp/back-user/listTest - /userapp/back-user/listTest
- /userapp/company/listCompanyPageBack
- /userapp/company/getCompanyInfoById
...@@ -18,4 +18,4 @@ patches: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms
newTag: 09419886c7020f6a51922ed3103025fdfb04dab7 newTag: 677d01da80e50371d2f0e7610dab215c65407b6b
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论