ariesy 主流程初版代码提交 v1

release
yefei 2 years ago
parent 35608d9ad6
commit 434c712ba6
  1. 256
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java
  2. 82
      dxhy-erp/src/main/java/com/dxhy/erp/dao/AreaDao.java
  3. 201
      dxhy-erp/src/main/java/com/dxhy/erp/dao/OrgUserInfoDao.java
  4. 43
      dxhy-erp/src/main/java/com/dxhy/erp/entity/ServiceResult.java
  5. 84
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/BxwxEnterpriseUserEntity.java
  6. 68
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/InvoiceDetail.java
  7. 67
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/InvoiceFile.java
  8. 592
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/InvoiceInfo.java
  9. 370
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/InvoiceUpdate.java
  10. 239
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/OrgUserInfo.java
  11. 20
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/Page.java
  12. 133
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/SAPInvoiceDetail.java
  13. 458
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/SAPInvoiceInfo.java
  14. 332
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/SNInvoice.java
  15. 78
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/SNInvoiceDetail.java
  16. 26
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/SNRequestObject.java
  17. 66
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/SNSAPObject.java
  18. 49
      dxhy-erp/src/main/java/com/dxhy/erp/entity/sdny/area/Area.java
  19. 378
      dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java
  20. 28
      dxhy-erp/src/main/java/com/dxhy/erp/utils/AbstractServiceAdapter.java
  21. 502
      dxhy-erp/src/main/java/com/dxhy/erp/utils/CommonEnum.java
  22. 309
      dxhy-erp/src/main/java/com/dxhy/erp/utils/Constant.java
  23. 43
      dxhy-erp/src/main/java/com/dxhy/erp/utils/ServiceResult.java
  24. 82
      dxhy-erp/src/main/resources/mapper/AreaDao.xml
  25. 378
      dxhy-erp/src/main/resources/mapper/OrgUserInfoDao.xml

@ -1,16 +1,19 @@
package com.dxhy.erp.controller;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.common.aspect.SysLog;
import com.dxhy.common.constant.CommonConstants;
import com.dxhy.common.controller.AbstractController;
import com.dxhy.common.enums.FplxEnum;
import com.dxhy.common.enums.SNFplxEnum;
import com.dxhy.common.util.InvoiceUtil;
import com.dxhy.common.util.UserInfoUtil;
import com.dxhy.common.utils.R;
import com.dxhy.erp.entity.sdny.*;
import com.dxhy.erp.service.InvoiceQueryService;
import com.dxhy.erp.service.SNPushCheckRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -18,6 +21,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -34,18 +40,8 @@ public class SDNYMainProcessController extends AbstractController {
@Resource
private InvoiceQueryService invoiceQueryService;
@Value("${ftp.connection.size}")
private String size;
/**
* 上传时本地文件暂存路径
*/
@Value("${ftp.connection.tempPath}")
private String tempPath;
/**
* 上传时本地文件存放路径
*/
@Value("${ftp.connection.depositPath}")
private String depositPath;
@Resource
private SNPushCheckRecordService snPushCheckRecordService;
/**
* 查验发票
@ -72,6 +68,7 @@ public class SDNYMainProcessController extends AbstractController {
InvoiceUtil iu = new InvoiceUtil(pramsMap.get("invoiceCode"));
String fplxdm = iu.getFplxdm();
if (pramsMap.get("invoiceCode").isEmpty()) {
@ -96,11 +93,11 @@ public class SDNYMainProcessController extends AbstractController {
}
if (FplxEnum.ZP.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.JDC.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.DZZP.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.ESC.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.QDZZP.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.QDPP.getFplxDm().equals(pramsMap.get("invoiceType"))) {
|| FplxEnum.JDC.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.DZZP.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.ESC.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.QDZZP.getFplxDm().equals(pramsMap.get("invoiceType"))
|| FplxEnum.QDPP.getFplxDm().equals(pramsMap.get("invoiceType"))) {
if (pramsMap.get("totalAmount").isEmpty()) {
return ResponseEntity.ok(R.error("金额不能为空!"));
}
@ -115,14 +112,225 @@ public class SDNYMainProcessController extends AbstractController {
if (notes != null) {
return ResponseEntity.ok(R.error(notes));
}
JSONObject checkInvoiceResult = null;
if (SNFplxEnum.ZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.JDC.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.PP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.DZZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.DZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.JSP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.TXF.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.ESC.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.QDZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
) {
//查验发票数据
checkInvoiceResult = snPushCheckRecordService.checkInvoice(pramsMap, getUserInfo());
}else{
//价税分离
try {
return ResponseEntity.ok(R.ok().put("data", invoiceQueryService.smQueryInvoice(pramsMap)));
} catch (Exception e) {
e.printStackTrace();
log.error("", e);
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
}
return ResponseEntity.ok(R.ok().put("data", checkInvoiceResult));
}
/**
* 查验发票
*/
@PostMapping("/sn/syncInvoiceInfo")
@ResponseBody
@SysLog("同步发票信息")
public ResponseEntity<?> syncInvoiceInfo(@RequestBody SNRequestObject snRequestObject) {
// 入参统一在入口处理
String userid = getLoginName();
String dbName = getUserInfo().getDbName();
String company = getUserInfo().getCompany();
List<String> gfshAll = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
//String notes = invoiceQueryService.checkingInvoiceInfo(dbName, uuid, getUserInfo());
//入票池
//推送到SAP
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList();
String imageId = snRequestObject.getImageId();
for(SNInvoice invoice : invoiceInfoList) {
SNSAPObject object = convertToSapOnject(invoice,imageId);
JSONObject sapObj = (JSONObject) JSONObject.toJSON(object);
String result = "";
try {
//将信息推送到影像系统
result = snPushCheckRecordService.pushCheckResultToSAP(sapObj);
return ResponseEntity.ok(R.ok().put("data", result));
} catch (Exception e) {
e.printStackTrace();
log.error("", e);
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
}
}
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
}
private SNSAPObject convertToSapOnject(SNInvoice snInvoice,String imageId) {
Date date = new Date();
SNSAPObject object = new SNSAPObject();
object.setSYSID("JS");
object.setIFYWID("FI845");
object.setBSKEY("a77a8ba6c0dc45cd9e88972fb4750f93");
object.setSAPKEY("");
object.setZORG("");
object.setZFILED1("");
object.setZFILED2("");
object.setZFILED3("");
object.setZFILED4("");
object.setZFILED5("800");
List<SAPInvoiceInfo> sapInvoiceInfos = new ArrayList<>();
SAPInvoiceInfo info = new SAPInvoiceInfo();
info.setZBAZT("0");
info.setZXFSH(snInvoice.getSalesTaxNo());
info.setZJDDM("");
info.setZJDHM("");
info.setZFPSZD(snInvoice.getPlace());
info.setZXFBM("");
info.setZSPMC(snInvoice.getDraweeName());
info.setZSPSBH(snInvoice.getDraweeTaxNo());
info.setZCJR("");
info.setZCYJG(snInvoice.getCheckResultMessage());
info.setZJKZM(snInvoice.getImportCertificateNo());
info.setZDJZH(snInvoice.getCertificateNo());
info.setZGFMC(snInvoice.getPurchaserName());
BigDecimal total = new BigDecimal(snInvoice.getTotalAmount());
BigDecimal tax = new BigDecimal(snInvoice.getTotalTax());
BigDecimal subtract = total.subtract(tax);
info.setZJK(subtract.toString());
info.setZSCSJ(date);
info.setZCYZT(snInvoice.getCheckStaus());
info.setZYSHW(snInvoice.getCargoInformation());
info.setZFPLX(snInvoice.getInvoiceType());
info.setZFU("");
info.setZQYD(snInvoice.getTransportRoute());
info.setZCCRXM(snInvoice.getRiderName());
info.setZKPRQ(snInvoice.getBillingDate());
info.setZSLT("");
info.setZYWZT("");
info.setZSE(snInvoice.getTotalTax());
info.setZTXBZ(snInvoice.getTollSign());
info.setZYHM("");
info.setZSKPH(snInvoice.getMachineCode());
info.setZGFZH(snInvoice.getPurchaserBank());
info.setZBZ(snInvoice.getRemarks());
List<SNInvoiceDetail> invoiceLineList = snInvoice.getInvoiceLineList();
List<SAPInvoiceDetail> sapInvoiceDetailList = new ArrayList<>();
if(invoiceLineList != null && invoiceLineList.size() > 0){
SNInvoiceDetail snInvoiceDetail = invoiceLineList.get(0);
String taxRate = snInvoiceDetail.getTaxRate();
info.setZSM(taxRate);
info.setZTAX(taxRate);
SAPInvoiceDetail sapInvoiceDetail = new SAPInvoiceDetail();
sapInvoiceDetail.setZZWDJ("");
sapInvoiceDetail.setIMG_ID(imageId);
sapInvoiceDetail.setZCPH(snInvoiceDetail.getLicensePlateNum());
sapInvoiceDetail.setZCJSJ("");
sapInvoiceDetail.setZCJRQ("");
sapInvoiceDetail.setZCFZ(snInvoice.getStationGetOn());
sapInvoiceDetail.setZTXZ(snInvoiceDetail.getCurrentDateEnd());
sapInvoiceDetail.setZTXQ(snInvoiceDetail.getCurrentDateStart());
sapInvoiceDetail.setZJK(snInvoiceDetail.getAmount());
sapInvoiceDetail.setZHH(snInvoiceDetail.getRowNo());
sapInvoiceDetail.setZTAX(snInvoiceDetail.getTaxRate());
sapInvoiceDetail.setZHBH("");
sapInvoiceDetail.setZDJ(snInvoiceDetail.getUnitPrice());
sapInvoiceDetail.setZHID("");
sapInvoiceDetail.setZDDZ(snInvoice.getStationGetOff());
sapInvoiceDetail.setZHWMC(snInvoiceDetail.getCommodityName());
sapInvoiceDetail.setZCYR(info.getZCYRMC());
sapInvoiceDetail.setZDW(snInvoiceDetail.getUnit());
sapInvoiceDetail.setZGSJBM(snInvoiceDetail.getCommodityCode());
sapInvoiceDetail.setZSE(snInvoiceDetail.getTax());
sapInvoiceDetail.setZSL(snInvoiceDetail.getQuantity());
sapInvoiceDetail.setZSM(info.getZSM());
sapInvoiceDetail.setZGGXH(snInvoiceDetail.getSpecificationModel());
sapInvoiceDetail.setZTID("");
sapInvoiceDetailList.add(sapInvoiceDetail);
}
info.setIT_ITEM(sapInvoiceDetailList);
info.setZFPDM(snInvoice.getInvoiceCode());
info.setZCD(snInvoice.getOriginPlace());
info.setZSCCZ(snInvoice.getStationGetOn());
info.setZCC(snInvoice.getTrainNumber());
info.setZFPHM(snInvoice.getInvoiceNumber());
info.setZBXF(snInvoice.getInsurance());
info.setZRYFJ(snInvoice.getFuelSurcharge());
info.setZCLSB(snInvoice.getVehicleNo());
info.setZKPSJ(snInvoice.getBillingDate());
info.setZXCSJ(date);
info.setZXFMC(snInvoice.getSalesName());
info.setZCYRSBH(snInvoice.getCarrierName());
info.setIMG_ID(imageId);
info.setZCPH(snInvoice.getLicensePlate());
info.setZLSLBZ(snInvoice.getZeroTaxRateSign());
info.setZCJSJ(date);
info.setZFPZT(snInvoice.getState());
info.setZESCSC("");
info.setZFDJM(snInvoice.getEngineNo());
info.setZGXR("");
//认证相关
info.setZRZJG("");
info.setZRZSSQ("");
info.setZRZMS("");
info.setZRZRQ("");
info.setZLC(snInvoice.getMileage());
info.setZHGZH(snInvoice.getCertificateNo());
info.setZXFDH(snInvoice.getSalesAddressPhone());
info.setZESCSH("");
info.setZGSDM("BG90");
info.setZGFSH(snInvoice.getPurchaserTaxNo());
info.setZXCRS(snInvoice.getPassengersLimited());
info.setZWSPZ(snInvoice.getPaymentVoucherNo());
info.setZCCDW(snInvoice.getTonnage());
info.setZSWJG(snInvoice.getTaxAuthorityNo());
info.setZYWDJ("");
info.setZXCCZ(snInvoice.getStationGetOff());
info.setZCCRZH(snInvoice.getIdcardNo());
info.setZCPXH(snInvoice.getBrandModel());
info.setZMHFZJJ(snInvoice.getCaacDevelopmentFund());
info.setZGFDH(snInvoice.getPurchaserAddressPhone());
info.setZXFZH(snInvoice.getSalesBank());
info.setZJYM(snInvoice.getCheckCode());
info.setZSJDH(snInvoice.getInspectionListNo());
info.setZYGC("");
info.setZJSHJ(snInvoice.getAmountTax());
info.setZCYRMC(snInvoice.getCarrierName());
info.setZJGDM(snInvoice.getAdministrativeDivisionNo());
info.setZGXSJ(date);
info.setZQM("opentext");
info.setZPJLY(snInvoice.getSource());
info.setZZWLX(snInvoice.getSeat());
info.setZTID("");
sapInvoiceInfos.add(info);
object.setZDATA(sapInvoiceInfos);
return object;
}
}

@ -0,0 +1,82 @@
package com.dxhy.erp.dao;
import com.dxhy.erp.entity.sdny.area.Area;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 地区配置Dao
*
* @author 大象慧云shanQing
* @since 2017-10-23 16:31:10
*/
@Repository
public interface AreaDao {
/**
* 新增区域信息
*
* @param area 区域对象
* @return
*/
int addArea(Area area);
/**
* 根据id删除该区域信息
*
* @param id
* @return
*/
int deleteAreaById(@Param("id") Long id);
/**
* 更新区域名称
*
* @param area 区域对象
* @return
*/
int updateAreaName(Area area);
/**
* 根据pid获取该区域信息
*
* @param pid
* @return
*/
List<Area> getAreaListByPid(@Param("pid") Long pid);
/**
* 根据id获取该区域信息
*
* @param id
* @return
*/
Area getAreaById(@Param("id") Long id);
/**
* 根据区域名称查询
*
* @param areaName 区域名称
* @return
*/
List<Area> queryAreaByName(@Param("areaName") String areaName);
/**
* 查询所有地区
*
* @return
*/
List<Area> getAllAreaList();
/**
* 获取区块链发票对应所有省市
*
* @return
*/
List<Area> getBlockChainProviceList();
}

@ -0,0 +1,201 @@
package com.dxhy.erp.dao;
import com.dxhy.erp.entity.sdny.BxwxEnterpriseUserEntity;
import com.dxhy.erp.entity.sdny.OrgUserInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Optional;
/**
* 员工信息
*
* @author guoker
* @date 2020-12-29
*/
public interface OrgUserInfoDao {
/**
* 新增员工信息
*
* @param orgUserInfoList
* @return
*/
int addUserInfoList(@Param("orgUserInfoList") List<OrgUserInfo> orgUserInfoList);
/**
* 删除员工信息
*
* @param orgUserInfo
* @return
*/
int deleteUserInfo(@Param("orgUserInfo") OrgUserInfo orgUserInfo);
/**
* 更新员工信息可批量
*
* @param orgUserInfoList
* @return
*/
int updateUserInfo(@Param("orgUserInfoList") List<OrgUserInfo> orgUserInfoList);
/**
* 查询员工信息
*
* @param userId
* @param enterpriseId
* @param taxNo
* @param identityNumber
* @param userName
* @param isWhiteList
* @param email
* @return
*/
List<OrgUserInfo> getUserInfoList(@Param("userId") String userId,
@Param("enterpriseId") String enterpriseId,
@Param("taxNo") String taxNo,
@Param("identityNumber") String identityNumber,
@Param("userName") String userName,
@Param("isWhiteList") String isWhiteList,
@Param("email") String email
);
/**
* 身份证号模糊匹配
*
* @param identityNumber
* @param userName
* @param enterpriseId
* @return
*/
List<OrgUserInfo> getUserIdentityNumber(@Param("identityNumber") String identityNumber, @Param("userName") String userName, @Param("enterpriseId") String enterpriseId);
/**
* 身份证号精确匹配统计
*
* @param identityNumber
* @param userName
* @param enterpriseId
* @return
*/
int countUserByIdentityNumber(@Param("identityNumber") String identityNumber, @Param("userName") String userName, @Param("enterpriseId") String enterpriseId);
/**
* 根据用户姓名身份证号码后六位查询完整身份证号码
*
* @param userName
* @param fourId
* @param enterpriseId
* @return
*/
String getIdentityNumberByNameAndFourId(@Param("userName") String userName, @Param("fourID") String fourId, @Param("enterpriseId") String enterpriseId);
/**
* 查询总条数
*
* @param orgUserInfo
* @return
*/
int selectCount(@Param("orgUserInfo") OrgUserInfo orgUserInfo);
/**
* 根据类型查询用户集合
*
* @param orgUserInfo
* @param page
* @param rows
* @return
*/
List<OrgUserInfo> selectWhiteByParam(@Param("orgUserInfo") OrgUserInfo orgUserInfo, @Param("page") int page, @Param("rows") int rows);
/**
* 修改
*
* @param orgUserInfo
* @return
*/
int updateWhiteUserById(OrgUserInfo orgUserInfo);
/**
* 修改用户白名单状态
*
* @param id
* @return
*/
int disableWhiteById(@Param("id") String id);
/**
* 修改用户授权状态
*
* @param userId
* @param authStatus
* @return
*/
int updateAuthstatus(@Param("userId") String userId, @Param("authStatus") String authStatus);
/**
* 获取所有白名单用户数据
*
* @return
*/
List<OrgUserInfo> getAllUserInfoList();
/**
* 根据id更新微信公众号同步标识
*
* @param idList
* @return
*/
int batchUpdateEnterpriseUserList(List<String> idList);
/**
* 根据id更新微信公众号同步标识和唯一标识id
*
* @param bxwxEnterpriseUserEntityList
* @return
*/
int batchUpdateEnterpriseUserListById(List<BxwxEnterpriseUserEntity> bxwxEnterpriseUserEntityList);
/**
* 新增用户
*
* @param orgUserInfo
* @return
*/
int saveUserInfo( OrgUserInfo orgUserInfo);
/**
* 更新用户
*
* @param orgUserInfo
* @return
*/
int updateUserInfoSingle( OrgUserInfo orgUserInfo);
/**
* 查询员工
*
* @param userName
* @param isWhiteList
* @return
*/
List<OrgUserInfo> getUserInfoListByIsWhile( @Param("userName") String userName, @Param("isWhiteList") String isWhiteList);
/**
* 根据用户名查询用户信息精确查询
*
* @param userName
* @return
*/
List<OrgUserInfo> queryUserListByUserName(@Param("userName") String userName);
/**
* 根据userId查询用户是否存在
* @param userId userId
* @return
*/
Optional<OrgUserInfo> findByCondition(@Param("userId")String userId);
}

@ -0,0 +1,43 @@
package com.dxhy.erp.entity;
/**
* @author guoker
* @date 2020-12-30
*/
public class ServiceResult<T> {
private boolean result = false;
private String msg;
private T data;
public boolean getResult() {
return this.result;
}
public ServiceResult<T> setResult(boolean result) {
this.result = result;
return this;
}
public String getMsg() {
return this.msg;
}
public ServiceResult<T> setMsg(String msg) {
this.msg = msg;
return this;
}
public T getData() {
return this.data;
}
public ServiceResult<T> setData(T data) {
this.data = data;
return this;
}
@Override
public String toString() {
return "ServiceResult{result=" + this.result + ", message='" + this.msg + '\'' + ", data=" + this.data + '}';
}
}

@ -0,0 +1,84 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
/**
* 微信企业用户表同步
* @author guoker
* @date 2020-09-23 16:09:30
*/
@Data
public class BxwxEnterpriseUserEntity {
private String id;
private String userId;
private String userName;
private String password;
private String phone;
private String email;
/**
* 员工身份证号
*/
private String identityNumber;
/**
* 证件类型(0身份证 9其它证件)
*/
private String identityType;
/**
* 企业ID
*/
private String enterpriseId;
/**
* 是否白名单用户(Y/N)
*/
private String isWhiteList;
/**
* 可报企业代码集合串
*/
private String enterpriseCodeList;
/**
* 可报销企业名称集合串
*/
private String enterpriseName;
/**
* 是否有效(0无 1有)
*/
private String isValid;
/**
* 客户端用户id
*/
private String clientUserId;
/**
* 备注
*/
private String remark;
/**
* 逻辑删除标记(0显示1隐藏)
*/
private String delFlag;
/**
* 企业标识
*/
private String enterpriseFlag;
/**
* 同步过来的唯一id用来区分userId是否变化
*/
private String syncOnlyId;
}

@ -0,0 +1,68 @@
package com.dxhy.erp.entity.sdny;
import com.dxhy.erp.entity.BasePojo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author CCJ
* @version 创建时间2017年2月25日
* @explain 说明:电子底账明细
*/
@Data
public class InvoiceDetail extends BasePojo {
/**
* 发票详情
*/
private static final long serialVersionUID = 1L;
/**
* id
*/
private Long id;
/**
* 发票代码
*/
private String invoiceCode;
/**
* 发票号码
*/
private String invoiceNo;
/**
* 货物或应税劳务服务名称
*/
private String goodsName;
/**
* 规格型号
*/
private String model;
/**
* 单位
*/
private String unit;
/**
* 发票编号
*/
private String uuid;
/**
* 数量
*/
private double num;
/**
* 单价
*/
private BigDecimal unitPrice;
/**
* 金额
*/
private BigDecimal noTaxAmount;
/**
* 税率
*/
private String taxRate;
/**
* 税额
*/
private BigDecimal taxAmount;
}

@ -0,0 +1,67 @@
package com.dxhy.erp.entity.sdny;
import com.dxhy.erp.entity.BasePojo;
import lombok.Data;
/**
* @author guoker
* @date 2020-12-28
*/
@Data
public class InvoiceFile extends BasePojo {
private static final long serialVersionUID = 1L;
private String id;
/**
* uuid发票唯一索引
*/
private String uuid;
/**
* 文件名称
*/
private String fileName;
/**
* 文件存储地址
*/
private String filePath;
/**
* 文件类型
*/
private String fileType;
/**
* 是否源文件
*/
private String isSourceFile;
/**
* 创建时间
*/
private String createTime;
/**
* 创建人ID
*/
private String createUserId;
/**
* 创建人名称
*/
private String createUserName;
/**
* 是否预览可预览为true,否则为false
*/
private boolean previewFlag;
/**
* 预览限制大小超过就提示
*/
private String previewLimitSize;
}

@ -0,0 +1,592 @@
package com.dxhy.erp.entity.sdny;
import cn.hutool.core.date.DateUtil;
import com.dxhy.erp.entity.BasePojo;
import com.dxhy.erp.utils.CommonEnum;
import com.google.common.base.Strings;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author guoker
* @date 2020-12-28
*/
@Data
public class InvoiceInfo extends BasePojo {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private String id;
/**
* 用户Id
*/
private String userId;
/**
* 用户名称
*/
private String userName;
/**
* 企业id
*/
private String enterpriseId;
/**
* 报销一级科目代码
*/
private String subject1stCode;
/**
* 报销二级科目代码
*/
private String subject2ndCode;
/**
* 购买方名称
*/
private String buyerName;
/**
* 纳税人识别号
*/
private String buyerTaxNo;
/**
* 购买方电话
*/
private String buyerAddressTel;
/**
* 购买方开户账号
*/
private String buyerBankAccount;
/**
* 销售方名称
*/
private String salerName;
/**
* 销售方纳税人识别号
*/
private String salerTaxNo;
/**
* 销售方电话
*/
private String salerAddressTel;
/**
* 销售方开户账号
*/
private String salerBankAccount;
/**
* 发票类型
*/
private String invoiceTypeCode;
/**
* 发票类型名称
*/
private String invoiceTypeName;
/**
* 发票代码
*/
private String invoiceCode;
/**
* 发票号码
*/
private String invoiceNo;
/**
* 开票日期
*/
private Date invoiceDate;
/**
* 开票日期
*/
private String invoiceDateStr;
/**
* 入库时间
*/
private Date createTime;
/**
* 合计金额
*/
private BigDecimal invoiceAmount;
/**
* 合计税额
*/
private BigDecimal taxAmount;
/**
* 价税合计
*/
private BigDecimal totalAmount;
/**
* 开票类型1-蓝票2-红票
*/
private String kplx;
/**
* 作废标志
*/
private String isCanceled;
/**
* 冲红标志
*/
private String isBlush;
/**
* 是否勾选
*/
private int isCheck;
/**
* 报销状态
*/
private String reimburseState;
/**
* 报销流水号
*/
private String reimburseSerialNo;
/**
* 报销人
*/
private String reimburseUserId;
/**
* 交易流水号
*/
private String tradeSerialNo;
/**
* 单据名称
*/
private String billName;
/**
* 交易流水号
*/
private Date billDate;
/**
* 交易流水号
*/
private String billDateStr;
/**
* 费用类别编码
*/
private String expenseType;
/**
* 查验状态
*/
private String checkState;
/**
* 机器编号
*/
private String machineNo;
/**
* 校验码
*/
private String verifyCode;
/**
* 密码区
*/
private String passwordArea;
/**
* 备注
*/
private String remark;
/**
* 收款人
*/
private String receiver;
/**
* 复核人
*/
private String reviewer;
/**
* 开票人
*/
private String drawer;
/**
* 是否异常
*/
private String isException;
/**
* 发票类别
*/
private String fplb;
/**
* 数据来源 100公用机图片 101个人pc上传图片 102个人pc上传pdf
*/
private String dataSourceCode;
/**
* uuid 发票唯一索引
*/
private String uuid;
/**
* 发票第一条明细
*/
private String goodsName;
/**
* 出发城市
*/
private String departCity;
/**
* 到达城市
*/
private String arriveCity;
/**
* 车次
*/
private String trainNumber;
/**
* 乘车人
*/
private String passenger;
/**
* 座位等级
*/
private String seatLevel;
/**
* 身份证号
*/
private String identityNumber;
/**
* 电子客票号码
*/
private String electronicTicketNumber;
/**
* 填开单位
*/
private String issueBy;
/**
* 填开时间
*/
private String dateOfIssue;
/**
* 航班号
*/
private String flightNumber;
/**
* 附件张数
*/
private String invoiceCount;
/**
* 税率
*/
private String taxRate;
/**
* 是否可抵扣
*/
private String isDeductible;
/**
* 发票联次
*/
private String invoiceSheet;
/**
* 发票明细
*/
private List<InvoiceDetail> detailList;
/**
* 是否电票
*/
private String isEInvoice;
/**
* 起始时间
*/
private Date startDate;
/**
* 终止时间
*/
private Date endDate;
/**
* 发票图片地址
*/
private String picUrlSimple;
/**
* 图片地址
*/
private String imagePath;
/**
* 票价
*/
private String fare;
/**
* 民航发展基金
*/
private String caacDevelopmentFund;
/**
* 燃油附加费
*/
private String fuelSurcharge;
/**
* 是否有公司印章 1 0
*/
private String isCompanySeal;
/**
* 报销备注
*/
private String reimbursementNote;
/**
* 是否为OCR返回结果 Y/N
*/
private String isOcrResult;
/**
* 是否有原文件1是0否
*/
private String haveSourceFile;
/**
* 币种编码
*/
private String currencyCode;
/**
* 币种名称
*/
private String currencyName;
private String invoiceDetailInfo;
/**
* 机打代码
*/
private String printInvoiceCode;
/**
* 机打号码
*/
private String printInvoiceNo;
/**
* 序号
*/
private String number;
/**
* 文件名
*/
private String fileName;
/**
* 文件路径
*/
private String filePath;
/**
* 其他税项金额字段-可以编辑
*/
private String otherTaxAmount;
/**
* 可抵扣税额
*/
private BigDecimal deductTaxAmount;
/**
* 缴款单位税号双抬头
*/
private String twoBuyerTaxNo;
/**
* 缴款单位名称双抬头
*/
private String twoBuyerName;
/**
* 车辆类型
*/
private String vehicleType;
/**
* 厂牌型号
*/
private String bandModel;
/**
* 产地 机动车
*/
private String produceArea;
/**
* 合格证书
*/
private String qualifiedNo;
/**
* 商检单号
*/
private String commodityInspectionNo;
/**
* 发动机号
*/
private String engineNo;
/**
* 车辆识别号(车架号)
*/
private String vehicleIdentificationNo;
/**
* 进口证明书号
*/
private String certificateOfImport;
/**
* 主管税务机关代码 机动车
*/
private String taxAuthorityCode;
/**
* 完税凭证码 机动车
*/
private String taxPaymentCertificateNo;
/**
* 限乘人数 机动车
*/
private String limitedPeopleCount;
/**
* 主管税务机关名称 机动车
*/
private String taxAuthorityName;
/**
* 吨位 机动车
*/
private String tonnage;
/**
* 微信卡包标识1微信卡包2企业微信卡包
*/
private String wechatPackageStatus;
/**
* 飞机-----保险费
*/
private String insurance;
/**
* 区块链-查验-地区名称
*/
private String blockAreaName;
/**
* 区块链-是否可以查验
*/
private String isCheckBlockChain;
public static InvoiceInfo getInvInfoInstance(InvoiceUpdate data, String dataSourceCode){
InvoiceInfo invoiceInfo = new InvoiceInfo();
BeanUtils.copyProperties(data, invoiceInfo);
invoiceInfo.setTotalAmount(data.getTotalAmount() == null
|| "".equals(data.getTotalAmount()) ? null : new BigDecimal(data.getTotalAmount()));
if(StringUtils.isNotEmpty(data.getInvoiceDate())){
invoiceInfo.setInvoiceDate(DateUtil.parse(data.getInvoiceDate(),"yyyyMMdd"));
}
invoiceInfo.setReimburseState(CommonEnum.ZERO_STR);
invoiceInfo.setDataSourceCode(dataSourceCode);
invoiceInfo.setInvoiceAmount(data.getInvoiceAmount() == null
|| "".equals(data.getInvoiceAmount()) ? null : new BigDecimal(data.getInvoiceAmount()));
invoiceInfo.setIsBlush(CommonEnum.ZERO_STR);
invoiceInfo.setCheckState(CommonEnum.ZERO_STR);
invoiceInfo.setStartDate(Strings.isNullOrEmpty(data.getStartDate()) ? null :
strToDate(data.getStartDate()));
invoiceInfo.setEndDate(Strings.isNullOrEmpty(data.getEndDate()) ? null :
strToDate(data.getEndDate()));
String fplx = data.getInvoiceTypeCode();
if (CommonEnum.INV_ZZS_PAPER_PP.equals(fplx)) {
// 电子发票
invoiceInfo.setFplb(CommonEnum.ZERO_STR);
} else {
// 纸质发票
invoiceInfo.setFplb(CommonEnum.ONE_STR);
}
return invoiceInfo;
}
private static Date strToDate(String str) {
try {
if (!Strings.isNullOrEmpty(str)) {
if (str.length() == CommonEnum.EIGHT) {
return new SimpleDateFormat("yyyyMMdd").parse(str);
} else {
return new SimpleDateFormat("yyyyMMddHHmmss").parse(str);
}
}
return null;
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
}

@ -0,0 +1,370 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 发票更新
*
* @author yaoxj
* @time 2017年10月30日上午10:14:03
*/
@Data
public class InvoiceUpdate {
/**
* 企业id
*/
private String enterpriseId;
/**
* id:必填
*/
private String userId;
/**
* uuid必填
*/
private String uuid;
/**
* 发票类型必填
*/
private String invoiceTypeCode;
/**
* 发票代码
*/
private String invoiceCode;
/**
* 发票号码
*/
private String invoiceNo;
/**
* 开票日期必填
*/
private String invoiceDate;
/**
* 校验码
*/
private String verifyCode;
/**
* 购买方名称
*/
private String buyerName;
/**
* 是否查验必填
*/
private String isCheck;
/**
* 查验状态
*/
private String checkState;
/**
* 发票明细第一条
*/
private String invoiceDetail;
/**
* 价税合计必填
*/
private String totalAmount;
/**
* 合计金额
*/
private String invoiceAmount;
/**
* 销售方名称
*/
private String salerName;
/**
* 备注
*/
private String remark;
/**
* 出发城市
*/
private String departCity;
/**
* 到达城市
*/
private String arriveCity;
/**
* 车次
*/
private String trainNumber;
/**
* 附件张数必填
*/
private String invoiceCount;
/**
* 报销单提交人用户编号
*/
private String expenseUserNo;
/**
* 发票主键ID
*/
private String invoiceId;
/**
* 起始时间
*/
private String startDate;
/**
* 结束时间
*/
private String endDate;
/**
* 身份证号
*/
private String identityNumber;
/**
* 乘车人
*/
private String passenger;
/**
* 航班号
*/
private String flightNumber;
/**
* 填开时间
*/
private String dateOfIssue;
/**
* 票价
*/
private String fare;
/**
* 民航发展基金
*/
private String caacDevelopmentFund;
/**
* 燃油附加费
*/
private String fuelSurcharge;
/**
* 报销备注
*/
private String reimbursementNote;
/**
* 是否可抵扣
*/
private String isDeductible;
/**
* 座位等级
*/
private String seatLevel;
/**
* 是否有公司印章 1 0
*/
private String isCompanySeal;
/**
* 是否为OCR返回结果 Y/N
*/
private String isOcrResult;
/**
* 税率
*/
private String taxRate;
/**
* 合计税额
*/
private BigDecimal taxAmount;
/**
* 电子客票号码
*/
private String electronicTicketNumber;
/**
* 报销单据状态
*/
private String reimburseState;
/**
* 明细
*/
private List<InvoiceDetail> detailList;
/**
* 源文件
*/
private InvoiceFile sourceFile;
/**
* 币种编码
*/
private String currencyCode;
/**
* 点击票夹详情如果为非增值税票修改为增值税票查验保存保存的时候把该值传到后台把原来的发票删除
*/
private String oldUpdateId;
/**
* 币种名称
*/
private String currencyName;
/**
* 发票联次
*/
private String invoiceSheet;
/**
* 过路过桥 发票详情
*/
private String invoiceDetailInfo;
private String ocrSalerTaxNo;
private String ocrTotalAmount;
private String buyerTaxNo;
private String buyerAddressTel;
private String buyerBankAccount;
private String salerTaxNo;
private String salerAddressTel;
private String salerBankAccount;
private String isCanceled;
/**
* 其他税项金额字段-可以编辑
*/
private String otherTaxAmount;
/**
* 可抵扣税额
*/
private BigDecimal deductTaxAmount;
/**
* 缴款单位税号双抬头
*/
private String twoBuyerTaxNo;
/**
* 缴款单位名称双抬头
*/
private String twoBuyerName;
/**
* 扫一扫标识true为扫一扫
*/
private boolean scanFlag = false;
/**
* 车辆类型
*/
private String vehicleType;
/**
* 厂牌型号
*/
private String bandModel;
/**
* 产地 机动车
*/
private String produceArea;
/**
* 合格证书
*/
private String qualifiedNo;
/**
* 商检单号
*/
private String commodityInspectionNo;
/**
* 发动机号
*/
private String engineNo;
/**
* 车辆识别号(车架号)
*/
private String vehicleIdentificationNo;
/**
* 进口证明书号
*/
private String certificateOfImport;
/**
* 主管税务机关代码 机动车
*/
private String taxAuthorityCode;
/**
* 完税凭证码 机动车
*/
private String taxPaymentCertificateNo;
/**
* 限乘人数 机动车
*/
private String limitedPeopleCount;
/**
* 主管税务机关名称 机动车
*/
private String taxAuthorityName;
/**
* 吨位 机动车
*/
private String tonnage;
/**
* 微信卡包标识1微信卡包2企业微信卡包
*/
private String wechatPackageStatus;
/**
* 飞机-----保险费
*/
private String insurance;
/**
* 报销用户名
*/
private String userName;
/**
* 区块链-查验-地区名称
*/
private String blockAreaName;
/**
* 区块链-是否可以查验
*/
private String isCheckBlockChain;
/**
* 纸质发票机打发票代码
*/
private String printInvoiceCode;
/**
* 纸质发票机打发票号码
*/
private String printInvoiceNo;
}

@ -0,0 +1,239 @@
package com.dxhy.erp.entity.sdny;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 用户信息
*
* @author guoker
* @date 2020-12-28
*/
@Data
public class OrgUserInfo extends Page implements Serializable {
/**
* 主键ID
*/
private String id;
/**
* 员工ID
*/
private String userId;
/**
* 员工名称
*/
private String userName;
/**
* 员工身份证号
*/
private String identityNumber;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 所属企业ID
*/
private String enterpriseId;
/**
* 税号
*/
private String taxNo;
/**
* 是否白名单 Y/N
*/
private String isWhiteList;
/**
* 可报销企业代码
*/
private String enterpriseCodeList;
/**
* 所属企业名称
*/
private String enterpriseName;
/**
* 邮箱
*/
private String email;
/**
* 是否为第一次授权:1 0否
*/
private String authStatus;
private Integer page;
private Integer size;
/**
* 密码微信公众号登陆
*/
private String password;
/**
* 手机号
*/
private String phone;
/**
* 同步过来的唯一id用来区分userId是否变化
*/
private String syncOnlyId;
/**
* 可报销企业名称
*/
private String enterpriseNameList;
public OrgUserInfo(){
}
public OrgUserInfo(String userId, String enterpriseId, String isWhiteList){
this.userId = userId;
this.enterpriseId = enterpriseId;
this.isWhiteList = isWhiteList;
}
public OrgUserInfo(String userId, String enterpriseId, String identityNumber, String isWhiteList){
this.userId = userId;
this.enterpriseId = enterpriseId;
this.identityNumber = identityNumber;
this.isWhiteList = isWhiteList;
}
public OrgUserInfo(Builder builder){
this.id = builder.id;
this.userName = builder.userName;
this.identityNumber = builder.identityNumber;
this.taxNo = builder.taxNo;
this.enterpriseCodeList = builder.enterpriseCodeList;
this.enterpriseName = builder.enterpriseName;
this.isWhiteList = builder.isWhiteList;
this.email = builder.email;
this.phone = builder.phone;
this.authStatus = builder.authStatus;
this.userId = builder.userId;
this.enterpriseId = builder.enterpriseId;
}
public OrgUserInfo(JSONObject dataJson){
this.userId = String.valueOf(dataJson.get("userId"));
this.userName = String.valueOf(dataJson.get("userName"));
this.email = String.valueOf(dataJson.get("email"));
this.phone = String.valueOf(dataJson.get("mobile"));
this.isWhiteList = "Y";
this.enterpriseId = String.valueOf(dataJson.get("enterpriseId"));
}
@Data
public static class Builder{
/**
* 主键ID
*/
private String id;
/**
* 员工ID
*/
private String userId;
/**
* 员工名称
*/
private String userName;
/**
* 员工身份证号
*/
private String identityNumber;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 企业ID
*/
private String enterpriseId;
/**
* 税号
*/
private String taxNo;
/**
* 是否白名单 Y/N
*/
private String isWhiteList;
/**
* 可报销企业代码
*/
private String enterpriseCodeList;
/**
* 可报销企业名称
*/
private String enterpriseName;
/**
* 邮箱
*/
private String email;
/**
* 是否为第一次授权:1 0否
*/
private String authStatus;
private Integer page;
private Integer size;
// 密码(微信公众号登陆)
private String password;
// 手机号
private String phone;
// 同步过来的唯一id,用来区分userId是否变化
private String syncOnlyId;
public Builder(String userId, String enterpriseId){
this.userId = userId;
this.enterpriseId = enterpriseId;
}
public OrgUserInfo builder(){
return new OrgUserInfo(this);
}
}
}

@ -0,0 +1,20 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
/**
* @author guoker
* @date 2020-12-28
*/
@Data
public class Page {
/**
* 页码
*/
private Integer page;
/**
* 条数
*/
private Integer rows;
}

@ -0,0 +1,133 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
@Data
public class SAPInvoiceDetail {
/**
* 座位等级
*/
private String ZZWDJ = "";
/**
* 影像编码ID
*/
private String IMG_ID = "";
/**
* 车牌号
*/
private String ZCPH = "";
/**
* 乘机时间
*/
private String ZCJSJ = "";
/**
* 乘机
*/
private String ZCJRQ = "";
/**
* 上车车站/入口
*/
private String ZCFZ = "";
/**
*
*/
private String ZTXZ = "";
/**
* 期起
*/
private String ZTXQ = "";
/**
* 价款
*/
private String ZJK = "";
/**
*
*/
private String ZHH = "";
/**
* 税率
*/
private String ZTAX = "";
/**
* 航班号
*/
private String ZHBH = "";
/**
* 单价
*/
private String ZDJ = "";
/**
* ID
*/
private String ZHID = "";
/**
* 下车车站/出口
*/
private String ZDDZ = "";
/**
* 货物或应税劳务名称
*/
private String ZHWMC = "";
/**
* 发票影像编号
*/
private String FPYXBH = "";
/**
* 承运人
*/
private String ZCYR = "";
/**
* 单位
*/
private String ZDW = "";
/**
* 国税局商品编码
*/
private String ZGSJBM = "";
/**
* 税额
*/
private String ZSE = "";
/**
* 数量
*/
private String ZSL = "";
/**
* 税码
*/
private String ZSM = "";
/**
* 规格型号
*/
private String ZGGXH = "";
/**
* 头表ID
*/
private String ZTID = "";
}

@ -0,0 +1,458 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class SAPInvoiceInfo {
/**
* 报账状态
*/
private String ZBAZT = "";
/**
* 销方税号
*/
private String ZXFSH = "";
/**
* 受票识别号
*/
private String ZSPSBH = "";
/**
* 机打代码
*/
private String ZJDDM = "";
/**
* 发票所在地
*/
private String ZFPSZD = "";
/**
* 销方编号
*/
private String ZXFBM = "";
/**
* 机打号码
*/
private String ZJDHM = "";
/**
* 受票名称
*/
private String ZSPMC = "";
/**
* 票据状态
*/
private String ZPJZT = "";
/**
* 创建人
*/
private String ZCJR = "";
/**
* 查验结果描述
*/
private String ZCYJG = "";
/**
* 证明书号
*/
private String ZJKZM = "";
/**
* 登记证号
*/
private String ZDJZH = "";
/**
* 购方名称
*/
private String ZGFMC = "";
/**
* 价款-发票不含税金额
*/
private String ZJK = "";
/**
* 上车时间/行程开始时间
*/
private Date ZSCSJ;
/**
* 查验日期
*/
private Date ZCYRQ;
/**
* 查验状态
*/
private String ZCYZT = "";
/**
* 运输货物信息
*/
private String ZYSHW = "";
/**
* 发票类型
*/
private String ZFPLX = "";
/**
* 图片附件ID
*/
private String ZFU = "";
/**
* 起运地,经由,到达地
*/
private String ZQYD = "";
/**
* 乘车人姓名
*/
private String ZCCRXM = "";
/**
* 开票日期
*/
private String ZKPRQ = "";
/**
* 缩略图ID
*/
private String ZSLT = "";
/**
* 业务状态
*/
private String ZYWZT = "";
/**
* 税额
*/
private String ZSE = "";
/**
* 通行费标志
*/
private String ZTXBZ = "";
/**
* 用户名
*/
private String ZYHM = "";
/**
* 税控盘号
*/
private String ZSKPH = "";
/**
* 开户账户
*/
private String ZGFZH = "";
/**
* 备注
*/
private String ZBZ = "";
/**
* 税码
*/
private String ZSM = "";
/**
* 序号
*/
private String SORT = "";
/**
* 发票代码
*/
private String ZFPDM = "";
/**
* 产地
*/
private String ZCD = "";
/**
* 上车车站/入口
*/
private String ZSCCZ = "";
/**
* 车次
*/
private String ZCC = "";
/**
* 发票号码
*/
private String ZFPHM = "";
/**
* 保险费
*/
private String ZBXF = "";
/**
* 燃油附加费
*/
private String ZRYFJ = "";
/**
* 车架号/车辆识别代码
*/
private String ZCLSB = "";
/**
* 开票时间
*/
private String ZKPSJ = "";
/**
* 下车时间/行程结束时间
*/
private Date ZXCSJ;
/**
* 销方名称
*/
private String ZXFMC = "";
/**
* 承运识别号
*/
private String ZCYRSBH = "";
/**
* 认证结果
*/
private String ZRZJG = "";
/**
* 影像编码ID
*/
private String IMG_ID = "";
/**
* 车牌号
*/
private String ZCPH = "";
/**
* 零税率标志
*/
private String ZLSLBZ = "";
/**
* 创建时间
*/
private Date ZCJSJ;
/**
* 发票状态
*/
private String ZFPZT = "";
/**
* 二手车市场
*/
private String ZESCSC = "";
/**
* 发动机号码
*/
private String ZFDJM = "";
/**
* 更新人
*/
private String ZGXR = "";
/**
* 认证所属期
*/
private String ZRZSSQ = "";
/**
* 里程
*/
private String ZLC = "";
/**
* 合格证号
*/
private String ZHGZH = "";
/**
* 地址电话
*/
private String ZXFDH = "";
/**
* 认证结果描述
*/
private String ZRZMS = "";
/**
* 二手车市场纳税人识别号
*/
private String ZESCSH = "";
/**
* 公司代码
*/
private String ZGSDM = "";
/**
* 购方税号
*/
private String ZGFSH = "";
/**
* 税率
*/
private String ZTAX = "";
/**
* 限乘
*/
private String ZXCRS = "";
/**
* 完税凭证号码
*/
private String ZWSPZ = "";
/**
* 车船吨位
*/
private String ZCCDW = "";
/**
* 主管税务机关
*/
private String ZSWJG = "";
/**
* 业务单据编号(报账单编号)
*/
private String ZYWDJ = "";
/**
* 下车车站/出口
*/
private String ZXCCZ = "";
/**
* 乘车人身份证号
*/
private String ZCCRZH = "";
/**
* 厂牌型号
*/
private String ZCPXH = "";
/**
* 民航发展基金
*/
private String ZMHFZJJ = "";
/**
* 行项目结构
*/
private List<SAPInvoiceDetail> IT_ITEM;
/**
* 地址电话
*/
private String ZGFDH = "";
/**
* 发票影像编号
*/
private String FPYXBH = "";
/**
* 开户账户
*/
private String ZXFZH = "";
/**
* 校验码
*/
private String ZJYM = "";
/**
* 商检单号
*/
private String ZSJDH = "";
/**
* 员工Code
*/
private String ZYGC = "";
/**
* 价税合计/总金额
*/
private String ZJSHJ = "";
/**
* 承运名称
*/
private String ZCYRMC = "";
/**
* 主管税务机关代码
*/
private String ZJGDM = "";
/**
* 更新时间
*/
private Date ZGXSJ;
/**
* 全名
*/
private String ZQM = "";
/**
* 票据来源
*/
private String ZPJLY = "";
/**
* 认证日期
*/
private String ZRZRQ = "";
/**
* 座位类型
*/
private String ZZWLX = "";
/**
* ID
*/
private String ZTID = "";
}

@ -0,0 +1,332 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
import java.util.List;
@Data
public class SNInvoice {
/**
* 影像ID
*/
private String fileId = "";
/**
* SAP排序字段
*/
private String sort = "";
/**
* 发票类型
* (发票池代码 5位)
*/
private String invoiceType = "";
/**
* 所属行政区编码
*/
private String administrativeDivisionNo = "";
/**
* 所属行政区名称
*/
private String administrativeDivisionName = "";
/**
* 发票代码
*/
private String invoiceCode = "";
/**
* 发票号码
*/
private String invoiceNumber = "";
/**
* 开票日期YYYY-MM-DD
*/
private String billingDate = "";
/**
* 购方名称
*/
private String purchaserName = "";
/**
* 购方税号
*/
private String purchaserTaxNo = "";
/**
* 购方开户行账户
*/
private String purchaserBank = "";
/**
* 购方地址电话
*/
private String purchaserAddressPhone = "";
/**
* 销方名称
*/
private String salesName = "";
/**
* 销方税号
*/
private String salesTaxNo = "";
/**
* 销方地址电话
*/
private String salesAddressPhone = "";
/**
* 销方开户行账户
*/
private String salesBank = "";
/**
* 合计价款
*/
private String totalAmount = "";
/**
* 合计税额
*/
private String totalTax = "";
/**
* 价税合计
*/
private String amountTax = "";
/**
* 价税合计_中文
*/
private String amountTaxCN = "";
/**
* 校验码
*/
private String checkCode = "";
/**
* 发票状态0-正常1-作废2-红冲3-失控4-异常
*/
private String state = "";
/**
* 承运人名称
*/
private String carrierName = "";
/**
* 承运人识别号
*/
private String carrierTaxNo = "";
/**
* 受票方名称
*/
private String draweeName = "";
/**
* 受票方识别号
*/
private String draweeTaxNo = "";
/**
* 运输货物信息
*/
private String cargoInformation = "";
/**
* 起运地经由到达地
*/
private String transportRoute = "";
/**
* 税控盘号
*/
private String machineCode = "";
/**
* 车船吨位
*/
private String tonnage = "";
/**
* 主管税务机关
*/
private String taxAuthorityNo = "";
/**
* 主管税务名称
*/
private String taxAuthorityName = "";
/**
* 备注
*/
private String remarks = "";
/**
* 车辆类型
*/
private String vehicleType = "";
/**
* 厂牌型号
*/
private String brandModel = "";
/**
* 产地
*/
private String originPlace = "";
/**
* 合格证号
*/
private String certificateNo = "";
/**
* 商检单号
*/
private String inspectionListNo = "";
/**
* 发动机号
*/
private String engineNo = "";
/**
* 车辆识别代号/车架号码
*/
private String vehicleNo = "";
/**
* 进口证明书号
*/
private String importCertificateNo = "";
/**
* 完税凭证号码
*/
private String paymentVoucherNo = "";
/**
* 限乘人数
*/
private String passengersLimited = "";
/**
* 通行费标志 06-可抵扣通行费07-不可抵扣通 行费
*/
private String tollSign = "";
/**
* 零税率标志 1:税率栏位显示免税,2:税率栏位显示不征收,3:零税率
*/
private String zeroTaxRateSign = "";
/**
* 发票来源
*/
private String source = "";
/**
* 发票所在地
*/
private String place = "";
/**
* 车牌号
*/
private String licensePlate = "";
/**
* 里程
*/
private String mileage = "";
/**
* 飞机票价
*/
private String noTaxAmount = "";
/**
* 燃油附加费
*/
private String fuelSurcharge = "";
/**
* 民航发展基金
*/
private String caacDevelopmentFund = "";
/**
* 其他税费
*/
private String otherTax = "";
/**
* 保险费
*/
private String insurance = "";
/**
* 车次 航班
*/
private String trainNumber = "";
/**
* 座位类型
*/
private String seat = "";
/**
* 上车车站\入口
*/
private String stationGetOn = "";
/**
* 下车车站\出口
*/
private String stationGetOff = "";
/**
* 乘坐人姓名
*/
private String riderName = "";
/**
* 身份证号码/组织机构代码
*/
private String idcardNo = "";
/**
* 查验状态
*/
private String checkStaus = "";
/**
* 查验时间
*/
private String checkDate = "";
/**
* 查验结果描述
*/
private String checkResultMessage = "";
/**
* 明细列表
*/
private List<SNInvoiceDetail> invoiceLineList;
}

@ -0,0 +1,78 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
@Data
public class SNInvoiceDetail {
/**
* 行号
*/
private String rowNo = "";
/**
* 商品编码
*/
private String commodityCode = "";
/**
* 货物或应税劳务名称
*/
private String commodityName = "";
/**
* 规格型号
*/
private String specificationModel = "";
/**
* 单位
*/
private String unit = "";
/**
* 数量
*/
private String quantity = "";
/**
* 单价
*/
private String unitPrice = "";
/**
* 金额
*/
private String amount = "";
/**
* 税率
*/
private String taxRate = "";
/**
* 税额
*/
private String tax = "";
/**
* 通行日起止
*/
private String currentDateEnd = "";
/**
* 通行日期起
*/
private String currentDateStart = "";
/**
* 车牌号
*/
private String licensePlateNum = "";
/**
* 类型
*/
private String type = "";
}

@ -0,0 +1,26 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
import java.util.List;
@Data
public class SNRequestObject {
/**
* 文档ID
*/
private String imageId = "";
/**
* 公司代码
*/
private String compCode = "";
/**
* 文档ID
*/
private List<SNInvoice> invoiceInfoList;
}

@ -0,0 +1,66 @@
package com.dxhy.erp.entity.sdny;
import lombok.Data;
import java.util.List;
@Data
public class SNSAPObject {
/**
* 外围系统标识
*/
private String SYSID;
/**
* 接口业务ID
*/
private String IFYWID;
/**
* 外围系统数据唯一标识
*/
private String BSKEY;
/**
* SAP数据唯一标识
*/
private String SAPKEY;
/**
* 组织机构代码
*/
private String ZORG;
/**
* SAP模块编码OA用
*/
private String ZFILED1;
/**
* 预留字段
*/
private String ZFILED2;
/**
* 预留字段
*/
private String ZFILED3;
/**
* 预留字段
*/
private String ZFILED4;
/**
* SAP Client
*/
private String ZFILED5;
/**
* 外围系统标识
*/
private List<SAPInvoiceInfo> ZDATA;
}

@ -0,0 +1,49 @@
package com.dxhy.erp.entity.sdny.area;
import lombok.Data;
import java.util.List;
/**
* 区域实体类
*
* @author shanQing
*/
@Data
public class Area {
/**
* 主键ID
*/
private Long id;
/**
* 父级ID
*/
private Long pid;
/**
* 区域名称
*/
private String areaName;
/**
* 区域等级
*/
private Integer level;
/**
* 是否为直辖市自治区(Y:;N:)
*/
private String isMunicipality;
/**
* 区块链发票是否可以查验
*/
private String isCheckBlockChain;
/**
* 省下的市集合数据
*/
private List<Area> cityList;
}

@ -0,0 +1,378 @@
package com.dxhy.erp.service;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.common.constant.DbConstant;
import com.dxhy.common.datasource.config.DynamicContextHolder;
import com.dxhy.common.util.UserInfoUtil;
import com.dxhy.common.vo.UserInfo;
import com.dxhy.erp.dao.AreaDao;
import com.dxhy.erp.dao.OrgUserInfoDao;
import com.dxhy.erp.entity.sdny.InvoiceDetail;
import com.dxhy.erp.entity.sdny.InvoiceInfo;
import com.dxhy.erp.entity.sdny.area.Area;
import com.dxhy.erp.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 与山东能源交互数据主类
*
* @author JLY
* @date 2017年6月26日下午5:02:49
*/
@SuppressWarnings("AlibabaUndefineMagicConstant")
@Service
@Slf4j
public class SNPushCheckRecordService extends AbstractServiceAdapter {
@Value("${sdny.snYxUrl}")
private String snYxUrl;
private InvoiceQueryUtil invoiceQueryUtil;
@Resource
private AreaDao areaDao;
@Resource
private OrgUserInfoDao orgUserInfoDao;
public String pushCheckResultToSAP(JSONObject result) throws Exception {
result.put("systemSign", "");
result.put("roleIds", "");
log.info("获取角色请求参数:{} , 请求地址:{}", result, snYxUrl);
String post = HttpUtil.post(snYxUrl, result, 30000);
log.info("获取角色返回信息:{}", post);
if (StringUtils.isNotBlank(post)) {
}
return post;
}
public JSONObject checkInvoice(Map<String, String> pramsMap, UserInfo userInfo) {
// uuid = 发票代码+发票号码
String uuid = (org.apache.commons.lang.StringUtils.isBlank(pramsMap.get("invoiceCode"))?"":pramsMap.get("invoiceCode")) + pramsMap.get("invoiceNo");
DynamicContextHolder.push(userInfo.getDbName() + DbConstant.BUSINESS_READ);
List<String> gfshAll = UserInfoUtil.getGfshAll(userInfo.getOrg());
String gfsh = "";
if (gfshAll.size() > 0) {
gfsh = gfshAll.get(0);
}
JSONObject queryInvoiceResult = invoiceQueryUtil.queryInvoice(pramsMap.get("invoiceCode"),
pramsMap.get("invoiceNo"), pramsMap.get("invoiceDate"), pramsMap.get("invoiceAmount"), pramsMap.get("checkCode"),
gfsh,"31");
String resultCode = queryInvoiceResult.getString("resultCode");
DynamicContextHolder.push(userInfo.getDbName() + DbConstant.BUSINESS_WRITE);
// 调用查验接口失败,将签收状态更新到扫描表中或者insert数据到扫描表,然后return;
if (queryInvoiceResult.containsKey("returnCode")) {
log.error("发票号码:" + pramsMap.get("invoiceNo") + "签收失败,失败原因:" + queryInvoiceResult.getString("returnMessage"));
return queryInvoiceResult;
}
if (!"0001".equals(resultCode)) {
// 接口通过但,调用返回失败
log.error("发票号码:" + pramsMap.get("invoiceNo") + "签收失败,失败原因:" + queryInvoiceResult.getString("resultTip"));
return queryInvoiceResult;
}
return queryInvoiceResult;
}
/**
* 客票价税计算
*
* @return
* @throws ParseException
*/
public ServiceResult<InvoiceInfo> valoremTaxCount(InvoiceInfo invoiceInfo, String enterpriseId, String isDeductible)
throws ParseException {
if (isDeductible == null || StringUtils.isEmpty(isDeductible)) {
logger.error("客票价税计算失败:费用类别或可抵扣标识为空");
return fail("费用类别或可抵扣标识为空");
}
if (invoiceInfo == null) {
logger.error("客票价税计算失败:请求参数为空");
return fail("请求参数为空");
} else if (StringUtils.isBlank(isDeductible) || !CommonEnum.Y.equals(isDeductible)) {
return fail("客票不抵扣");
// 判断发票类型是否为客票
} else if (!getPassengerInvoiceTypeList().contains(invoiceInfo.getInvoiceTypeCode())) {
logger.error("客票价税计算失败:发票类型不为客票");
return fail("发票类型不为客票");
}
// 校验客票可抵扣条件
ServiceResult<?> result = checkIsDeduction(invoiceInfo, enterpriseId);
if (!result.getResult()) {
logger.error("客票价税计算失败:" + result.getMsg());
return fail(result.getMsg());
}
// 设置可抵扣标识
invoiceInfo.setIsDeductible(isDeductible);
// 设置税率
// 航空、铁路运输发票税率显示9%
if (invoiceInfo.getInvoiceTypeCode().equals(Constant.AIR_PASSENGER_ELECTRONIC_TICKET_ITINERARY_CODE)
|| invoiceInfo.getInvoiceTypeCode().equals(Constant.RAILWAY_TICKET_CODE)) {
invoiceInfo.setTaxRate("9%");
// 公路、水路及其他显示3% 增值税电子普通发票显示税率字段
} else if (!invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE)
&& !invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE)) {
invoiceInfo.setTaxRate("3%");
}
// 计算税额
// 航空客票:税额=(票价+燃油附加费)÷(1+9%)×9%
if (invoiceInfo.getInvoiceTypeCode().equals(Constant.AIR_PASSENGER_ELECTRONIC_TICKET_ITINERARY_CODE)) {
if (!StringUtils.isNotEmpty(invoiceInfo.getFare()) && isBigDecimal(invoiceInfo.getFare())
&& StringUtils.isNotEmpty(invoiceInfo.getFuelSurcharge())
&& isBigDecimal(invoiceInfo.getFuelSurcharge())) {
// 票价
BigDecimal fare = new BigDecimal(invoiceInfo.getFare());
// 燃油附加费
BigDecimal fuelSurcharge = new BigDecimal(invoiceInfo.getFuelSurcharge());
invoiceInfo.setInvoiceAmount((fare.add(fuelSurcharge)
.divide(new BigDecimal("1.09"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.09"))));
} else {
logger.error("客票价税计算失败:航空客票 票价或燃油附加费为空");
}
// 铁路客票:税额=票面金额÷(1+9%)×9%
} else if (invoiceInfo.getInvoiceTypeCode().equals(Constant.RAILWAY_TICKET_CODE)) {
invoiceInfo.setTaxAmount(invoiceInfo.getInvoiceAmount()
.divide(new BigDecimal("1.09"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.09")));
// 公路、水路、其他客票:税额=票面金额÷(1+3%)×3%
} else if (!invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE)
&& !invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE)) {
invoiceInfo.setInvoiceAmount(invoiceInfo.getInvoiceAmount()
.divide(new BigDecimal("1.03"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.03")));
}
// 税额保留两位小数(四舍五入)
if (invoiceInfo.getInvoiceAmount() != null) {
invoiceInfo.setTaxAmount(invoiceInfo.getInvoiceAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
}
if (!invoiceInfo.getInvoiceTypeCode().equals(Constant.AIR_PASSENGER_ELECTRONIC_TICKET_ITINERARY_CODE)) {
// 不含税金额
if (invoiceInfo.getInvoiceAmount() != null && invoiceInfo.getTaxAmount() != null) {
invoiceInfo.setInvoiceAmount(invoiceInfo.getInvoiceAmount().subtract(invoiceInfo.getTaxAmount()));
}
} else {
if (!StringUtils.isNotEmpty(invoiceInfo.getFare()) && isBigDecimal(invoiceInfo.getFare())
&& StringUtils.isNotEmpty(invoiceInfo.getFuelSurcharge())
&& isBigDecimal(invoiceInfo.getFuelSurcharge())) {
// 票价
BigDecimal fare = new BigDecimal(invoiceInfo.getFare());
// 燃油附加费
BigDecimal fuelSurcharge = new BigDecimal(invoiceInfo.getFuelSurcharge());
invoiceInfo.setInvoiceAmount(fare.add(fuelSurcharge).subtract(invoiceInfo.getTaxAmount()));
} else {
logger.error("客票不含税金额失败:航空客票 票价或燃油附加费为空");
}
}
return ok(invoiceInfo);
}
public static List<String> getPassengerInvoiceTypeList() {
// 客票类型
List<String> typeList = new ArrayList<>();
// 增值税电子普通发票
typeList.add(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE);
// 增值税电子普通发票(通行费)
typeList.add(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE);
// 航空客运电子客票行程单
typeList.add(Constant.AIR_PASSENGER_ELECTRONIC_TICKET_ITINERARY_CODE);
// 公路运输客票(实名)
typeList.add(Constant.ROAD_TRANSPORT_TICKET_REAL_NAME_CODE);
// 水路运输客票(实名)
typeList.add(Constant.WATER_TRANSPORT_TICKET_REAL_NAME_CODE);
// 其他运输客票(实名)
typeList.add(Constant.OTHER_TRANSPORT_TICKET_REAL_NAME_CODE);
// 火车票
typeList.add(Constant.RAILWAY_TICKET_CODE);
return typeList;
}
/**
* @param invoiceInfo
* @return
* @throws ParseException
*/
private ServiceResult<?> checkIsDeduction(InvoiceInfo invoiceInfo, String enterpriseId) throws ParseException {
try {
String result = verifyInfo( invoiceInfo);
if (!CommonEnum.RESPONSE_INTERFACE_STATUS_CODE_SUCCESS.equals(result)) {
return fail(result);
}
if (Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE.equals(invoiceInfo.getInvoiceTypeCode())
|| Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE
.equals(invoiceInfo.getInvoiceTypeCode())) {
if (invoiceInfo.getDetailList() != null) {
if (invoiceInfo.getDetailList() == null || invoiceInfo.getDetailList().isEmpty()) {
return fail("发票明细不可为空");
}
// 校验增值税电子普通发票
String invoiceTypeCode = invoiceInfo.getInvoiceTypeCode();
if (invoiceTypeCode.equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE)
|| invoiceTypeCode.equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE)) {
List<InvoiceDetail> details = invoiceInfo.getDetailList();
if (details != null && details.size() > 0) {
for (int i = 0, length = details.size(); i < length; i++) {
if (!isRightRule(details.get(i).getGoodsName(), details.get(i).getTaxRate())) {
return fail("发票底账明细中第" + i + 1 + "条名称或税率不正确");
}
if (StringUtils.isNotEmpty(details.get(i).getTaxRate())) {
if (details.get(i).getTaxRate().contains("%")) {
invoiceInfo.setTaxRate(details.get(i).getTaxRate());
} else {
invoiceInfo.setTaxRate(details.get(i).getTaxRate() + "%");
}
}
}
}
}
} else {
return fail("未获取到发票明细");
}
}
// 校验公路、水路、其他运输客票(实名),航空客运电子客票行程单,火车票
if (invoiceInfo.getInvoiceTypeCode().equals(Constant.ROAD_TRANSPORT_TICKET_REAL_NAME_CODE)
|| invoiceInfo.getInvoiceTypeCode().equals(Constant.WATER_TRANSPORT_TICKET_REAL_NAME_CODE)
|| invoiceInfo.getInvoiceTypeCode().equals(Constant.OTHER_TRANSPORT_TICKET_REAL_NAME_CODE)
|| invoiceInfo.getInvoiceTypeCode().equals(Constant.AIR_PASSENGER_ELECTRONIC_TICKET_ITINERARY_CODE)
|| invoiceInfo.getInvoiceTypeCode().equals(Constant.RAILWAY_TICKET_CODE)) {
if (StringUtils.isEmpty(invoiceInfo.getIdentityNumber())
|| StringUtils.isEmpty(invoiceInfo.getPassenger()) || StringUtils.isEmpty(enterpriseId)) {
return fail("必填字段为空");
}
int count = orgUserInfoDao.countUserByIdentityNumber(invoiceInfo.getIdentityNumber(),
invoiceInfo.getPassenger(), enterpriseId);
if (count == 0) {
return fail("未查询到用户信息");
}
if (count > 1) {
return fail("查询到多个用户");
}
}
return ok();
} catch (Exception e) {
logger.error("校验客运发票是否可抵扣异常:" + e.toString());
return fail("客运发票是否可抵扣校验失败");
}
}
public String verifyInfo(InvoiceInfo invoiceInfo) {
String result = "0000";
if (invoiceInfo == null) {
result = "发票信息不可为空";
}
if (invoiceInfo.getInvoiceTypeCode() == null || "".equals(invoiceInfo.getInvoiceTypeCode())) {
result = "发票类型不可为空";
}
if (invoiceInfo.getInvoiceDate() == null || "".equals(invoiceInfo.getInvoiceDate())) {
result = "开票日期不可为空";
}
if (!CommonEnum.INV_ZZS_ELE_PP.equals(invoiceInfo.getInvoiceTypeCode()) && !CommonEnum.INV_ZZS_ELE_TXF.equals(invoiceInfo.getInvoiceTypeCode())) {
if (invoiceInfo.getIdentityNumber() == null || "".equals(invoiceInfo.getIdentityNumber())) {
result = "用户证件号不可为空";
}
if (invoiceInfo.getPassenger() == null || "".equals(invoiceInfo.getPassenger())) {
result = "乘车人不可为空";
}
if (invoiceInfo.getDepartCity() == null || invoiceInfo.getDepartCity().isEmpty()) {
result = "出发城市不可为空";
}
if (invoiceInfo.getArriveCity() == null || invoiceInfo.getArriveCity().isEmpty()) {
result = "到达城市不可为空";
}
}
if (invoiceInfo.getInvoiceDate()
.compareTo(DateUtil.parse("2019-04-01", DatePattern.NORM_DATE_PATTERN)) < 0) {
result = "开票日期需要晚于2019年4月1日";
}
if (!invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE)
&& !invoiceInfo.getInvoiceTypeCode()
.equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE)) {
// 港澳台城市
List<String> hmtList = new ArrayList<>();
// 香港
hmtList.add("香港特别行政区");
hmtList.add("香港");
// 澳门
hmtList.add("澳门特别行政区");
hmtList.add("澳门");
// 台湾
hmtList.add("台湾省");
hmtList.add("台湾");
// 出发地和到达地是否为非港澳台城市
List<Area> departCities = areaDao.queryAreaByName(invoiceInfo.getDepartCity());
List<Area> arriveCities = areaDao.queryAreaByName(invoiceInfo.getArriveCity());
boolean invHmtListExisted = (StringUtils.isNotEmpty(invoiceInfo.getDepartCity())
&& hmtList.contains(invoiceInfo.getDepartCity()))
|| (StringUtils.isNotEmpty(invoiceInfo.getArriveCity())
&& hmtList.contains(invoiceInfo.getArriveCity()));
if (departCities == null || departCities.isEmpty() || arriveCities == null || arriveCities.isEmpty()) {
result = "出发或到达城市不符合标准";
} else if (invHmtListExisted) {
result = "出发或到达城市不符合标准";
}
}
return result;
}
/**
* 增值税电子普通发票验证逻辑
*
* @param goodsName
* @param rate
* @return
*/
private Boolean isRightRule(String goodsName, String rate) {
return (goodsName.contains("*运输服务*")) && (rate.contains("3") || rate.contains("9"));
}
public static boolean isBigDecimal(String str) {
if (str == null || str.trim().length() == 0) {
return false;
}
char[] chars = str.toCharArray();
int sz = chars.length;
int i = (chars[0] == '-') ? 1 : 0;
if (i == sz) {
return false;
}
// 除了负号,第一位不能为'小数点'
if (chars[i] == CommonEnum.POINT_CHAR) {
return false;
}
boolean radixPoint = false;
for (; i < sz; i++) {
if (chars[i] == '.') {
if (radixPoint) {
return false;
}
radixPoint = true;
} else if (!(chars[i] >= '0' && chars[i] <= '9')) {
return false;
}
}
return true;
}
}

@ -0,0 +1,28 @@
package com.dxhy.erp.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author guoker
* @date 2020-12-30
*/
public abstract class AbstractServiceAdapter {
protected final Logger logger = LoggerFactory.getLogger(getClass());
private <T> ServiceResult<T> getResult(boolean result, String msg, T data) {
return new ServiceResult<T>().setResult(result).setMsg(msg).setData(data);
}
protected <T> ServiceResult<T> ok(T data) {
return getResult(true, "ok", data);
}
protected <T> ServiceResult<T> ok() {
return getResult(true, "ok", null);
}
protected <T> ServiceResult<T> fail(String errMsg) {
return getResult(false, errMsg, null);
}
}

@ -0,0 +1,502 @@
package com.dxhy.erp.utils;
/**
* @author guoker
* @date 2020-12-28
*/
public class CommonEnum {
public static final String ZERO_AND_ZERO_STR = "00";
public static final String ZERO_STR = "0";
public static final String ONE_STR = "1";
public static final String TWO_STR = "2";
public static final String THREE_STR = "3";
public static final String FOUR_STR = "4";
public static final String FIVE_STR = "5";
public static final String SIX_STR = "6";
public static final String SEVEN_STR = "7";
public static final String EIGHT_STR = "8";
public static final String NINE_STR = "9";
public static final String TEN_STR = "10";
public static final String ELEVEN_STR = "11";
public static final String TWELVE_STR = "12";
public static final String THREETEEN_STR = "13";
public static final String SEVENTEEN_STR = "17";
public static final int ZERO = 0;
public static final int ONE = 1;
public static final int TWO = 2;
public static final int THREE = 3;
public static final int FOUR = 4;
public static final int FIVE = 5;
public static final int SIX = 6;
public static final int SEVEN = 7;
public static final int EIGHT = 8;
public static final int NINE = 9;
public static final int TEN = 10;
public static final int ELEVEN = 11;
public static final int TWELVE = 12;
public static final int FOURTEEN = 14;
public static final int SIXTEEN = 16;
public static final int SEVENTEEN = 17;
public static final int NINETEEN = 19;
public static final int TWENTY_EIGHT = 28;
public static final int TWENTY_NINE = 29;
public static final int TWO_HUNDRED = 200;
public static final int FOUR_HUNDRED = 400;
public static final int NINTEEN_HUNDRED = 1900;
public static final int TWENTY_TWO_HUNDRED = 2200;
public static final String ONE_HUNDRED_SIX_STR = "106";
public static final int A_BIG = 'A';
public static final int Z_BIG = 'Z';
/**
* 发票类型-增值税专用发票
*/
public static final String INV_ZZS_PAPER_ZP = "01";
/**
* 发票类型-增值税电子专用发票
*/
public static final String INV_ZZS_ELE_ZP = "102";
/**
* 发票类型-增值税普通发票
*/
public static final String INV_ZZS_PAPER_PP = "04";
/**
* 发票类型-增值税普通发票(电子)
*/
public static final String INV_ZZS_ELE_PP = "10";
/**
* 发票类型-增值税普通发票(卷式)
*/
public static final String INV_ZZS_JP = "11";
/**
* 发票类型-增值税电子普通发票(通行费)
*/
public static final String INV_ZZS_ELE_TXF = "14";
/**
* 发票类型-机动车销售统一发票
*/
public static final String INV_ZZS_JDC = "03";
/**
* 发票类型-货运运输业增值税专用发票
*/
public static final String INV_ZZS_HYYS = "02";
/**
* 发票类型-二手车销售统一发票
*/
public static final String INV_ESC = "15";
/**
* 发票类型-货运运输业增值税专用发票
*/
public static final String INV_ZZS_DZZP = "08";
/**
* 发票类型-出租车票
*/
public static final String INV_TAXI = "91";
/**
* 发票类型-火车票
*/
public static final String INV_TRAIN = "92";
/**
* 发票类型-航空客运电子客票行程单
*/
public static final String INV_FLIGHT = "90";
/**
* 发票类型-公路运输客票(实名)
*/
public static final String INV_KP_GL = "89";
/**
* 发票类型-水路运输客票(实名)
*/
public static final String INV_KP_SL = "88";
/**
* 发票类型-其他运输客票(实名)
*/
public static final String INV_KP_OTHER = "87";
/**
* 发票类型-汽车票
*/
public static final String INV_CAR = "94";
/**
* 发票类型-定额发票
*/
public static final String INV_DE = "95";
/**
* 发票类型-长途汽车票
*/
public static final String INV_CAR_CT = "96";
/**
* 发票类型-通用机打发票
*/
public static final String INV_TYJD = "97";
/**
* 发票类型-政府非税收收入一般缴款书
*/
public static final String INV_GOV_JKS = "98";
/**
* 发票类型-国外发票
*/
public static final String INV_ABROAD = "99";
/**
* 发票类型-其他
*/
public static final String INV_OTHER = "00";
/**
* 发票类型-过路过桥发票
*/
public static final String INV_GLGQ = "101";
/**
* 发票类型-区块链发票
*/
public static final String INV_BLOCK_CHAIN = "16";
/**
* 全电发票专用发票21
**/
public static final String INV_ZZS_QD_ZYZP = "21";
/**
* 全电发票普通发票22
**/
public static final String INV_ZZS_QD_PTZP = "22";
/**
* 发票类型-医疗票据
*/
public static final String INV_MEDICAL = "18";
/**
* 发票类型-开放平台返回可报销其他发票
*/
public static final String INV_ENABLE_OTHER = "85";
/**
* 发票类型-开放平台返回滴滴出行行程单
*/
public static final String INV_DIDI = "86";
/**
* 发票类型-开放平台返回飞机
*/
public static final String INV_PLANE = "93";
/**
* 发票类型-完税证明
*/
public static final String INV_WSZM = "102";
/**
* 发票类型-51
*/
public static final String INV_51 = "51";
/**
* 特殊字符 -
*/
public static final String SPE_CHA_HENG = "-";
/**
* 特殊字符 /
*/
public static final String SPE_CHA_XIE = "/";
/**
* excel文件后缀
*/
public static final String END_OF_XLSX = "xlsx";
/**
* excel文件后缀
*/
public static final String END_OF_XLS = "xls";
/**
* 浏览器类型
*/
public static final String BROWSER_MSIE = "MSIE";
/**
* 浏览器类型
*/
public static final String BROWSER_FIREFOX = "Firefox";
/**
* 浏览器类型
*/
public static final String BROWSER_SAFARI = "Safari";
/**
* interface对外接口包下成功响应码
*/
public static final String RESPONSE_INTERFACE_STATUS_CODE_SUCCESS = "0000";
/**
* interface对外接口包下失败响应码1
*/
public static final String RESPONSE_INTERFACE_STATUS_CODE_ERROR_0001 = "0001";
public static final String RESPONSE_INTERFACE_STATUS_CODE_ERROR_001 = "001";
/**
* Y
*/
public static final String Y = "Y";
/**
* N
*/
public static final String N = "N";
/**
* .特殊字符
*/
public static final char POINT_CHAR = '.';
/**
* code
*/
public static final String CODE = "code";
/**
* data
*/
public static final String DATA = "data";
/**
* %
*/
public static final String PERCENT = "%";
/**
* pdf
*/
public static final String PDF = "pdf";
/**
* ofd
*/
public static final String OFD = "ofd";
/**
* doc
*/
public static final String DOC = "doc";
/**
* docx
*/
public static final String DOCX = "docx";
/**
* jpg
*/
public static final String JPG = "jpg";
/**
* png
*/
public static final String PNG = "png";
/**
* jpeg
*/
public static final String JPEG = "jpeg";
/**
* zip
*/
public static final String ZIP = "zip";
/**
* bmp
*/
public static final String BMP = "bmp";
/**
* ,
*/
public static final String DH_ENGLISH_STR = ",";
/**
* email
*/
public static final String EMAIL = "email";
/**
* uuidStr
*/
public static final String UUID_STR = "uuidStr";
/**
* ids
*/
public static final String IDS_STR = "ids";
/**
* OFD 返回结果-解析成功
*/
public static final String OFD_SUCCESS_CODE = "9001";
/**
* OFD 返回结果-其他异常
*/
public static final String OFD_UNERROR_CODE = "9999";
/**
* 微信卡包数据拉取返回提示
*/
public static final String WECHAT_PACKAGE_RESPONSE_MSG_1 = "微信卡包数据拉取成功";
/**
* 微信卡包拉取完数据修改拉取状态标识-发票已锁定
*/
public static final String INVOICE_REIMBURSE_LOCK = "INVOICE_REIMBURSE_LOCK";
/**
* 微信卡包拉取完数据修改拉取状态标识--发票初始状态未锁定
*/
public static final String INVOICE_REIMBURSE_INIT = "INVOICE_REIMBURSE_INIT";
/**
* 微信卡包拉取完数据修改拉取状态标识--发票已核销
*/
public static final String INVOICE_REIMBURSE_CLOSURE = "INVOICE_REIMBURSE_CLOSURE";
/**
* 微信卡包拉取完数据修改拉取状态标识--发票被冲红
*/
public static final String INVOICE_REIMBURSE_CANCEL = "INVOICE_REIMBURSE_CANCEL";
/**
* 規則編碼2001
*/
public static final String PERSONAL_RULE_CODE_2001 = "2001";
/**
* 規則編碼2017
*/
public static final String PERSONAL_RULE_CODE_2017 = "2017";
/**
* 規則編碼2018
*/
public static final String PERSONAL_RULE_CODE_2018 = "2018";
/**
* 規則編碼1008
*/
public static final String PERSONAL_RULE_CODE_1008 = "1008";
/**
* 規則編碼2015
*/
public static final String PERSONAL_RULE_CODE_2015 = "2015";
/**
* 規則編碼1013
*/
public static final String PERSONAL_RULE_CODE_1013 = "1013";
/**
* 規則編碼1014
*/
public static final String PERSONAL_RULE_CODE_1014 = "1014";
/**
* 規則編碼2022
*/
public static final String PERSONAL_RULE_CODE_2022 = "2022";
/**
* H
*/
public static final String H = "H";
/**
* GB
*/
public static final String GB = "GB";
/**
* MB
*/
public static final String MB = "MB";
/**
* KB
*/
public static final String KB = "KB";
/**
* 查无此票
*/
public static final String INCOME_RESPONSE_NO_INVOICE = "无此票";
/**
* 请求不合法
*/
public static final String INVOICE_CHECK_RESPONSE_1 = "请求不合法";
/**
* 发票信息不正确请检查
*/
public static final String INVOICE_CHECK_RESPONSE_2 = "发票信息不正确,请检查";
/**
* 纸质增值税发票机打号码对比提示语
*/
public static final String DIFF_PAPER_INVOICE_NUMBER = "发票印刷代码号码与打印代码号码不一致,请确认!";
/**
* 该文件不是原始发票请重新上传原始发票文件
*/
public static final String CHECK_PDF_FILE = "电票请上传PDF或OFD格式电子源文件";
/**
* 图片标识
*/
public static final String IMG_FLAG = "img";
/**
* 同批次有重复发票请检查
*/
public static final String INV_SERISE_REPEAT_CHECK_MESSAGE = "同批次有重复发票,请检查!";
/**
* 详见销货清单
*/
public static final String INVOICE_SALE_NAME = "详见销货清单";
/**
* 未查询到数据
*/
public static final String NO_INVOICE_DATA = "未查询到数据";
/**
* true
*/
public static final String TRUE = "true";
/**
* false
*/
public static final String FALSE = "false";
}

@ -0,0 +1,309 @@
package com.dxhy.erp.utils;
/**
* 常量定义类
*
* @author ShanQing
* 2018-5-15 11:37:02
*/
public class Constant {
/** ↓==============通用字符串常量定义============= ↓ */
/**
* 删除标记标识标识已经删除
*/
public static final String DELETE_FLAG_TRUE = "Y";
/**
* 删除标记标识标识没有删除
*/
public static final String DELETE_FLAG_FALSE = "N";
/**
* 有效标记标识标识有效
*/
public static final String VALID_FLAG_TRUE = "Y";
/**
* 有效标记标识标识无效
*/
public static final String VALID_FLAG_FALSE = "N";
/**
* 核销标识-核销
*/
public static final String VERIFICATION_FLAG_TRUE = "Y";
/**
* 核销标识-未核销
*/
public static final String VERIFICATION_FLAG_FALSE = "N";
/**
* 成本中心-部门类型编号
*/
public static final String COST_CENTER_DEPARTMENT_TYPE_CODE = "0";
/**
* 成本中心-项目类型编号
*/
public static final String COST_PROJECT_TYPE_CODE = "1";
/**
* 报销状态-未提交
*/
public static final String EXPENSE_STATE_UNSUBMITTED = "0";
/**
* 报销状态-已撤销
*/
public static final String EXPENSE_STATE_UNDONE = "1";
/**
* 报销状态-已驳回
*/
public static final String EXPENSE_STATE_REJECTED = "2";
/**
* 报销状态-审批中
*/
public static final String EXPENSE_STATE_BEING_PROCESSED = "3";
/**
* 报销状态-审批通过
*/
public static final String EXPENSE_STATE_APPROVE = "4";
/**
* 发票类型代码-增值税专用发票
*/
public static final String VAT_SPECIAL_INVOICE_CODE = "01";
/**
* 发票类型代码-增值税普通发票
*/
public static final String VALUE_ADDED_TAX_INVOICE_CODE = "04";
/**
* 发票类型代码-增值税普通发票(电子)
*/
public static final String VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE = "10";
/**
* 发票类型代码-增值税普通发票(卷式)
*/
public static final String VALUE_ADDED_TAX_INVOICE_KANSHIKI_CODE = "11";
/**
* 发票类型代码-增值税电子普通发票(通行费)
*/
public static final String VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE = "14";
/**
* 发票类型代码-机动车销售统一发票
*/
public static final String UNIFORM_INVOICE_FOR_MOTOR_VEHICLE_SALES_CODE = "03";
/**
* 发票类型代码-货运运输业增值税专用发票
*/
public static final String SPECIAL_INVOICES_FOR_VAT_FREIGHT_CODE = "02";
/**
* 发票类型代码-出租车票
*/
public static final String TAXI_RECEIPT_CODE = "91";
/**
* 发票类型代码-火车票
*/
public static final String RAILWAY_TICKET_CODE = "92";
/**
* 发票类型代码-飞机票
*/
public static final String PLANE_TICKET_CODE = "93";
/**
* 发票类型代码-汽车票
*/
public static final String BUS_TICKET_CODE = "94";
/**
* 发票类型代码-定额发票
*/
public static final String QUOTA_INVOICE_CODE = "95";
/**
* 发票类型代码-长途汽车票
*/
public static final String LONG_DISTANCE_BUS_TICKET_CODE = "96";
/**
* 发票类型代码-其他
*/
public static final String OTHER_TYPE_CODE = "00";
/**
* 发票类型代码-航空客运电子客票行程单
*/
public static final String AIR_PASSENGER_ELECTRONIC_TICKET_ITINERARY_CODE = "90";
/**
* 发票类型代码-公路运输客票(实名)
*/
public static final String ROAD_TRANSPORT_TICKET_REAL_NAME_CODE = "89";
/**
* 发票类型代码-水路运输客票(实名)
*/
public static final String WATER_TRANSPORT_TICKET_REAL_NAME_CODE = "88";
/**
* 发票类型代码-其他运输客票(实名)
*/
public static final String OTHER_TRANSPORT_TICKET_REAL_NAME_CODE = "87";
/**
* 发票类型代码-通用机打发票
*/
public static final String GENERAL_MACHINE_INVOICE_CODE = "97";
/**
* 发票类型代码-政府非税收收入一般缴款书
*/
public static final String GOVERNMENT_NONTAX_REVENUE_GENERAL_CONTRIBUTIONS_CODE = "98";
/**
* 消息推送文案类型-申请人
*/
public static final String NOTIFICATION_COPYWRITING_PROPOSER = "1";
/**
* 消息推送文案类型-待审批人
*/
public static final String NOTIFICATION_COPYWRITING_APPROVAL_PENDING = "2";
/**
* 消息推送文案类型-抄送人
*/
public static final String NOTIFICATION_COPYWRITING_CC = "3";
/**
* 功能权限类型-开票校验
*/
public static final String FUNCTION_JURISDICTION_TYPE_CHECK_INVOICE = "INVOICE_CHECK";
/**
* 功能权限类型名称-开票信息
*/
public static final String FUNCTION_JURISDICTION_TYPE_NAME_CHECK_INVOICE = "开票信息";
/**
* 系统标识-APP
*/
public static final int SYSTEM_APP_MARK = 0;
/**
* 系统标识-WEB
*/
public static final int SYSTEM_WEB_MARK = 1;
/**
* 发票状态-正常
*/
public static final String INVOICE_STATUS_NORMAL = "0";
/**
* 发票状态-失控
*/
public static final String INVOICE_STATUS_OUT_OF_CONTROL = "1";
/**
* 发票状态-作废
*/
public static final String INVOICE_STATUS_CANCELLATION = "2";
/**
* 发票状态-红冲
*/
public static final String INVOICE_STATUS_RCW = "3";
/**
* 发票状态-异常
*/
public static final String INVOICE_STATUS_ABNORMITY = "4";
/**
* 增值税普通发票
*/
public static final String VALUE_ADDED_TAX_INVOICE = "0";
/**
* 增值税专用发票
*/
public static final String VAT_SPECIAL_INVOICE = "1";
/**
* 开关-
*/
public static final int SWITCH_CLOSE = 0;
/**
* 开关-
*/
public static final int SWITCH_OPEN = 1;
/**
* 还款状态- 未还完
*/
public static final int REPAY_NOT_YET = 0;
/**
* 还款状态- 已还完
*/
public static final int REPAY_OVER = 1;
/**
* OCR识别通道-京东
*/
public static final String ORC_JING_DONG = "ORC_JING_DONG";
/**
* OCR识别通道-瑞琪
*/
public static final String ORC_RUI_QI = "OCR_RUI_QI";
/** ↑==============通用字符串常量定义============= ↑ */
/**
* 发票类型代码-过桥过闸
*/
public static final String GO_ACROSS_BRIDGE_TICKET_NAME_CODE = "101";
/**
* 发票类型代码-完税凭证
*/
public static final String TYPE_CODE_102 = "102";
/**
* 发票类型代码-代扣代缴税收通用缴款书
*/
public static final String TYPE_CODE_103 = "103";
/**
* 发票类型代码-海关缴款书
*/
public static final String TYPE_CODE_17 = "17";
}

@ -0,0 +1,43 @@
package com.dxhy.erp.utils;
/**
* @author guoker
* @date 2020-12-30
*/
public class ServiceResult<T> {
private boolean result = false;
private String msg;
private T data;
public boolean getResult() {
return this.result;
}
public ServiceResult<T> setResult(boolean result) {
this.result = result;
return this;
}
public String getMsg() {
return this.msg;
}
public ServiceResult<T> setMsg(String msg) {
this.msg = msg;
return this;
}
public T getData() {
return this.data;
}
public ServiceResult<T> setData(T data) {
this.data = data;
return this;
}
@Override
public String toString() {
return "ServiceResult{result=" + this.result + ", message='" + this.msg + '\'' + ", data=" + this.data + '}';
}
}

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dxhy.bxsdk.business.dao.AreaDao">
<resultMap id="areaResultMap" type="com.dxhy.bxsdk.api.domain.area.Area">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="PID" property="pid" jdbcType="BIGINT"/>
<result column="AREA_NAME" property="areaName" jdbcType="VARCHAR"/>
<result column="LEVEL" property="level" jdbcType="INTEGER"/>
<result column="IS_MUNICIPALITY" property="isMunicipality" jdbcType="VARCHAR"/>
<result column="IS_CHECK_BLOCK_CHAIN" property="isCheckBlockChain" jdbcType="VARCHAR"/>
</resultMap>
<!-- 新增区域信息 -->
<insert id="addArea" parameterType="com.dxhy.bxsdk.api.domain.area.Area">
INSERT INTO
sys_area (PID, AREA_NAME)
VALUES
(#{pid}, #{areaName})
</insert>
<!-- 更新区域名称字段 -->
<update id="updateArea" parameterType="com.dxhy.bxsdk.api.domain.area.Area">
UPDATE
sys_area
SET
AREA_NAME = #{areaName}
WHERE
ID = #{id}
</update>
<!-- 根据ID删除对应区域信息 -->
<delete id="deleteAreaById" parameterType="java.lang.Long">
DELETE FROM
sys_area
WHERE
ID = #{id}
</delete>
<!-- 根据pid查询区域信息 -->
<select id="getAreaListByPid" resultMap="areaResultMap">
SELECT
ID,PID,AREA_NAME,LEVEL,IS_MUNICIPALITY
FROM
sys_area WHERE PID = #{pid}
</select>
<!-- 根据id查询对应区域信息 -->
<select id="getAreaById" resultMap="areaResultMap">
SELECT
ID,PID,AREA_NAME,LEVEL,IS_MUNICIPALITY
FROM
sys_area WHERE ID = #{id}
</select>
<!-- 按名称查找其他城市中的城市 -->
<select id="queryAreaByName" parameterType="java.lang.String" resultMap="areaResultMap">
SELECT
ID,PID,AREA_NAME,LEVEL,IS_MUNICIPALITY
FROM
sys_area
WHERE
#{areaName} LIKE CONCAT ('%',AREA_NAME,'%')
</select>
<select id="getAllAreaList" resultMap="areaResultMap">
SELECT
ID,PID,AREA_NAME,LEVEL,IS_MUNICIPALITY
FROM
sys_area
</select>
<select id="getBlockChainProviceList" resultMap="areaResultMap">
SELECT
ID,PID,AREA_NAME,LEVEL,IS_MUNICIPALITY,IS_CHECK_BLOCK_CHAIN
FROM
sys_area
WHERE
LEVEL in ('1','2')
AND
ID not in ('33', '34', '35')
</select>
</mapper>

@ -0,0 +1,378 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dxhy.bxsdk.business.dao.OrgUserInfoDao">
<!-- 新增员工信息 -->
<insert id="addUserInfoList" parameterType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo">
INSERT INTO
org_user_info
(user_id, user_name, identity_number, create_time, enterprise_id, tax_no, is_white_list, phone, email, password, enterprise_code_list)
VALUES
<foreach collection="orgUserInfoList" item="item" index="index" separator=",">
(#{item.userId}, #{item.userName}, #{item.identityNumber},
now(), #{item.enterpriseId}, #{item.taxNo}, #{item.isWhiteList}, #{item.phone}, #{item.email}, #{item.password}, #{item.enterpriseId})
</foreach>
</insert>
<!-- 查询员工信息列表 -->
<select id="getUserInfoList" resultType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo" >
SELECT * FROM
org_user_info
WHERE
1 = 1
<if test="userId != null and userId != ''">
AND
user_id = #{userId}
</if>
<if test="enterpriseId != null and enterpriseId != ''">
AND
enterprise_id = #{enterpriseId}
</if>
<if test="taxNo != null and taxNo != ''">
AND
tax_no = #{taxNo}
</if>
<if test="identityNumber != null and identityNumber != ''">
AND
identity_number = #{identityNumber}
</if>
<if test="userName != null and userName != ''">
AND
user_name = #{userName}
</if>
<if test="isWhiteList != null and isWhiteList != ''">
AND
is_white_list = #{isWhiteList}
</if>
<if test="email != null and email != ''">
AND
email = #{email}
</if>
</select>
<!-- 删除员工信息 -->
<delete id="deleteUserInfo" parameterType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo">
DELETE FROM
org_user_info
WHERE
USER_ID = #{orgUserInfo.userId}
</delete>
<!-- 更新员工信息(可批量) -->
<delete id="updateUserInfo" parameterType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo">
<foreach collection="orgUserInfoList" item="item" index="index" open="" close="" separator=";">
UPDATE
org_user_info
<set>
<if test="item.userName != null and item.userName != ''">
user_name = #{item.userName},
</if>
<if test="item.identityNumber != null and item.identityNumber != ''">
identity_number = #{item.identityNumber},
</if>
<if test="item.isWhiteList != null and item.isWhiteList != ''">
is_white_list = #{item.isWhiteList},
</if>
<if test="item.taxNo != null and item.taxNo != ''">
tax_no = #{item.taxNo},
</if>
<if test="item.identityNumber != null and item.identityNumber != ''">
identity_number = #{item.identityNumber},
</if>
<if test="item.phone != null and item.phone != ''">
phone = #{item.phone},
</if>
<if test="item.password != null and item.password != ''">
password = #{item.password},
</if>
<if test="item.enterpriseId != null and item.enterpriseId != ''">
enterprise_id = #{item.enterpriseId},
enterprise_code_list = #{item.enterpriseId},
</if>
update_time = now(),
wechat_sync_flag = '0'
</set>
WHERE
user_id = #{item.userId}
AND
enterprise_id = #{item.enterpriseId}
</foreach>
</delete>
<select id="getUserIdentityNumber" resultType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo" >
SELECT * FROM
org_user_info
WHERE
1 = 1
<if test="identityNumber != null and identityNumber != ''">
AND
identity_number LIKE CONCAT('%', #{identityNumber})
</if>
<if test="userName != null and userName != ''">
AND
user_name LIKE CONCAT('%', #{userName}, '%')
</if>
</select>
<select id="countUserByIdentityNumber" resultType="java.lang.Integer" >
SELECT
COUNT(ID)
FROM
org_user_info
WHERE
1 = 1
AND
identity_number = #{identityNumber}
AND
user_name = #{userName}
</select>
<select id="getUserIdentityNumberAndEnterpriseId" resultType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo" >
SELECT * FROM
org_user_info
WHERE
1 = 1
<if test="identityNumber != null and identityNumber != ''">
AND
identity_number = #{identityNumber}
</if>
<if test="userName != null and userName != ''">
AND
user_name = #{userName}
</if>
<if test="enterpriseId != null and enterpriseId != ''">
AND
enterprise_id = #{enterpriseId}
</if>
</select>
<!-- 根据用户姓名、身份证号码后四位查询完整身份证号码 -->
<select id="getIdentityNumberByNameAndFourId" resultType="java.lang.String" >
SELECT
identity_number
FROM
org_user_info
WHERE
right(identity_number, 4) = #{fourID}
AND
user_name=#{userName}
GROUP BY
identity_number
</select>
<select id="selectCount" parameterType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo"
resultType="int">
select count(*) from
org_user_info
WHERE
1 = 1
<if test="orgUserInfo.userId != null and orgUserInfo.userId != ''">
AND
user_id = #{orgUserInfo.userId}
</if>
<if test="orgUserInfo.enterpriseId != null and orgUserInfo.enterpriseId != ''">
AND
enterprise_id = #{orgUserInfo.enterpriseId}
</if>
<if test="orgUserInfo.taxNo != null and orgUserInfo.taxNo != ''">
AND
tax_no = #{orgUserInfo.taxNo}
</if>
<if test="orgUserInfo.identityNumber != null and orgUserInfo.identityNumber != ''">
AND
identity_number = #{orgUserInfo.identityNumber}
</if>
<if test="orgUserInfo.userName != null and orgUserInfo.userName != ''">
AND
user_name LIKE CONCAT('%', #{orgUserInfo.userName}, '%')
</if>
<if test="orgUserInfo.isWhiteList != null and orgUserInfo.isWhiteList != ''">
AND
is_white_list = #{orgUserInfo.isWhiteList}
</if>
</select>
<select id="selectWhiteByParam" resultType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo">
SELECT * FROM
org_user_info
WHERE
1 = 1
<if test="orgUserInfo.userId != null and orgUserInfo.userId != ''">
AND
user_id = #{orgUserInfo.userId}
</if>
<if test="orgUserInfo.enterpriseId != null and orgUserInfo.enterpriseId != ''">
AND
enterprise_id = #{orgUserInfo.enterpriseId}
</if>
<if test="orgUserInfo.taxNo != null and orgUserInfo.taxNo != ''">
AND
tax_no = #{orgUserInfo.taxNo}
</if>
<if test="orgUserInfo.identityNumber != null and orgUserInfo.identityNumber != ''">
AND
identity_number = #{orgUserInfo.identityNumber}
</if>
<if test="orgUserInfo.userName != null and orgUserInfo.userName != ''">
AND
user_name LIKE CONCAT('%', #{orgUserInfo.userName}, '%')
</if>
<if test="orgUserInfo.isWhiteList != null and orgUserInfo.isWhiteList != ''">
AND
is_white_list = #{orgUserInfo.isWhiteList}
</if>
ORDER BY create_time DESC
<if test='page >= 0 and page != null and rows >0 and rows != null'>
LIMIT #{page},#{rows}
</if>
</select>
<update id="updateWhiteUserById" parameterType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo">
update org_user_info
set is_white_list = "Y",
enterprise_code_list = #{enterpriseCodeList,jdbcType=VARCHAR},
enterprise_name = #{enterpriseName,jdbcType=VARCHAR},
update_time = now(),
wechat_sync_flag = '0'
where id = #{id,jdbcType=INTEGER}
</update>
<update id="disableWhiteById">
update org_user_info
set is_white_list = "N",
update_time = now()
WHERE id = #{id}
</update>
<update id="updateAuthstatus">
update org_user_info
set auth_status = #{authStatus},
update_time = now()
WHERE user_id = #{userId}
</update>
<!-- 查询所有员工信息列表 -->
<select id="getAllUserInfoList" resultType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo" >
SELECT * FROM
org_user_info
</select>
<update id="batchUpdateEnterpriseUserList" parameterType="java.util.List">
UPDATE org_user_info
<set>
wechat_sync_flag = 'Y'
</set>
where id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="batchUpdateEnterpriseUserListById" parameterType="com.dxhy.bxsdk.api.domain.wechat.BxwxEnterpriseUserEntity">
<foreach item="item" index="index" collection="list" separator=";">
UPDATE org_user_info
<set>
<if test="item.syncOnlyId != null and item.syncOnlyId != ''">
sync_only_id = #{item.syncOnlyId},
</if>
wechat_sync_flag = 'Y'
</set>
where id = #{item.id}
</foreach>
</update>
<!-- 新增员工信息 -->
<insert id="saveUserInfo" parameterType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo">
INSERT INTO
org_user_info
(user_id,
user_name,
identity_number,
phone,
create_time,
enterprise_id,
enterprise_name,
is_white_list,
enterprise_code_list,
enterprise_name_list)
VALUES
(#{userId},
#{userName},
#{identityNumber},
#{phone},
now(),
#{enterpriseId},
#{enterpriseName},
#{isWhiteList},
#{enterpriseCodeList},
#{enterpriseNameList})
</insert>
<!-- 更新员工信息(可批量) -->
<update id="updateUserInfoSingle" parameterType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo">
UPDATE
org_user_info
<set>
<if test="userName != null and userName != ''">
user_name = #{userName},
</if>
<if test="identityNumber != null and identityNumber != ''">
identity_number = #{identityNumber},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="isWhiteList != null and isWhiteList != ''">
is_white_list = #{isWhiteList},
</if>
<if test="enterpriseId != null and enterpriseId != ''">
enterprise_id = #{enterpriseId},
</if>
<if test="enterpriseName != null and enterpriseName != ''">
enterprise_name = #{enterpriseName},
</if>
<if test="enterpriseCodeList != null and enterpriseCodeList != ''">
enterprise_code_list = #{enterpriseCodeList},
</if>
<if test="enterpriseNameList != null and enterpriseNameList != ''">
enterprise_name_list = #{enterpriseNameList},
</if>
create_time = now(),
update_time = now(),
wechat_sync_flag = '0'
</set>
WHERE
user_id = #{userId}
</update>
<select id="getUserInfoListByIsWhile" resultType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo" >
SELECT * FROM
org_user_info
WHERE
1 = 1
<if test="userName != null and userName != ''">
AND
user_name LIKE CONCAT('%', #{userName}, '%')
</if>
<if test="isWhiteList != null and isWhiteList != ''">
AND
is_white_list = #{isWhiteList}
</if>
order by create_time desc
</select>
<select id="queryUserListByUserName" resultType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo" >
SELECT * FROM
org_user_info
WHERE
1 = 1
AND
user_name = #{userName}
</select>
<select id="findByCondition" resultType="com.dxhy.bxsdk.api.domain.simple.OrgUserInfo">
select * from org_user_info where user_id = #{userId}
</select>
</mapper>
Loading…
Cancel
Save