@@ -0,0 +1,33 @@ | |||
package cn.com.taiji.iaw.api.comm; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.web.ApiResponse; | |||
import cn.com.taiji.iaw.api.MyValidController; | |||
import cn.com.taiji.iaw.dto.comm.WxIsSubscribedRequestDTO; | |||
import cn.com.taiji.iaw.dto.comm.WxIsSubscribedResponseDTO; | |||
import cn.com.taiji.iaw.manager.comm.WxMessageManager; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import javax.validation.Valid; | |||
@Api(tags = {"微信消息"}) | |||
@RestController | |||
@RequestMapping("/api/wxMessage") | |||
public class WxMessageController extends MyValidController { | |||
@Autowired | |||
private WxMessageManager manager; | |||
@ApiOperation("微信公众号-查询用户是否订阅公众号") | |||
@PostMapping("/isSubscribed") | |||
public ApiResponse<WxIsSubscribedResponseDTO> isSubscribed(@Valid @RequestBody WxIsSubscribedRequestDTO dto) throws ManagerException { | |||
return ApiResponse.of(manager.isSubscribed(dto)); | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
package cn.com.taiji.iaw.dto.comm; | |||
import cn.com.taiji.core.dto.AbstractBizRequestDTO; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/7/8 10:05 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
public class WxIsSubscribedRequestDTO extends AbstractBizRequestDTO { | |||
@ApiModelProperty(value = "微信公众号(客户端)id") | |||
@NotBlank | |||
private String clientId; | |||
@ApiModelProperty(value = "微信用户对于每个特定公众号的唯一标识") | |||
@NotBlank | |||
private String openId; | |||
} |
@@ -0,0 +1,26 @@ | |||
package cn.com.taiji.iaw.dto.comm; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/7/8 10:05 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
public class WxIsSubscribedResponseDTO extends BaseModel { | |||
@ApiModelProperty(value = "微信用户是否关注公众号") | |||
private Boolean isSubscribed; | |||
public WxIsSubscribedResponseDTO(Boolean isSubscribed){ | |||
this.isSubscribed = isSubscribed; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
package cn.com.taiji.iaw.manager.comm; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.iaw.dto.comm.WxIsSubscribedRequestDTO; | |||
import cn.com.taiji.iaw.dto.comm.WxIsSubscribedResponseDTO; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/7/8 10:02 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
public interface WxMessageManager { | |||
WxIsSubscribedResponseDTO isSubscribed(WxIsSubscribedRequestDTO dto) throws ManagerException; | |||
} |
@@ -0,0 +1,33 @@ | |||
package cn.com.taiji.iaw.manager.comm; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.core.model.comm.protocol.ats.weiXin.WxMpIsSubscribedRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ats.weiXin.WxMpIsSubscribedResponse; | |||
import cn.com.taiji.iaw.dto.comm.WxIsSubscribedRequestDTO; | |||
import cn.com.taiji.iaw.dto.comm.WxIsSubscribedResponseDTO; | |||
import cn.com.taiji.iaw.manager.AbstractIawManager; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/7/8 10:02 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Service | |||
public class WxMessageManagerImpl extends AbstractIawManager implements WxMessageManager { | |||
@Override | |||
public WxIsSubscribedResponseDTO isSubscribed(WxIsSubscribedRequestDTO dto) throws ManagerException { | |||
WxMpIsSubscribedRequest request = copyProperties(dto, new WxMpIsSubscribedRequest()); | |||
WxMpIsSubscribedResponse response = null; | |||
try { | |||
response = jsonPostRepeat(request); | |||
} catch (ManagerException e) { | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
return new WxIsSubscribedResponseDTO(response.getIsSubscribed()); | |||
} | |||
} |
@@ -30,11 +30,11 @@ public class InvwTransferApplyAddRequestDTO extends AbstractStaffBizRequestDTO { | |||
public void validate(ViolationValidator validator) { | |||
//CardType和ObuType不能同时为空 | |||
if (transferApply.getInventoryType() == InventoryType.CARD && transferApply.getCardType() == null) { | |||
validator.validField("cardType", true, "卡设备型号不能为空"); | |||
if (transferApply.getInventoryType() == InventoryType.CARD) { | |||
validator.validField("cardType", transferApply.getCardType() == null, "卡设备型号不能为空"); | |||
} | |||
if (transferApply.getInventoryType() == InventoryType.OBU && transferApply.getObuType() == null) { | |||
validator.validField("obuType", true, "签设备型号不能为空"); | |||
if (transferApply.getInventoryType() == InventoryType.OBU) { | |||
validator.validField("obuType", transferApply.getObuType() == null, "签设备型号不能为空"); | |||
} | |||
} | |||
} |
@@ -32,11 +32,11 @@ public class InvwTransferApplyCheckRequestDTO extends AbstractStaffBizRequestDTO | |||
public void validate(ViolationValidator validator) { | |||
//CardType和ObuType不能同时为空 | |||
if (transferApply.getInventoryType() == InventoryType.CARD && transferApply.getCardType() == null) { | |||
validator.validField("cardType", true, "卡设备型号不能为空"); | |||
if (transferApply.getInventoryType() == InventoryType.CARD) { | |||
validator.validField("cardType", transferApply.getCardType() == null, "卡设备型号不能为空"); | |||
} | |||
if (transferApply.getInventoryType() == InventoryType.OBU && transferApply.getObuType() == null) { | |||
validator.validField("obuType", true, "签设备型号不能为空"); | |||
if (transferApply.getInventoryType() == InventoryType.OBU) { | |||
validator.validField("obuType", transferApply.getObuType() == null, "签设备型号不能为空"); | |||
} | |||
} | |||
} |
@@ -30,11 +30,11 @@ public class InvwTransferApplyEditRequestDTO extends AbstractStaffBizRequestDTO | |||
public void validate(ViolationValidator validator) { | |||
//CardType和ObuType不能同时为空 | |||
if (transferApply.getInventoryType() == InventoryType.CARD && transferApply.getCardType() == null) { | |||
validator.validField("cardType", true, "卡设备型号不能为空"); | |||
if (transferApply.getInventoryType() == InventoryType.CARD) { | |||
validator.validField("cardType", transferApply.getCardType() == null, "卡设备型号不能为空"); | |||
} | |||
if (transferApply.getInventoryType() == InventoryType.OBU && transferApply.getObuType() == null) { | |||
validator.validField("obuType", true, "签设备型号不能为空"); | |||
if (transferApply.getInventoryType() == InventoryType.OBU) { | |||
validator.validField("obuType", transferApply.getObuType() == null, "签设备型号不能为空"); | |||
} | |||
} | |||
} |