修改公司状态

master
bynt 2 years ago
parent 1c21f2a555
commit 9092c107e4

@ -95,8 +95,11 @@ public class Company extends BaseEntity implements Serializable {
@ApiModelProperty("公司类型")
@Column(name = "template_type")
@Column(name = "company_type")
private Integer companyType;
@ApiModelProperty("授权状态")
@Column(name = "authorization_state")
private Boolean authorizationState = Boolean.FALSE;
}

@ -92,4 +92,14 @@ public interface CompanyRepository extends JpaRepository<Company, Long>, JpaSpec
* id
*/
Company findByUserId(Long userId);
/**
*
*
* @param flag
* @param id
*/
@Modifying
@Query("UPDATE Company set authorizationState = ?2 where id = ?1")
void updateAuthorizationStatusById(Boolean flag, Long id);
}

@ -261,4 +261,6 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
@Modifying
@Query(value = "update User set expirationTime = ?1 where id = ?2")
void updateExpirationTimeById(Date expirationTime, Long id);
}

@ -10,8 +10,12 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 广
*
* @author Enzo
* @date : 2022/9/14
*/
@ -28,20 +32,21 @@ public class OceanEngineController {
@ApiOperation("获取投放请求")
@GetMapping(value = "/{id}")
public ResponseEntity<String> query(@PathVariable Long id){
public ResponseEntity<String> query(@PathVariable Long id) {
return new ResponseEntity<>(oceanEngineService.buildAuthorizationUrl(id), HttpStatus.OK);
}
@ApiOperation("获取回调请求")
@GetMapping(value = "/callback")
public ResponseEntity<Void> callback(@RequestParam("state") String state,@RequestParam("auth_code") String authCode){
public ResponseEntity<Void> callback(@RequestParam("state") String state,
@RequestParam("auth_code") String authCode,
HttpServletResponse response) throws IOException {
log.info("================== the state as {},authCode as {} ================", state, authCode);
oceanEngineService.processRequest(state, authCode);
response.sendRedirect("https://baiyee.vip/dashboard");
return new ResponseEntity<>(HttpStatus.OK);
}
}

@ -88,4 +88,11 @@ public interface CompanyService {
* @param companyId
*/
void updateCompanyTemplateId(Long templateId, Long companyId);
/**
*
* @param aTrue
* @param id
*/
void updateCompanyAuthorizationStatus(Boolean aTrue, Long id);
}

@ -151,4 +151,9 @@ public class CompanyServiceImpl implements CompanyService {
public void updateCompanyTemplateId(Long templateId, Long companyId) {
companyRepository.updateCompanyTemplateIdById(templateId,companyId);
}
@Override
public void updateCompanyAuthorizationStatus(Boolean flag, Long id) {
companyRepository.updateAuthorizationStatusById(flag, id);
}
}

@ -89,9 +89,11 @@ public class OceanEngineServiceImpl implements OceanEngineService {
byCompanyId.setStatus(DefaultNumberConstants.ONE_NUMBER);
byCompanyId.setRefreshTokenExpiresIn(data.getRefreshTokenExpiresIn());
oceanEngineRepository.save(byCompanyId);
companyService.updateCompanyAuthorizationStatus(Boolean.TRUE, companyById.getId());
return;
}
// 修改信息
companyService.updateCompanyAuthorizationStatus(Boolean.TRUE, companyById.getId());
oceanEngineRepository.updateOceanEngin
(data.getAccessToken(), data.getRefreshToken(), data.getExpiresIn(),
data.getRefreshTokenExpiresIn(), JSONUtil.toJsonStr(data.getAdvertiserIds()), byCompanyId.getId());

@ -104,7 +104,8 @@ public class WeChatUserServiceImpl implements WeChatUserService {
map.put("wechat", byUserId.getWxId());
map.put("tagetWxId", weChatFriendDTO.getTagetWxId());
map.put("helloContent", weChatFriendDTO.getSendContent());
map.put("type", weChatFriendDTO.getType());
map.put("opCode", DefaultNumberConstants.ZERO_NUMBER);
map.put("type", DefaultNumberConstants.ZERO_NUMBER);
if (weChatFriendDTO.getType() == DefaultNumberConstants.ZERO_NUMBER
&& StringUtils.isBlank(weChatFriendDTO.getTagetWxId())) {
@ -180,7 +181,7 @@ public class WeChatUserServiceImpl implements WeChatUserService {
if (StringUtils.isBlank(cusQrUuId)) {
return;
}
WeChatUser byUserId = weChatUserRepository.findByWxId(userLoginDTO.getWxid());
WeChatUser byUserId = weChatUserRepository.findByUserId(currentUserId);
if (ObjectUtil.isNull(byUserId)) {
byUserId = new WeChatUser();
saveWeChatUser(userLoginDTO, currentUserId, byUserId);

Loading…
Cancel
Save