Merge remote-tracking branch 'origin/release' into release

release
yishiqihuasheng 2 years ago
commit 4cd8a37f39
  1. 23
      dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java
  2. 145
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java
  3. 24
      dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtCustomsController.java
  4. 6
      dxhy-extend/src/main/resources/mapper/CustomsMapper.xml
  5. 11
      dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml

@ -106,11 +106,8 @@ public class SnEmailGatherTask {
Store store = mailAuth(emailName, password); Store store = mailAuth(emailName, password);
if(store == null){ if(store == null){
MailGatherLogVo gatherLogVo = new MailGatherLogVo(); MailGatherLogVo gatherLogVo = new MailGatherLogVo();
gatherLogVo.setId(UUIDUtils.generateShortUuid());
gatherLogVo.setErrorMsg("邮箱认证失败");
gatherLogVo.setOcrType("1");
gatherLogVo.setFromAddress(emailName); gatherLogVo.setFromAddress(emailName);
mailGatherLogService.insert(gatherLogVo); buildMsg(gatherLogVo,"1","邮箱认证失败");
return; return;
} }
Folder folder = store.getFolder("INBOX"); Folder folder = store.getFolder("INBOX");
@ -184,21 +181,19 @@ public class SnEmailGatherTask {
Map resultMap = JSONObject.parseObject(body, Map.class); Map resultMap = JSONObject.parseObject(body, Map.class);
Object status = resultMap.get("status"); Object status = resultMap.get("status");
if(status != null && "200".equals(String.valueOf(status))){ if(status != null && "200".equals(String.valueOf(status))){
buildMsg(gatherLogVo,"1","推送影像票夹成功");
}else { }else {
gatherLogVo.setFphm(""); gatherLogVo.setFphm("");
gatherLogVo.setOcrType("0"); buildMsg(gatherLogVo,"0","推送影像票夹失败");
gatherLogVo.setErrorMsg("推送影像票夹失败");
mailGatherLogService.insert(gatherLogVo);
break; break;
} }
System.out.println(body);
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}else { }else {
log.debug("山能OCR识别失败------"); log.debug("山能OCR识别失败------");
buildMsg(gatherLogVo,"1","山能OCR识别失败");
} }
} }
} }
@ -208,9 +203,7 @@ public class SnEmailGatherTask {
} }
//进行数据插入 //进行数据插入
if(StringUtils.isNotBlank(gatherLogVo.getFpdm()) && StringUtils.isNotBlank(gatherLogVo.getFphm())){ if(StringUtils.isNotBlank(gatherLogVo.getFpdm()) && StringUtils.isNotBlank(gatherLogVo.getFphm())){
gatherLogVo.setOcrType("0"); buildMsg(gatherLogVo,"0","采集成功");
gatherLogVo.setErrorMsg("采集成功");
mailGatherLogService.insert(gatherLogVo);
}else { }else {
log.info("未采集到有效数据"); log.info("未采集到有效数据");
} }
@ -228,6 +221,12 @@ public class SnEmailGatherTask {
} }
} }
public void buildMsg(MailGatherLogVo gatherLogVo, String type, String msg){
gatherLogVo.setOcrType(type);
gatherLogVo.setErrorMsg(msg);
mailGatherLogService.insert(gatherLogVo);
}
public static Map<String, Object> convertToOcrResult(List<OpenServiceOcr> openServiceOcrs, Map<String, String> map,EmailMaintainVo maintainVo){ public static Map<String, Object> convertToOcrResult(List<OpenServiceOcr> openServiceOcrs, Map<String, String> map,EmailMaintainVo maintainVo){
List<OcrResultToyxVo> resultToyxVoList = Lists.newArrayList(); List<OcrResultToyxVo> resultToyxVoList = Lists.newArrayList();
Map<String, Object> hashMap = Maps.newHashMap(); Map<String, Object> hashMap = Maps.newHashMap();

@ -1,5 +1,6 @@
package com.dxhy.erp.controller; package com.dxhy.erp.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dxhy.common.aspect.SysLog; import com.dxhy.common.aspect.SysLog;
import com.dxhy.common.constant.CommonConstants; import com.dxhy.common.constant.CommonConstants;
@ -70,7 +71,7 @@ public class SDNYMainProcessController extends AbstractController {
@PostMapping("/sn/singleInvoiceCheck") @PostMapping("/sn/singleInvoiceCheck")
@ResponseBody @ResponseBody
@SysLog("发票查验") @SysLog("发票查验")
public ResponseEntity<String> singleInvoiceCheck(@RequestBody Map<String, String> pramsMap) { public ResponseEntity<String> singleInvoiceCheck(@RequestBody Map<String, String> pramsMap) throws ParseException {
log.info("传入的参数为:{}", pramsMap); log.info("传入的参数为:{}", pramsMap);
String userid = "101833"; String userid = "101833";
String dbName = "business"; String dbName = "business";
@ -128,6 +129,7 @@ public class SDNYMainProcessController extends AbstractController {
log.info("发票类型为:{}", pramsMap.get("invoiceType")); log.info("发票类型为:{}", pramsMap.get("invoiceType"));
String uuid = (StringUtils.isBlank(pramsMap.get("invoiceCode")) ? "" : pramsMap.get("invoiceCode")) + pramsMap.get("invoiceNo"); String uuid = (StringUtils.isBlank(pramsMap.get("invoiceCode")) ? "" : pramsMap.get("invoiceCode")) + pramsMap.get("invoiceNo");
log.info("uuid={}", uuid);
String notes = invoiceQueryService.checkingInvoiceInfo("business", uuid, getUserInfo()); String notes = invoiceQueryService.checkingInvoiceInfo("business", uuid, getUserInfo());
if (notes != null) { if (notes != null) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes))); return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes)));
@ -136,18 +138,25 @@ public class SDNYMainProcessController extends AbstractController {
//查询底账库是否有对应发票,有则直接返回 //查询底账库是否有对应发票,有则直接返回
TdxCheckRecordInvoice checkInvoiceByUuid = signCheckRecordService.getCheckInvoiceByUuid(uuid); TdxCheckRecordInvoice checkInvoiceByUuid = signCheckRecordService.getCheckInvoiceByUuid(uuid);
if (checkInvoiceByUuid != null) { if (checkInvoiceByUuid != null) {
log.info("进项票池已存在发票.直接返回票池信息");
R data = new R(1000, "default success"); R data = new R(1000, "default success");
String checkInvoice = JSONObject.toJSONString(checkInvoiceByUuid); JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(checkInvoiceByUuid);
convertToResult(checkInvoice);
data.put("data", checkInvoice); data.put("data", checkInvoice);
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
} else { } else {
TdxSaleRecordInvoice tdxSaleRecordInvoice = tdxSaleRecordInvoiceDao.selectByUuid(uuid); TdxSaleRecordInvoice tdxSaleRecordInvoice = tdxSaleRecordInvoiceDao.selectByUuid(uuid);
log.info("tdxSaleRecordInvoice={}", tdxSaleRecordInvoice);
if (tdxSaleRecordInvoice != null) { if (tdxSaleRecordInvoice != null) {
log.info("销项票池已存在发票.直接返回票池信息");
R data = new R(1000, "default success"); R data = new R(1000, "default success");
String checkInvoice = JSONObject.toJSONString(tdxSaleRecordInvoice); JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(tdxSaleRecordInvoice);
convertToResult(checkInvoice);
data.put("data", checkInvoice); data.put("data", checkInvoice);
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -199,6 +208,136 @@ public class SDNYMainProcessController extends AbstractController {
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult))); return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)));
} }
private void convertToResult(JSONObject checkInvoice) throws ParseException {
checkInvoice.put("totalTax", checkInvoice.getString("taxAmount"));
checkInvoice.put("amountTax", checkInvoice.getString("totalAmount"));
checkInvoice.put("totalAmount", checkInvoice.getString("invoiceAmount"));
String invoiceCode = checkInvoice.get("invoiceCode").toString();
String invoiceType = checkInvoice.get("invoiceType").toString();
if ("22".equals(invoiceType)) {
invoiceType = "33";
}
if ("21".equals(invoiceType)) {
invoiceType = "31";
}
checkInvoice.put("invoiceType", invoiceType);
checkInvoice.put("administrativeDivisionNo", "");
checkInvoice.put("administrativeDivisionName", "");
checkInvoice.put("invoiceCode", invoiceCode);
checkInvoice.put("invoiceNumber", checkInvoice.get("invoiceNo").toString());
String kprq = checkInvoice.get("invoiceDate").toString();
Date formatDat = new SimpleDateFormat("yyyyMMdd").parse(kprq);
String str = new SimpleDateFormat("yyyy-MM-dd").format(formatDat);
log.info("开票日期为:{} ", str);
checkInvoice.put("billingDate", str);
checkInvoice.put("purchaserName", checkInvoice.get("gfName"));
checkInvoice.put("purchaserTaxNo", checkInvoice.get("gfTaxNo"));
checkInvoice.put("purchaserBank", checkInvoice.get("gfBankAndNo"));
checkInvoice.put("purchaserAddressPhone", checkInvoice.get("gfAddressAndPhone"));
checkInvoice.put("salesName", checkInvoice.get("xfName"));
checkInvoice.put("salesTaxNo", checkInvoice.get("xfTaxNo"));
checkInvoice.put("salesAddressPhone", checkInvoice.get("gfAddressAndPhone"));
checkInvoice.put("salesBank", checkInvoice.get("gfBankAndNo"));
checkInvoice.put("checkCode", checkInvoice.get("checkCode"));
String taxRate = "";
List<Map<String, String>> returnDetailList = new ArrayList<>();
// JSONArray detailList = (JSONArray) invoiceData.get("detailList");
JSONArray detailList = new JSONArray();
for (int i = 0; i < detailList.size(); i++) {
String taxRateDetail = "";
JSONObject detail = (JSONObject) detailList.get(i);
Map<String, String> snDetailMap = new HashMap<String, String>();
snDetailMap.put("rowNo", i + 1 + "");
snDetailMap.put("commodityCode", detail.getString("ssflbm"));
snDetailMap.put("commodityName", detail.getString("hwmc"));
snDetailMap.put("specificationModel", detail.getString("ggxh"));
snDetailMap.put("unit", detail.getString("jldw"));
String quantity = detail.getString("spsl");
if (quantity.length() > 3) {
int index = quantity.indexOf(".");
quantity = quantity.substring(0, index + 2);
}
snDetailMap.put("quantity", quantity);
String unitPrice = detail.getString("bhsdj");
if (unitPrice.length() > 3) {
int index = unitPrice.indexOf(".");
unitPrice = unitPrice.substring(0, index + 3);
}
snDetailMap.put("unitPrice", unitPrice);
if ("11".equals(invoiceType)) {
snDetailMap.put("tax", "0");
//如果是卷票计算合计金额
Float hjje = null;
if (detail.getString("se") != null && detail.getString("je") != null) {
Float je = Float.parseFloat(detail.getString("je"));
Float se = Float.parseFloat(detail.getString("se"));
hjje = je + se;
}
if (hjje != null)
snDetailMap.put("amount", hjje.toString());
} else {
snDetailMap.put("tax", "***".equals(detail.getString("se")) ? "0.00" : detail.getString("se"));
snDetailMap.put("amount", detail.getString("je"));
}
if ("免税".equals(detail.getString("sl"))) {
taxRateDetail = "0";
snDetailMap.put("taxRate", taxRateDetail);
} else {
if (detail.get("sl") != null && StringUtils.isNoneBlank(detail.get("sl").toString())) {
taxRateDetail = detail.get("sl").toString();
if (!"0".equals(taxRateDetail)) {
if (StringUtils.isNoneBlank(taxRateDetail)) {
int index = taxRateDetail.indexOf("%");
if (index > 0) {
taxRateDetail = taxRateDetail.substring(0, taxRateDetail.length() - 1);
Float num = Float.parseFloat(taxRateDetail);
if (num > 9) {
taxRateDetail = "0." + taxRateDetail;
} else {
if (!taxRateDetail.startsWith("0")) {
taxRateDetail = "0.0" + taxRateDetail;
}
}
}
}
}
if ("11".equals(invoiceType)) {
taxRateDetail = "0.000";
}
log.info("明细-发票税率为:{}", taxRateDetail);
snDetailMap.put("taxRate", taxRateDetail);
}
}
log.info("明细-tax={}", detail.get("se"));
log.info("明细-commodityCode={}", detail.get("ssflbm"));
snDetailMap.put("currentDateEnd", detail.getString("txrqz"));
snDetailMap.put("currentDateStart", detail.getString("txrqq"));
snDetailMap.put("licensePlateNum", detail.getString("cph"));
snDetailMap.put("type", detail.getString("lx"));
returnDetailList.add(snDetailMap);
}
checkInvoice.put("invoiceLineList", returnDetailList);
}
/** /**
* 查验发票 * 查验发票
*/ */

@ -117,6 +117,30 @@ public class ExtCustomsController extends AbstractController {
if("99".equals(pramsMap.get("rzhYesorno"))){ if("99".equals(pramsMap.get("rzhYesorno"))){
pramsMap.put("rzhYesorno", null); pramsMap.put("rzhYesorno", null);
} }
if(pramsMap.get("imageNumber") != null){
pramsMap.put("imageId",pramsMap.get("imageNumber"));
}
if(pramsMap.get("snVoucherNumber") != null){
pramsMap.put("snVoucherNumber",pramsMap.get("snVoucherNumber"));
}
if(pramsMap.get("accountPeriod") != null){
pramsMap.put("accountPeriod",pramsMap.get("accountPeriod"));
}
if (pramsMap.get("postingTimeStart") != null && !"".equals(pramsMap.get("postingTimeStart"))) {
pramsMap.put("postingTimeStart",
DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("postingTimeStart").toString())));
}
if (pramsMap.get("postingTimeEnd") != null && !"".equals(pramsMap.get("postingTimeEnd"))) {
pramsMap.put("postingTimeEnd",
DateUtils.getNight(DateUtils.strToDate(pramsMap.get("postingTimeEnd").toString())));
}
log.info("请求列表的参数为:{}",pramsMap);
try { try {
return ResponseEntity.ok(Objects return ResponseEntity.ok(Objects
.requireNonNull(R.ok().put("data", customsService.selectByPramsMap(pramsMap, curr, size)))); .requireNonNull(R.ok().put("data", customsService.selectByPramsMap(pramsMap, curr, size))));

@ -137,12 +137,12 @@
<if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'"> <if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
and t.sn_voucher_number = #{snVoucherNumber} and t.sn_voucher_number = #{snVoucherNumber}
</if> </if>
<if test="postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'">
and t.posting_time = #{postingTime}
</if>
<if test="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'"> <if test="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">
and t.image_id = #{imageId} and t.image_id = #{imageId}
</if> </if>
<if test="postingTimeStart != null and postingTimeEnd != null and postingTimeStart != '' and postingTimeEnd != ''">
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
</if>
<if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'"> <if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
and t.account_period = #{accountPeriod} and t.account_period = #{accountPeriod}
</if> </if>

@ -62,18 +62,19 @@
<if test="qszt != null and qszt != '' and qszt != 'null' "> <if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt} and t.qs_status = #{qszt}
</if> </if>
<if test="rzzt != null and rzzt != '' and rzzt != 'null' "> <if test="rzzt != null and rzzt != '' and rzzt != 'null' and rzzt != '3'">
and t.rzh_yesorno = #{rzzt} and t.rzh_yesorno = #{rzzt}
</if> </if>
<if test="rzzt != null and rzzt == '3'">
and (t.rzh_yesorno = '2' OR t.rzh_yesorno = '3')
</if>
<if test="xfmc != null and xfmc != '' and xfmc != 'null' "> <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
and t.xf_name like CONCAT(#{xfmc},'%') and t.xf_name like CONCAT(#{xfmc},'%')
</if> </if>
<if <if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo} and t.invoice_no = #{invoiceNo}
</if> </if>
<if <if test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
and t.dept_id = #{businessCode} and t.dept_id = #{businessCode}
</if> </if>
<if test="businessCode==''"> <if test="businessCode==''">

Loading…
Cancel
Save