|
|
@@ -11,9 +11,11 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
企业双百强
|
|
|
@@ -28,9 +30,11 @@ public class DoubleHundredApiController {
|
|
|
|
|
|
@Autowired
|
|
|
private DoubleHundredService doubleHundredService;
|
|
|
+ @Autowired
|
|
|
+ private ValueOperations<String, Object> valueOperations;
|
|
|
|
|
|
@PostMapping("submitInformation")
|
|
|
- @ApiOperation(value = "个人互助信息提交")
|
|
|
+ @ApiOperation(value = "个人互助信息提交(开放)")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "information", value = "企业信息", required = true, paramType = "form"),
|
|
|
@ApiImplicitParam(name = "person", value = "联系人", required = true, paramType = "form"),
|
|
|
@@ -38,7 +42,8 @@ public class DoubleHundredApiController {
|
|
|
@ApiImplicitParam(name = "introduction", value = "企业介绍", required = true, paramType = "form"),
|
|
|
@ApiImplicitParam(name = "income", value = "收入", required = true, paramType = "form"),
|
|
|
@ApiImplicitParam(name = "payTaxes", value = "纳税", required = true, paramType = "form"),
|
|
|
- @ApiImplicitParam(name = "personId", value = "提交用户ID(没有则不传)", paramType = "form")
|
|
|
+ @ApiImplicitParam(name = "personId", value = "提交用户ID(没有则不传)", paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "openId", value = "openId", paramType = "form"),
|
|
|
})
|
|
|
public MessageResult<Map> submitInformation(
|
|
|
@RequestParam(value="information",defaultValue="") String information,
|
|
|
@@ -47,9 +52,20 @@ public class DoubleHundredApiController {
|
|
|
@RequestParam(value="introduction",defaultValue="") String introduction,
|
|
|
@RequestParam(value="income",defaultValue="") String income,
|
|
|
@RequestParam(value="payTaxes",defaultValue="") String payTaxes,
|
|
|
- @RequestParam(value="personId",defaultValue="") String personId) {
|
|
|
+ @RequestParam(value="personId",defaultValue="") String personId,
|
|
|
+ @RequestParam(value="openId",defaultValue="") String openId) {
|
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
try {
|
|
|
+
|
|
|
+ String key = "personInfo_register_" + phone;
|
|
|
+
|
|
|
+ //5秒内不能重复提交
|
|
|
+ boolean lockSuccess = valueOperations.setIfAbsent(key, true, 5, TimeUnit.SECONDS);
|
|
|
+
|
|
|
+ if (!lockSuccess) {
|
|
|
+ throw new Exception("操作过于频繁!");
|
|
|
+ }
|
|
|
+
|
|
|
DoubleHundred dh = new DoubleHundred();
|
|
|
dh.setId(UUID.randomUUID().toString());
|
|
|
dh.setInformation(information);
|
|
|
@@ -61,6 +77,9 @@ public class DoubleHundredApiController {
|
|
|
if(StringUtils.isNotEmpty(personId)) {
|
|
|
dh.setCreateBy(personId);
|
|
|
}
|
|
|
+ if(StringUtils.isNotEmpty(openId)) {
|
|
|
+ dh.setOpenId(openId);
|
|
|
+ }
|
|
|
dh.setCreateTime(new Date());
|
|
|
dh.setDelFlag(false);
|
|
|
int num = doubleHundredService.insert(dh);
|