Commit 56aa1074 by 吴博

feat:[1004887] 根据书籍获取手机号登录

parent ff27c0cf
......@@ -820,6 +820,17 @@ public class BookDto extends BaseDto {
*/
private List<String> erpNumbers;
//是否开启手机号登录
private Integer bookPhoneAuth;
public Integer getBookPhoneAuth() {
return bookPhoneAuth;
}
public void setBookPhoneAuth(Integer bookPhoneAuth) {
this.bookPhoneAuth = bookPhoneAuth;
}
public Boolean getOpenCatalogPermission() {
return openCatalogPermission;
}
......
......@@ -431,4 +431,23 @@ public interface BookAdviserBiz {
* * @param null
*/
Boolean hasApprovalBook4Adviser(Long adviserId);
/**
* 更新书籍手机号登录状态
* @param bookId
* @param adviserId
* @param channelId
* @param bookPhoneAuth
*/
void updateBookPhoneAuth(Long bookId, Long adviserId, Long channelId, Integer bookPhoneAuth);
/**
* 获取手机号登录状态
* @param sceneId
* @param bookId
* @param adviserId
* @param channelId
* @return
*/
Integer getBookPhoneAuth(Long sceneId, Long bookId, Long adviserId, Long channelId);
}
......@@ -94,6 +94,7 @@ import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingNow;
import com.pcloud.book.rightsSetting.entity.RightsSettingTitle;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.channelcenter.base.constants.MessageFromTypeEnum;
import com.pcloud.channelcenter.base.exceptions.ChannelBizException;
import com.pcloud.channelcenter.qrcode.dto.AdviserQrcodeSceneDTO;
......@@ -3127,4 +3128,39 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
Integer count = bookAdviserDao.hasApprovalBook4Adviser(adviserId);
return count > 0 ? true : false;
}
@Override
@ParamLog("更新书籍手机号登录状态")
public void updateBookPhoneAuth(Long bookId, Long adviserId, Long channelId, Integer bookPhoneAuth) {
if (null == bookId || null == adviserId || null == channelId || null == bookPhoneAuth) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "参数为空请确认");
}
bookAdviserDao.updateBookPhoneAuth(bookId, adviserId, channelId, bookPhoneAuth);
}
@Override
@ParamLog("获取手机号登录状态")
public Integer getBookPhoneAuth(Long sceneId, Long bookId, Long adviserId, Long channelId) {
Integer bookPhoneAuth = YesOrNoEnums.NO.getValue();
if(null == sceneId && null == bookId && null == adviserId && null == channelId) {
return bookPhoneAuth;
}
if (null != bookId) {
bookPhoneAuth = bookAdviserDao.getBookPhoneAuth(bookId, adviserId, channelId);
} else if (null != sceneId) {
//根据sceneId获取二维码信息
Map<Long, QrcodeSceneDto> qrcodeSceneDtoMap = qrcodeSceneConsr.listBaseInfoByIds(Lists.newArrayList(sceneId));
if (MapUtils.isEmpty(qrcodeSceneDtoMap) || null == qrcodeSceneDtoMap.get(sceneId)) {
return bookPhoneAuth;
}
QrcodeSceneDto qrcodeSceneDto = qrcodeSceneDtoMap.get(sceneId);
if (null == qrcodeSceneDto || null == qrcodeSceneDto.getAdviserBookId()) {
return bookPhoneAuth;
}
bookPhoneAuth = bookAdviserDao.getBookPhoneAuth(qrcodeSceneDto.getAdviserBookId(), qrcodeSceneDto.getCreatedByUserLogin(),qrcodeSceneDto.getChannelPartyId());
}
return bookPhoneAuth;
}
}
......@@ -331,4 +331,8 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
int updateRaysField4Erp(List<RelateRaysBookApprovalVO> approvalList);
Integer hasApprovalBook4Adviser(Long adviserId);
void updateBookPhoneAuth(Long bookId, Long adviserId, Long channelId, Integer bookPhoneAuth);
Integer getBookPhoneAuth(Long bookId, Long adviserId, Long channelId);
}
......@@ -447,4 +447,23 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
public Integer hasApprovalBook4Adviser(Long adviserId) {
return getSessionTemplate().selectOne(getStatement("hasApprovalBook4Adviser"), adviserId);
}
@Override
public void updateBookPhoneAuth(Long bookId, Long adviserId, Long channelId, Integer bookPhoneAuth) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
paramMap.put("bookPhoneAuth", bookPhoneAuth);
getSessionTemplate().update(getStatement("updateBookPhoneAuth"), paramMap);
}
@Override
public Integer getBookPhoneAuth(Long bookId, Long adviserId, Long channelId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
return getSessionTemplate().selectOne(getStatement("getBookPhoneAuth"), paramMap);
}
}
......@@ -442,4 +442,24 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
bookAdviserBiz.updateRaysField4Erp(relateRaysBookList);
return new ResponseDto<>();
}
@RequestMapping(value = "updateBookPhoneAuth", method = RequestMethod.GET)
public ResponseDto<?> updateBookPhoneAuth(@RequestHeader("token") String token,
@RequestParam(value = "bookId") Long bookId,
@RequestParam(value = "channelId") Long channelId,
@RequestParam(value = "bookPhoneAuth") Integer bookPhoneAuth) throws PermissionException {
Long adviserId = (Long)SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookAdviserBiz.updateBookPhoneAuth(bookId, adviserId, channelId, bookPhoneAuth);
return new ResponseDto<>();
}
@RequestMapping(value = "getBookPhoneAuth", method = RequestMethod.GET)
public ResponseDto<?> getBookPhoneAuth(@CookieValue("userInfo") String userInfo,
@RequestParam(value = "sceneId",required = false) Long sceneId,
@RequestParam(value = "bookId",required = false) Long bookId,
@RequestParam(value = "adviserId",required = false) Long adviserId,
@RequestParam(value = "channelId", required = false) Long channelId) throws PermissionException {
Cookie.getUserInfo(userInfo);
return new ResponseDto<Integer>(bookAdviserBiz.getBookPhoneAuth(sceneId,bookId, adviserId, channelId));
}
}
......@@ -75,6 +75,7 @@
<result column="is_open_catalog" property="isOpenCatalog" jdbcType="BIT" />
<result column="is_approval" property="isApproval" jdbcType="BIT" />
<result column="is_relate" property="isRelate" jdbcType="BIT" />
<result column="book_phone_auth" property="bookPhoneAuth" jdbcType="BIT" />
</resultMap>
<resultMap id="bookListPageMap" type="bookDto" extends ="bookMap">
......@@ -319,7 +320,7 @@
BA.GRA_LABEL_ID,BA.SUB_LABEL_ID,BA.VER_LABEL_ID,BA.AREA_LABEL_ID, BA.IS_PRINT isPrint, BA.is_relate,
BA.pro_label_id, BA.dep_label_id,BA.pur_label_id,BA.vol_label_id,if(G.ID IS NULL, 0, 1) isBookGroup, G.id BOOK_GROUP_ID,G.join_group_type,
BA.is_open_robot_process,BA.vol_label_id,b.unique_number,BA.CREATED_DATE,b.edition,BA.is_send_mini_url,
BA.is_open_catalog ,BA.is_approval
BA.is_open_catalog ,BA.is_approval, BA.book_phone_auth
FROM
BOOK_ADVISER BA
INNER JOIN
......
......@@ -1239,4 +1239,36 @@
AND CREATED_USER = #{adviserId}
</select>
<update id="updateBookPhoneAuth" parameterType="map">
update
book_adviser
set
book_phone_auth = #{bookPhoneAuth}, LAST_MODIFIED_DATE = NOW()
where
BOOK_ID = #{bookId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
and
IS_DELETE = 0
</update>
<select id="getBookPhoneAuth" parameterType="map" resultType="integer">
select
book_phone_auth
from
book_adviser
where
book_id = #{bookId}
<if test="adviserId != null">
and adviser_id = #{adviserId}
</if>
<if test="channelId != null">
and channel_id = #{channelId}
</if>
and
is_delete = 0
limit 1
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment