|
|
|
@ -19,11 +19,11 @@ import com.jianshui.invoice.domain.dto.HXResponse; |
|
|
|
|
import com.jianshui.platform.domain.InvoiceDelivery; |
|
|
|
|
import com.jianshui.platform.dto.InvoiceDeliveryDTO; |
|
|
|
|
import com.jianshui.platform.dto.InvoiceDeliveryJsonDataDTO; |
|
|
|
|
import com.jianshui.platform.mapper.CompanyServiceMapper; |
|
|
|
|
import com.jianshui.platform.mapper.InvoiceDeliveryMapper; |
|
|
|
|
import com.jianshui.platform.service.InvoiceDeliveryService; |
|
|
|
|
import com.jianshui.system.domain.InvoiceAllApiLog; |
|
|
|
|
import com.jianshui.system.domain.InvoiceAllYhdj; |
|
|
|
|
import com.jianshui.system.mapper.CompanyserviceMapper; |
|
|
|
|
import com.jianshui.system.mapper.InvoiceAllApiLogMapper; |
|
|
|
|
import com.jianshui.system.mapper.InvoiceAllYhdjMapper; |
|
|
|
|
import com.jianshui.system.mapper.SysUserMapper; |
|
|
|
@ -47,7 +47,7 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService { |
|
|
|
|
@Autowired |
|
|
|
|
private SysUserMapper sysUserMapper; |
|
|
|
|
@Autowired |
|
|
|
|
private CompanyServiceMapper companyServiceMapper; |
|
|
|
|
private CompanyserviceMapper companyServiceMapper; |
|
|
|
|
@Autowired |
|
|
|
|
private InvoiceAllYhdjMapper yhdjMapper; |
|
|
|
|
@Autowired |
|
|
|
@ -72,7 +72,7 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService { |
|
|
|
|
//根据用户id获取用户信息
|
|
|
|
|
SysUser sysUser = sysUserMapper.selectUserById(userId); |
|
|
|
|
//根据企业id获取企业信息
|
|
|
|
|
Companyservice companyservice = companyServiceMapper.findByCompanyId(sysUser.getCompanyId()); |
|
|
|
|
Companyservice companyservice = companyServiceMapper.selectCompanyserviceByCompanyid(sysUser.getCompanyId()); |
|
|
|
|
//获取登记用户信息
|
|
|
|
|
InvoiceAllYhdj userInfo = getUserInfo(companyservice); |
|
|
|
|
if (BeanUtil.isEmpty(userInfo)) { |
|
|
|
@ -86,10 +86,10 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService { |
|
|
|
|
invoiceDeliveryDTO.setNsrsbh(userInfo.getNsrsbh()); |
|
|
|
|
//校验
|
|
|
|
|
ValidateUtils.validate(invoiceDeliveryDTO); |
|
|
|
|
ValidateUtils.validate(dtos); |
|
|
|
|
InvoiceDelivery invoiceDelivery = new InvoiceDelivery(); |
|
|
|
|
for (InvoiceDeliveryJsonDataDTO dto : dtos) { |
|
|
|
|
invoiceDeliveryDTO.setJsonData(dto); |
|
|
|
|
ValidateUtils.validate(invoiceDeliveryDTO); |
|
|
|
|
//发送请求获取结果
|
|
|
|
|
JSONObject result = null; |
|
|
|
|
try { |
|
|
|
@ -99,40 +99,34 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService { |
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
//封装调用日志
|
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
allApiLog.setUrl(WebServiceConstant.INVOIVEDELIVERY); |
|
|
|
|
allApiLog.setSendMsg(invoiceDeliveryDTO.toString()); |
|
|
|
|
allApiLog.setResultMsg(JSONUtil.toJsonStr(result)); |
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
//封装实体类
|
|
|
|
|
BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery); |
|
|
|
|
invoiceDelivery.setJflx(dto.getJflx()); |
|
|
|
|
invoiceDelivery.setFphm(dto.getFphm()); |
|
|
|
|
invoiceDelivery.setGmflxdh(dto.getGmflxdh()); |
|
|
|
|
invoiceDelivery.setGmfyx(dto.getGmfyx()); |
|
|
|
|
invoiceDelivery.setType("1"); |
|
|
|
|
invoiceDelivery.setClerk(sysUser.getUserId()); |
|
|
|
|
invoiceDelivery.setCreateTime(new Date()); |
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
//存入调用日志表
|
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
allApiLog.setUrl(WebServiceConstant.INVOIVEDELIVERY); |
|
|
|
|
allApiLog.setSendMsg(invoiceDeliveryDTO.toString()); |
|
|
|
|
allApiLog.setResultMsg(JSONUtil.toJsonStr(result)); |
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
//封装实体类
|
|
|
|
|
BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery); |
|
|
|
|
invoiceDelivery.setJflx(dto.getJflx()); |
|
|
|
|
invoiceDelivery.setFphm(dto.getFphm()); |
|
|
|
|
invoiceDelivery.setGmflxdh(dto.getGmflxdh()); |
|
|
|
|
invoiceDelivery.setGmfyx(dto.getGmfyx()); |
|
|
|
|
invoiceDelivery.setStatus("0"); |
|
|
|
|
invoiceDelivery.setType("1"); |
|
|
|
|
invoiceDelivery.setClerk(sysUser.getUserId()); |
|
|
|
|
invoiceDelivery.setCreateTime(new Date()); |
|
|
|
|
//将数据存入业务表
|
|
|
|
|
invoiceDelivery.setStatus("0"); |
|
|
|
|
invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery); |
|
|
|
|
} else { |
|
|
|
|
//封装实体类
|
|
|
|
|
BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery); |
|
|
|
|
invoiceDelivery.setJflx(dto.getJflx()); |
|
|
|
|
invoiceDelivery.setFphm(dto.getFphm()); |
|
|
|
|
invoiceDelivery.setGmflxdh(dto.getGmflxdh()); |
|
|
|
|
invoiceDelivery.setGmfyx(dto.getGmfyx()); |
|
|
|
|
invoiceDelivery.setStatus("1"); |
|
|
|
|
invoiceDelivery.setType("1"); |
|
|
|
|
invoiceDelivery.setClerk(sysUser.getUserId()); |
|
|
|
|
invoiceDelivery.setCreateTime(new Date()); |
|
|
|
|
//存入日志调用表
|
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
//将数据存入业务表
|
|
|
|
|
invoiceDelivery.setStatus("1"); |
|
|
|
|
invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery); |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|