|
@@ -7,6 +7,8 @@ import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.smart.modules.base.entity.WarningPusher;
|
|
|
import com.jpsoft.smart.modules.base.service.WarningPusherService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -222,4 +224,41 @@ public class WarningPusherController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="绑定微信")
|
|
|
+ @PostMapping("bindWeChat")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "openId",value = "微信id", required = true, paramType = "form",dataType = "String")
|
|
|
+ })
|
|
|
+ public MessageResult<WarningPusher> bindWeChat(@RequestParam(value="id",defaultValue="") String id,
|
|
|
+ @RequestParam(value="openId",defaultValue="") String openId,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+ MessageResult<WarningPusher> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ WarningPusher warningPusher = warningPusherService.get(id);
|
|
|
+ warningPusher.setOpenId(openId);
|
|
|
+ warningPusher.setUpdateBy(subject);
|
|
|
+ warningPusher.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = warningPusherService.update(warningPusher);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(warningPusher);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库更新失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|