Browse Source

查询信息接口调整

dev_shibei_match
sunyuchao 5 years ago
parent
commit
6e85f5f781
  1. 2
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java
  2. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java
  3. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java
  4. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java
  5. 15
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  6. 12
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml

2
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java

@ -20,7 +20,7 @@ public class MyInfoFormDTO implements Serializable {
/** /**
* 客户Id * 客户Id
*/ */
@NotBlank(message = "客户Id不能为空", groups = {MyInfoFormDTO.AddUserInternalGroup.class}) //@NotBlank(message = "客户Id不能为空", groups = {MyInfoFormDTO.AddUserInternalGroup.class})
private String customerId; private String customerId;
} }

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java

@ -87,8 +87,9 @@ public class PaCustomerController {
**/ **/
@PostMapping("myinfo") @PostMapping("myinfo")
public Result<MyInfoResultDTO> myInfo(@LoginUser TokenDto tokenDTO, @RequestBody MyInfoFormDTO formDTO) { public Result<MyInfoResultDTO> myInfo(@LoginUser TokenDto tokenDTO, @RequestBody MyInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MyInfoFormDTO.AddUserInternalGroup.class); //ValidatorUtils.validateEntity(formDTO, MyInfoFormDTO.AddUserInternalGroup.class);
return new Result<MyInfoResultDTO>().ok(paCustomerService.myInfo(formDTO)); ValidatorUtils.validateEntity(formDTO);
return new Result<MyInfoResultDTO>().ok(paCustomerService.myInfo(tokenDTO, formDTO));
} }
/** /**

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java

@ -18,8 +18,10 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaCustomerUserAgencyDTO;
import com.epmet.entity.PaCustomerUserAgencyEntity; import com.epmet.entity.PaCustomerUserAgencyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 用户组织关系表 * 用户组织关系表
@ -29,5 +31,12 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface PaCustomerUserAgencyDao extends BaseDao<PaCustomerUserAgencyEntity> { public interface PaCustomerUserAgencyDao extends BaseDao<PaCustomerUserAgencyEntity> {
/**
* @param userId
* @return
* @Author sun
* @Description 根据userId查询客户信息
**/
PaCustomerUserAgencyDTO selectByUserId(@Param("userId") String userId);
} }

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java

@ -130,7 +130,7 @@ public interface PaCustomerService extends BaseService<PaCustomerEntity> {
* @Author sun * @Author sun
* @Description 公众号-查询我的信息 * @Description 公众号-查询我的信息
**/ **/
MyInfoResultDTO myInfo(MyInfoFormDTO formDTO); MyInfoResultDTO myInfo(TokenDto tokenDTO, MyInfoFormDTO formDTO);
/** /**
* @param formDTO * @param formDTO

15
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java

@ -85,6 +85,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
@Autowired @Autowired
private CustomerMpDao customerMpDao; private CustomerMpDao customerMpDao;
@Autowired @Autowired
private PaCustomerUserAgencyDao paCustomerUserAgencyDao;
@Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
private PaCustomerAgencyService paCustomerAgencyService; private PaCustomerAgencyService paCustomerAgencyService;
@ -298,16 +300,23 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
* @Description 公众号-查询我的信息 * @Description 公众号-查询我的信息
**/ **/
@Override @Override
public MyInfoResultDTO myInfo(MyInfoFormDTO formDTO) { public MyInfoResultDTO myInfo(TokenDto tokenDTO, MyInfoFormDTO formDTO) {
//0.根据token中userId查询对应的客户Id,客户Id没有则表示用户没有填写过组织信息,需要继续完善信息
PaCustomerUserAgencyDTO dto = paCustomerUserAgencyDao.selectByUserId(tokenDTO.getUserId());
if(null==dto||null==dto.getCustomerId()){
return new MyInfoResultDTO();
}
String customerId = dto.getCustomerId();
//1.查询客户组织信息 //1.查询客户组织信息
PaCustomerAgencyDTO agencyDTO = paCustomerAgencyDao.selectCustomerAgency(formDTO.getCustomerId()); PaCustomerAgencyDTO agencyDTO = paCustomerAgencyDao.selectCustomerAgency(customerId);
if (null == agencyDTO) { if (null == agencyDTO) {
throw new RenException(PaConstant.SELECT_AGENCY_EXCEPTION); throw new RenException(PaConstant.SELECT_AGENCY_EXCEPTION);
} }
//2.查询客户小程序授权结果信息 //2.查询客户小程序授权结果信息
List<CustomerMpDTO> listMpDTO = customerMpDao.selectByCustomerId(formDTO.getCustomerId()); List<CustomerMpDTO> listMpDTO = customerMpDao.selectByCustomerId(customerId);
if (null == agencyDTO || listMpDTO.size() != NumConstant.TWO) { if (null == agencyDTO || listMpDTO.size() != NumConstant.TWO) {
throw new RenException(PaConstant.CUSTOMER_MP_EXCEPTION); throw new RenException(PaConstant.CUSTOMER_MP_EXCEPTION);
} }

12
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml

@ -3,5 +3,17 @@
<mapper namespace="com.epmet.dao.PaCustomerUserAgencyDao"> <mapper namespace="com.epmet.dao.PaCustomerUserAgencyDao">
<select id="selectByUserId" resultType="com.epmet.dto.PaCustomerUserAgencyDTO">
SELECT
id,
customer_id,
agency_id,
user_id
FROM
pa_customer_user_agency
WHERE
del_flag = '0'
AND user_id = #{userId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save