|
|
@ -30,6 +30,7 @@ import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.Constant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|
|
|
import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.dto.result.OptionDataResultDTO; |
|
|
@ -76,6 +77,7 @@ import org.apache.commons.io.IOUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.poi.poifs.filesystem.OfficeXmlFileException; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import org.redisson.api.RLock; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
@ -90,6 +92,7 @@ import java.nio.file.Path; |
|
|
|
import java.nio.file.Paths; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -139,6 +142,8 @@ public class IcResiUserController implements ResultDataResolver { |
|
|
|
private RequestInterceptor requestInterceptor; |
|
|
|
@Autowired |
|
|
|
private ExecutorService executorService; |
|
|
|
@Autowired |
|
|
|
private DistributedLock distributedLock; |
|
|
|
|
|
|
|
/** |
|
|
|
* 模板枚举 |
|
|
@ -247,11 +252,19 @@ public class IcResiUserController implements ResultDataResolver { |
|
|
|
@NoRepeatSubmit |
|
|
|
@PostMapping("edit") |
|
|
|
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody List<IcResiUserFormDTO> formDTO) { |
|
|
|
RLock lock = null; |
|
|
|
try { |
|
|
|
lock = distributedLock.getLock(RedisKeys.getXiaoquEditLock(tokenDto.getCustomerId()), 120L, 3L, TimeUnit.SECONDS); |
|
|
|
String resiUserId = icResiUserService.edit(tokenDto, formDTO); |
|
|
|
//推送MQ事件
|
|
|
|
editResiMq(tokenDto.getCustomerId(), resiUserId); |
|
|
|
|
|
|
|
this.sendVolunteerMsg(tokenDto.getCustomerId(), resiUserId); |
|
|
|
} finally { |
|
|
|
if (lock != null) { |
|
|
|
lock.unlock(); |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
@ -599,7 +612,9 @@ public class IcResiUserController implements ResultDataResolver { |
|
|
|
// 三.异步执行导入
|
|
|
|
executorService.execute(() -> { |
|
|
|
boolean isAllSuccess = false; |
|
|
|
RLock lock = null; |
|
|
|
try { |
|
|
|
lock = distributedLock.getLock(RedisKeys.getXiaoquEditLock(customerId), 120L, 3L, TimeUnit.SECONDS); |
|
|
|
List<FormItemResult> formItemList = icResiUserService.listFormItems(customerId, IcFormCodeEnum.RESI_BASE_INFO.getCode()); |
|
|
|
isAllSuccess = icResiUserImportService.importIcResiInfoFromExcel(importTaskId, formItemList, importTempFileSavePath.toString(), response, IC_RESI_UPLOAD_DIR); |
|
|
|
} catch (Throwable e) { |
|
|
@ -638,6 +653,11 @@ public class IcResiUserController implements ResultDataResolver { |
|
|
|
form.setMessageType(SystemMessageType.IC_RESI_USER_ADD); |
|
|
|
form.setContent(mqMsg); |
|
|
|
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); |
|
|
|
|
|
|
|
//解锁
|
|
|
|
if (lock != null) { |
|
|
|
lock.unlock(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|