|
|
|
@ -12,7 +12,6 @@ import com.dxhy.common.exception.BaseException; |
|
|
|
|
import com.dxhy.common.util.InvoiceUtil; |
|
|
|
|
import com.dxhy.common.utils.Base64Encoding; |
|
|
|
|
import com.dxhy.common.utils.R; |
|
|
|
|
import com.dxhy.erp.dao.*; |
|
|
|
|
import com.dxhy.erp.entity.*; |
|
|
|
|
import com.dxhy.erp.entity.sdny.*; |
|
|
|
|
import com.dxhy.erp.model.InvoiceDetailInfo; |
|
|
|
@ -21,11 +20,14 @@ import com.dxhy.erp.utils.Base64; |
|
|
|
|
import com.dxhy.erp.utils.HmacSHA1Util; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.redisson.api.RLock; |
|
|
|
|
import org.redisson.api.RedissonClient; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
|
import org.springframework.util.Base64Utils; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
@ -86,6 +88,9 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
@Autowired |
|
|
|
|
private ImageSubmitService imageSubmitService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private RedissonClient redisson; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查验发票 |
|
|
|
|
*/ |
|
|
|
@ -489,6 +494,18 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
@SysLog("发票查验") |
|
|
|
|
public ResponseEntity<String> singleInvoiceCheck(@RequestBody Map<String, String> pramsMap) throws Exception { |
|
|
|
|
log.info("传入的参数为:{}", pramsMap); |
|
|
|
|
String param = JSONObject.toJSONString(pramsMap); |
|
|
|
|
//加分布式锁
|
|
|
|
|
String lockKey = Base64Utils.encodeToString(param.getBytes()); |
|
|
|
|
boolean isLock = false; |
|
|
|
|
RLock lock = redisson.getLock(lockKey); |
|
|
|
|
try { |
|
|
|
|
isLock = lock.tryLock(); |
|
|
|
|
|
|
|
|
|
if (!isLock) { |
|
|
|
|
log.info("当前已有线程获取到锁"); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
String dbName = "business"; |
|
|
|
|
JSONObject checkInvoiceResult = null; |
|
|
|
|
|
|
|
|
@ -725,6 +742,18 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
|
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult))); |
|
|
|
|
} |
|
|
|
|
}catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", ""))); |
|
|
|
|
} |
|
|
|
|
finally { |
|
|
|
|
//关锁
|
|
|
|
|
if (isLock) { |
|
|
|
|
lock.unlock(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", "请求正在处理,不要重复提交"))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
void saveCheckLog(Map<String, String> pramsMap, JSONObject checkInvoice) { |
|
|
|
|