Merge branch 'cc_20241226_ocr' into 'master'

Cc 20241226 ocr

See merge request hangzhou/java/custom_zxjp!37
This commit is contained in:
苏竹红
2025-01-03 08:59:58 +00:00
31 changed files with 1126 additions and 16 deletions

View File

@@ -198,6 +198,8 @@ public enum ErrorCodeEnum {
DUPLICATE_SUBMISSION(109015, "重复提交!", null),
INVOICING_EXIST(109016, "当前门店发票信息已存在!", null),
INSERT_OPENING_OPERATION_PLAN_AUDIT_FALSE(103001,"插入运营方案审核信息失败",null),
INSERT_OPENING_OPERATION_PLAN_FALSE(103002,"插入运营方案失败",null),
@@ -221,7 +223,7 @@ public enum ErrorCodeEnum {
FITMENT_FAIL(12003,"装修款阶段未完成",null),
SEE_ACCEPTANCE_ERROR(12004,"获取鲜丰撤场数据失败",null),
SEE_ACCEPTANCE_AUDIT_NULL(12005,"视觉验收结果为空",null),
STATUS_NOT_SUPPORT_SUMMIT(121006,"该状态不支持上传",null),
STATUS_NOT_SUPPORT_SUMMIT(121006,"该状态不支持提交",null),
DESIGN_NO_COMPLETE(121007,"请先完成设计阶段!",null),
SIGN_COMPLETED(121008,"你已完成验收,无需重复操作!",null),

View File

@@ -20,6 +20,7 @@ public enum ShopSubStageEnum {
SHOP_STAGE_5(ShopStageEnum.SHOP_STAGE_2, 50, "员工招聘", 23),
SHOP_STAGE_7(ShopStageEnum.SHOP_STAGE_2, 70, "缴纳加盟费/保证金", 1),
SHOP_STAGE_8(ShopStageEnum.SHOP_STAGE_2, 80, "加盟合同签约", 4),
SHOP_STAGE_8_5(ShopStageEnum.SHOP_STAGE_2, 85, "发票回传", 5),
SHOP_STAGE_9(ShopStageEnum.SHOP_STAGE_2, 90, "设计阶段", 14),
SHOP_STAGE_11(ShopStageEnum.SHOP_STAGE_2, 110, "施工阶段", 25),
SHOP_STAGE_12(ShopStageEnum.SHOP_STAGE_2, 120, "装修验收", 27),
@@ -105,6 +106,7 @@ public enum ShopSubStageEnum {
case SHOP_STAGE_3:
case SHOP_STAGE_4:
case SHOP_STAGE_8:
case SHOP_STAGE_8_5:
case SHOP_STAGE_9:
case SHOP_STAGE_11:
case SHOP_STAGE_12:

View File

@@ -49,6 +49,11 @@ public enum ShopSubStageStatusEnum {
SHOP_SUB_STAGE_STATUS_84(ShopSubStageEnum.SHOP_STAGE_8, 840, "已签约", Boolean.TRUE),
SHOP_SUB_STAGE_STATUS_85(ShopSubStageEnum.SHOP_STAGE_8, 850, "退回", Boolean.FALSE),
//发票回传
SHOP_SUB_STAGE_STATUS_85_1(ShopSubStageEnum.SHOP_STAGE_8_5, 880, "待提交", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_85_3(ShopSubStageEnum.SHOP_STAGE_8_5, 890, "已完成", Boolean.TRUE),
//设计阶段
SHOP_SUB_STAGE_STATUS_90(ShopSubStageEnum.SHOP_STAGE_9, 900, "待上传", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_905(ShopSubStageEnum.SHOP_STAGE_9, 905, "待确认", Boolean.FALSE),

View File

@@ -0,0 +1,45 @@
package com.cool.store.dao;
import com.cool.store.entity.InvoicingDO;
import com.cool.store.mapper.InvoicingMapper;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Date;
/**
* @Author suzhuhong
* @Date 2024/12/31 13:37
* @Version 1.0
*/
@Repository
public class InvoicingDAO {
@Resource
InvoicingMapper invoicingMapper;
public Integer add(InvoicingDO invoicingDO){
return invoicingMapper.insertSelective(invoicingDO);
}
public Integer update(InvoicingDO invoicingDO){
invoicingDO.setUpdateTime(new Date());
return invoicingMapper.updateByPrimaryKey(invoicingDO);
}
public InvoicingDO getByShopId(Long shopId){
if (shopId == null){
return null;
}
return invoicingMapper.selectByShopId(shopId);
}
public InvoicingDO getById(Long id){
if (id == null){
return null;
}
return invoicingMapper.selectByPrimaryKey(id);
}
}

View File

@@ -336,4 +336,14 @@ public class ShopStageInfoDAO {
}
return shopStageInfoMapper.getPlatformBuildStage(shopIds);
}
/**
* 数据处理 查询所有子阶段 通过子阶段对应的阶段状态 做对应的数据处理
* @param shopSubStage
* @return
*/
public List<ShopStageInfoDO> getSubStages(Integer shopSubStage){
return shopStageInfoMapper.getSubStageList(null,shopSubStage);
}
}

View File

@@ -0,0 +1,15 @@
package com.cool.store.mapper;
import com.cool.store.entity.InvoicingDO;
import tk.mybatis.mapper.common.Mapper;
public interface InvoicingMapper extends Mapper<InvoicingDO> {
/**
* 根据shopId查询
* @param shopId
* @return
*/
InvoicingDO selectByShopId(Long shopId);
}

View File

@@ -0,0 +1,37 @@
<?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.cool.store.mapper.InvoicingMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.InvoicingDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="invoice_url" jdbcType="VARCHAR" property="invoiceUrl" />
<result column="invoice_date" jdbcType="VARCHAR" property="invoiceDate" />
<result column="invoice_number" jdbcType="VARCHAR" property="invoiceNumber" />
<result column="franchise_fee" jdbcType="DECIMAL" property="franchiseFee" />
<result column="franchise_fee_tax" jdbcType="DECIMAL" property="franchiseFeeTax" />
<result column="management_fee" jdbcType="DECIMAL" property="managementFee" />
<result column="management_fee_tax" jdbcType="DECIMAL" property="managementFeeTax" />
<result column="brand_usage_fee" jdbcType="DECIMAL" property="brandUsageFee" />
<result column="brand_usage_fee_tax" jdbcType="DECIMAL" property="brandUsageFeeTax" />
<result column="design_service_fee" jdbcType="DECIMAL" property="designServiceFee" />
<result column="design_service_fee_tax" jdbcType="DECIMAL" property="designServiceFeeTax" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
</resultMap>
<select id="selectByShopId" resultMap="BaseResultMap">
select * from xfsg_invoicing
<where>
<if test="shopId!=null">
and shop_id=#{shopId}
</if>
</where>
</select>
</mapper>

View File

@@ -3,6 +3,6 @@ jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcoll
jdbc.user= coolstore
jdbc.password = CSCErYcXniNYm7bT
table.name = xfsg_qualifications_info
table.object.class = QualificationsInfoDO
table.mapper = QualificationsInfoMapper
table.name = xfsg_invoicing
table.object.class = InvoicingDO
table.mapper = InvoicingMapper

View File

@@ -0,0 +1,113 @@
package com.cool.store.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.math.BigDecimal;
/**
* @Author suzhuhong
* @Date 2024/12/31 13:46
* @Version 1.0
*/
@Data
@ApiModel("发票DTO")
public class InvoicingDTO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("ID")
private Long id;
/**
* xfsg_shop_info.id
*/
@Column(name = "shop_id")
@ApiModelProperty("shopId")
private Long shopId;
/**
* 发票URL
*/
@Column(name = "invoice_url")
@ApiModelProperty("ID")
private String invoiceUrl;
/**
* 开票日期
*/
@Column(name = "invoice_date")
@ApiModelProperty("开票日期")
private String invoiceDate;
/**
* 票据编码
*/
@Column(name = "invoice_number")
@ApiModelProperty("票据编码")
private String invoiceNumber;
/**
* 加盟费
*/
@Column(name = "franchise_fee")
@ApiModelProperty("加盟费")
private BigDecimal franchiseFee;
/**
* 加盟费税
*/
@Column(name = "franchise_fee_tax")
@ApiModelProperty("加盟费税")
private BigDecimal franchiseFeeTax;
/**
* 管理费
*/
@Column(name = "management_fee")
@ApiModelProperty("管理费")
private BigDecimal managementFee;
/**
* 管理费税
*/
@Column(name = "management_fee_tax")
@ApiModelProperty("管理费税")
private BigDecimal managementFeeTax;
/**
* 品牌使用费
*/
@Column(name = "brand_usage_fee")
@ApiModelProperty("品牌使用费")
private BigDecimal brandUsageFee;
/**
* 品牌使用费税
*/
@Column(name = "brand_usage_fee_tax")
@ApiModelProperty("品牌使用费税")
private BigDecimal brandUsageFeeTax;
/**
* 设计服务费
*/
@Column(name = "design_service_fee")
@ApiModelProperty("设计服务费")
private BigDecimal designServiceFee;
/**
* 设计服务费税
*/
@Column(name = "design_service_fee_tax")
@ApiModelProperty("设计服务费税")
private BigDecimal designServiceFeeTax;
}

View File

@@ -0,0 +1,33 @@
package com.cool.store.dto.ocr;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2024/12/30 16:14
* @Version 1.0
*/
@Data
public class InvoiceDTO {
@ApiModelProperty(value = "发票号码")
private String invoiceNumber;
@ApiModelProperty(value = "发票日期")
private String invoiceDate;
@ApiModelProperty(value = "发票明细")
private List<InvoiceDetailDTO> invoiceDetails;
@Data
class InvoiceDetailDTO{
@ApiModelProperty(value = "发票明细名称")
private String itemName;
@ApiModelProperty(value = "发票明细金额")
private String amount;
@ApiModelProperty(value = "发票明细税额")
private String tax;
}
}

View File

@@ -0,0 +1,410 @@
package com.cool.store.entity;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
@Table(name = "xfsg_invoicing")
public class InvoicingDO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* xfsg_shop_info.id
*/
@Column(name = "shop_id")
private Long shopId;
/**
* 创建人
*/
@Column(name = "invoice_url")
private String invoiceUrl;
/**
* 开票日期
*/
@Column(name = "invoice_date")
private String invoiceDate;
/**
* 票据编码
*/
@Column(name = "invoice_number")
private String invoiceNumber;
/**
* 加盟费
*/
@Column(name = "franchise_fee",scale = 2)
private BigDecimal franchiseFee;
/**
* 加盟费税
*/
@Column(name = "franchise_fee_tax",scale = 2)
private BigDecimal franchiseFeeTax;
/**
* 管理费
*/
@Column(name = "management_fee",scale = 2)
private BigDecimal managementFee;
/**
* 管理费税
*/
@Column(name = "management_fee_tax",scale = 2)
private BigDecimal managementFeeTax;
/**
* 品牌使用费
*/
@Column(name = "brand_usage_fee",scale = 2)
private BigDecimal brandUsageFee;
/**
* 品牌使用费税
*/
@Column(name = "brand_usage_fee_tax",scale = 2)
private BigDecimal brandUsageFeeTax;
/**
* 设计服务费
*/
@Column(name = "design_service_fee",scale = 2)
private BigDecimal designServiceFee;
/**
* 设计服务费税
*/
@Column(name = "design_service_fee_tax",scale = 2)
private BigDecimal designServiceFeeTax;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 更新时间
*/
@Column(name = "update_time")
private Date updateTime;
/**
* 创建人
*/
@Column(name = "create_user_id")
private String createUserId;
/**
* 更新人
*/
@Column(name = "update_user_id")
private String updateUserId;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取xfsg_shop_info.id
*
* @return shop_id - xfsg_shop_info.id
*/
public Long getShopId() {
return shopId;
}
/**
* 设置xfsg_shop_info.id
*
* @param shopId xfsg_shop_info.id
*/
public void setShopId(Long shopId) {
this.shopId = shopId;
}
/**
* 获取创建人
*
* @return invoice_url - 创建人
*/
public String getInvoiceUrl() {
return invoiceUrl;
}
/**
* 设置创建人
*
* @param invoiceUrl 创建人
*/
public void setInvoiceUrl(String invoiceUrl) {
this.invoiceUrl = invoiceUrl;
}
/**
* 获取开票日期
*
* @return invoice_date - 开票日期
*/
public String getInvoiceDate() {
return invoiceDate;
}
/**
* 设置开票日期
*
* @param invoiceDate 开票日期
*/
public void setInvoiceDate(String invoiceDate) {
this.invoiceDate = invoiceDate;
}
/**
* 获取票据编码
*
* @return invoice_number - 票据编码
*/
public String getInvoiceNumber() {
return invoiceNumber;
}
/**
* 设置票据编码
*
* @param invoiceNumber 票据编码
*/
public void setInvoiceNumber(String invoiceNumber) {
this.invoiceNumber = invoiceNumber;
}
/**
* 获取加盟费
*
* @return franchise_fee - 加盟费
*/
public BigDecimal getFranchiseFee() {
return franchiseFee;
}
/**
* 设置加盟费
*
* @param franchiseFee 加盟费
*/
public void setFranchiseFee(BigDecimal franchiseFee) {
this.franchiseFee = franchiseFee;
}
/**
* 获取加盟费税
*
* @return franchise_fee_tax - 加盟费税
*/
public BigDecimal getFranchiseFeeTax() {
return franchiseFeeTax;
}
/**
* 设置加盟费税
*
* @param franchiseFeeTax 加盟费税
*/
public void setFranchiseFeeTax(BigDecimal franchiseFeeTax) {
this.franchiseFeeTax = franchiseFeeTax;
}
/**
* 获取管理费
*
* @return management_fee - 管理费
*/
public BigDecimal getManagementFee() {
return managementFee;
}
/**
* 设置管理费
*
* @param managementFee 管理费
*/
public void setManagementFee(BigDecimal managementFee) {
this.managementFee = managementFee;
}
/**
* 获取管理费税
*
* @return management_fee_tax - 管理费税
*/
public BigDecimal getManagementFeeTax() {
return managementFeeTax;
}
/**
* 设置管理费税
*
* @param managementFeeTax 管理费税
*/
public void setManagementFeeTax(BigDecimal managementFeeTax) {
this.managementFeeTax = managementFeeTax;
}
/**
* 获取品牌使用费
*
* @return brand_usage_fee - 品牌使用费
*/
public BigDecimal getBrandUsageFee() {
return brandUsageFee;
}
/**
* 设置品牌使用费
*
* @param brandUsageFee 品牌使用费
*/
public void setBrandUsageFee(BigDecimal brandUsageFee) {
this.brandUsageFee = brandUsageFee;
}
/**
* 获取品牌使用费税
*
* @return brand_usage_fee_tax - 品牌使用费税
*/
public BigDecimal getBrandUsageFeeTax() {
return brandUsageFeeTax;
}
/**
* 设置品牌使用费税
*
* @param brandUsageFeeTax 品牌使用费税
*/
public void setBrandUsageFeeTax(BigDecimal brandUsageFeeTax) {
this.brandUsageFeeTax = brandUsageFeeTax;
}
/**
* 获取设计服务费
*
* @return design_service_fee - 设计服务费
*/
public BigDecimal getDesignServiceFee() {
return designServiceFee;
}
/**
* 设置设计服务费
*
* @param designServiceFee 设计服务费
*/
public void setDesignServiceFee(BigDecimal designServiceFee) {
this.designServiceFee = designServiceFee;
}
/**
* 获取设计服务费税
*
* @return design_service_fee_tax - 设计服务费税
*/
public BigDecimal getDesignServiceFeeTax() {
return designServiceFeeTax;
}
/**
* 设置设计服务费税
*
* @param designServiceFeeTax 设计服务费税
*/
public void setDesignServiceFeeTax(BigDecimal designServiceFeeTax) {
this.designServiceFeeTax = designServiceFeeTax;
}
/**
* 获取创建时间
*
* @return create_time - 创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取更新时间
*
* @return update_time - 更新时间
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* 设置更新时间
*
* @param updateTime 更新时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取创建人
*
* @return create_user_id - 创建人
*/
public String getCreateUserId() {
return createUserId;
}
/**
* 设置创建人
*
* @param createUserId 创建人
*/
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}
/**
* 获取更新人
*
* @return update_user_id - 更新人
*/
public String getUpdateUserId() {
return updateUserId;
}
/**
* 设置更新人
*
* @param updateUserId 更新人
*/
public void setUpdateUserId(String updateUserId) {
this.updateUserId = updateUserId;
}
}

View File

@@ -52,4 +52,6 @@ public class SignFranchiseDO {
private Date createTime;
@Column(name = "update_time")
private Date updateTime;
@Column(name = "contract_code")
private String contractCode;
}

View File

@@ -63,6 +63,9 @@ public class AddSignFranchiseRequest {
@ApiModelProperty("加盟商联系方式")
private String mobile;
@ApiModelProperty("合同编码")
private String contractCode;
public SignFranchiseDO toSignFranchiseDO() {
SignFranchiseDO signFranchiseDO = new SignFranchiseDO();
@@ -81,6 +84,7 @@ public class AddSignFranchiseRequest {
signFranchiseDO.setRemark(this.remark);
signFranchiseDO.setResign(this.resign);
signFranchiseDO.setMobile(this.mobile);
signFranchiseDO.setContractCode(this.contractCode);
return signFranchiseDO;
}

View File

@@ -160,6 +160,7 @@ public class AddSignFranchiseResponse {
@ApiModelProperty("失败时间")
private Date resultTime;
@ApiModelProperty("合同编码")
private String contractCode;
}

View File

@@ -77,6 +77,11 @@
<artifactId>ocr_api20210707</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>darabonba-stream</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>

View File

@@ -1,5 +1,6 @@
package com.cool.store.service;
import com.cool.store.dto.ocr.InvoiceDTO;
import com.cool.store.enums.IDCardSideEnum;
import com.cool.store.enums.SmsCodeTypeEnum;
import com.cool.store.exception.ApiException;
@@ -7,6 +8,8 @@ import com.cool.store.response.ResponseResult;
import com.cool.store.vo.BusinessLicenseInfoVO;
import com.cool.store.vo.FoodLicenseVO;
import com.cool.store.vo.IdentityCardInfoVO;
import io.swagger.models.auth.In;
import org.springframework.web.multipart.MultipartFile;
public interface AliyunService {
/**
@@ -40,4 +43,11 @@ public interface AliyunService {
* @return
*/
FoodLicenseVO getFoodLicense(String imageUrl) throws ApiException ;
/**
* OCR 发票解析数据
* @param imageUrl
* @return
*/
InvoiceDTO getRecognizeInvoiceWithOptions(String imageUrl);
}

View File

@@ -134,6 +134,16 @@ public interface DeskService {
* @return
*/
PageInfo<PreparationCommonPendingVO> signingOfFranchiseContractPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* 发票回传待处理数据
* @param pageNum
* @param pageSize
* @param user
* @return
*/
PageInfo<PreparationCommonPendingVO> invoiceReturnPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* 开业运营方案待处理数据
* @param pageNum

View File

@@ -0,0 +1,39 @@
package com.cool.store.service;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dto.InvoicingDTO;
import com.cool.store.entity.InvoicingDO;
/**
* @Author suzhuhong
* @Date 2024/12/31 13:44
* @Version 1.0
*/
public interface InvoicingService {
/**
* 提交发票详情
* @param invoicingDTO
* @return
*/
Boolean addInvoicing(InvoicingDTO invoicingDTO, LoginUserInfo userInfo);
/**
* 编辑发票详情
* @param invoicingDTO
* @return
*/
Boolean editInvoicing(InvoicingDTO invoicingDTO,LoginUserInfo userInfo);
/**
* 查询发票详情
* @param shopId
* @return
*/
InvoicingDTO getInvoicingByShopId(Long shopId);
}

View File

@@ -34,7 +34,9 @@ public interface PreparationService {
PreparationProcessVO getPreparationProcess(Long shopId);
/**
* 校验建店与加盟签约合同是否完成 并初始化后续流程数据
* V1.0 校验建店与加盟签约合同是否完成 并初始化后续流程数据
* V1.1 加盟签约合同是否完成 并初始化后续流程数据
* V1.2 新增发票回传阶段 校验发票回传是否完成 并初始化后续流程数据
* @param shopId
*/
void contractAndBuildStoreCompletion(Long shopId);

View File

@@ -3,12 +3,13 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.ocr20191230.models.*;
import com.aliyun.ocr_api20210707.Client;
import com.aliyun.ocr_api20210707.models.RecognizeAdvancedRequest;
import com.aliyun.ocr_api20210707.models.RecognizeFoodManageLicenseRequest;
import com.aliyun.ocr_api20210707.models.RecognizeFoodManageLicenseResponse;
import com.aliyun.ocr20191230.models.RecognizeBusinessLicenseResponse;
import com.aliyun.ocr20191230.models.RecognizeBusinessLicenseResponseBody;
import com.aliyun.ocr_api20210707.models.*;
import com.aliyun.tea.*;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.http.MethodType;
import com.cool.store.dto.ocr.InvoiceDTO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.IDCardSideEnum;
import com.cool.store.enums.SmsCodeTypeEnum;
@@ -17,6 +18,7 @@ import com.cool.store.exception.ServiceException;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.AliyunService;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.BusinessLicenseInfoVO;
import com.cool.store.vo.FoodLicenseVO;
import com.cool.store.vo.IdentityCardInfoVO;
@@ -203,6 +205,39 @@ public class AliyunServiceImpl implements AliyunService {
}
}
@Override
public InvoiceDTO getRecognizeInvoiceWithOptions(String url){
if (StringUtils.isEmpty(url)){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
.setAccessKeyId(accessKeyId)
.setAccessKeySecret(accessKeySecret);
config.endpoint = "ocr-api.cn-hangzhou.aliyuncs.com";
try {
com.aliyun.ocr_api20210707.Client client = new com.aliyun.ocr_api20210707.Client(config);
RecognizeInvoiceRequest recognizeInvoiceRequest = new RecognizeInvoiceRequest().setUrl(url);
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
RecognizeInvoiceResponse recognizeInvoiceResponse = client.recognizeInvoiceWithOptions(recognizeInvoiceRequest, runtime);
InvoiceDTO invoiceDTO = null;
if (recognizeInvoiceResponse!=null&&recognizeInvoiceResponse.getBody()!=null){
String data = recognizeInvoiceResponse.getBody().getData();
if (StringUtils.isNotEmpty(data)){
JSONObject jsonObject = JSONObject.parseObject(data);
Object specialData = jsonObject.get("data");
invoiceDTO = JSONObject.parseObject(JSONObject.toJSONString(specialData), InvoiceDTO.class);
}
}
log.info("普通发票:{}", JSONObject.toJSONString(recognizeInvoiceResponse));
return invoiceDTO;
} catch (Exception _error) {
log.info("getRecognizeInvoiceWithOptions error:{}",_error);
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE,"发票解析异常");
}
}
@Override
public ResponseResult sendMessage(String mobile, SmsCodeTypeEnum codeType) {
String msgKey = codeType + ":" + mobile;

View File

@@ -364,6 +364,12 @@ public class DeskServiceImpl implements DeskService {
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_80.getShopSubStageStatus(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85.getShopSubStageStatus()), Boolean.TRUE);
}
@Override
public PageInfo<PreparationCommonPendingVO> invoiceReturnPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_8_5,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_1.getShopSubStageStatus()), Boolean.FALSE);
}
@Override
public PageInfo<PreparationCommonPendingVO> openingAndOperationPlanPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_14, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus()), Boolean.FALSE);

View File

@@ -0,0 +1,100 @@
package com.cool.store.service.impl;
import ch.qos.logback.classic.jmx.MBeanUtil;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.InvoicingDAO;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.dto.InvoicingDTO;
import com.cool.store.entity.InvoicingDO;
import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.service.InvoicingService;
import com.cool.store.service.PreparationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
/**
* @Author suzhuhong
* @Date 2024/12/31 13:53
* @Version 1.0
*/
@Service
@Slf4j
public class InvoicingServiceImpl implements InvoicingService {
@Resource
private InvoicingDAO invoicingDAO;
@Resource
PreparationService preparationService;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Override
public Boolean addInvoicing(InvoicingDTO invoicingDTO, LoginUserInfo userInfo) {
if (invoicingDTO==null||invoicingDTO.getId()!=null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
InvoicingDO invoicing = invoicingDAO.getByShopId(invoicingDTO.getShopId());
if (invoicing!=null){
throw new ServiceException(ErrorCodeEnum.INVOICING_EXIST);
}
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(invoicingDTO.getShopId(), ShopSubStageEnum.SHOP_STAGE_8_5);
InvoicingDO invoicingDO = new InvoicingDO();
BeanUtil.copyProperties(invoicingDTO, invoicingDO);
invoicingDO.setCreateUserId(userInfo.getUserId());
invoicingDAO.add(invoicingDO);
//新数据待提交时初始化 老数据已数据处理 阶段状态已完成 只做插入操作 无需初始化
if (shopSubStageInfo!=null&&ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_1.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
shopStageInfoDAO.updateShopStageInfo(invoicingDTO.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_3);
////如果发票回传完成 开始设计阶段与验收阶段
preparationService.contractAndBuildStoreCompletion(invoicingDTO.getShopId());
}
return Boolean.TRUE;
}
@Override
public Boolean editInvoicing(InvoicingDTO invoicingDTO,LoginUserInfo userInfo) {
if (invoicingDTO==null||invoicingDTO.getId()==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
InvoicingDO invoicing = invoicingDAO.getById(invoicingDTO.getId());
if (invoicing==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(invoicingDTO.getShopId(), ShopSubStageEnum.SHOP_STAGE_8_5);
//已完成支持编辑
if (shopSubStageInfo!=null&&!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_3.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
throw new ServiceException(ErrorCodeEnum.STATUS_NOT_SUPPORT_SUMMIT);
}
InvoicingDO invoicingDO = new InvoicingDO();
BeanUtil.copyProperties(invoicingDTO, invoicingDO);
invoicingDO.setCreateTime(invoicing.getCreateTime());
invoicingDO.setCreateUserId(invoicing.getCreateUserId());
invoicingDO.setUpdateUserId(userInfo.getUserId());
invoicingDAO.update(invoicingDO);
return Boolean.TRUE;
}
@Override
public InvoicingDTO getInvoicingByShopId(Long shopId) {
if (shopId==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
InvoicingDO invoicingDO = invoicingDAO.getByShopId(shopId);
InvoicingDTO invoicingDTO = new InvoicingDTO();
BeanUtil.copyProperties(invoicingDO, invoicingDTO);
log.info("invoicingDO:{}", JSONObject.toJSONString(invoicingDO));
return invoicingDTO;
}
}

View File

@@ -206,7 +206,7 @@ public class PreparationServiceImpl implements PreparationService {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
if (CollectionUtils.isNotEmpty(shopStageInfo)) {
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
Boolean contractCompletionFlag = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage()).getShopSubStageStatus());
Boolean contractCompletionFlag = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_3.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_8_5.getShopSubStage()).getShopSubStageStatus());
//都完成了 初始化后续流程数据
if (contractCompletionFlag) {
//初始化后续流程数据s

View File

@@ -171,8 +171,8 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
lineInfoMapper.insertOrUpdate(lineInfoDO);
//todo 提交之后先直接到已签约 正常是待审核
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84);
//如果加盟合同完成 开始设计阶段与验收阶段
preparationService.contractAndBuildStoreCompletion(request.getShopId());
//初始化数据
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(),Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_1));
commonService.sendSms(lineInfoDO.getMobile(),SMSMsgEnum.SIGN_CONTRACT);
} else {
signFranchiseMapper.updateByPrimaryKeySelective(signFranchiseDO);
@@ -263,6 +263,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
addSignFranchiseResponse.setRemark(signFranchiseDO.getRemark());
addSignFranchiseResponse.setResign(signFranchiseDO.getResign());
addSignFranchiseResponse.setMobile(signFranchiseDO.getMobile());
addSignFranchiseResponse.setContractCode(signFranchiseDO.getContractCode());
} else {
addSignFranchiseResponse.setMobile(lineInfoDO.getMobile());
}

View File

@@ -126,6 +126,14 @@ public class DeskController {
LoginUserInfo userInfo = CurrentUserHolder.getUser();
return ResponseResult.success(deskService.signingOfFranchiseContractPendingList(pageNumber,pageSize,userInfo));
}
@ApiOperation("待处理-发票回传")
@GetMapping("/invoiceReturnPendingList")
public ResponseResult<PageInfo<PreparationCommonPendingVO>> invoiceReturnPendingList(@RequestParam(value = "pageNumber",required = true,defaultValue = "1")Integer pageNumber,
@RequestParam(value = "pageSize",required = true,defaultValue = "10")Integer pageSize) {
LoginUserInfo userInfo = CurrentUserHolder.getUser();
return ResponseResult.success(deskService.invoiceReturnPendingList(pageNumber,pageSize,userInfo));
}
@ApiOperation("待处理-开店运营方案")
@GetMapping("/openingAndOperationPlanPendingList")
public ResponseResult<PageInfo<PreparationCommonPendingVO>> openingAndOperationPlanPendingList(@RequestParam(value = "pageNumber",required = true,defaultValue = "1")Integer pageNumber,

View File

@@ -0,0 +1,58 @@
package com.cool.store.controller.webb;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dto.InvoicingDTO;
import com.cool.store.request.LineListRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.InvoicingService;
import com.cool.store.vo.LineInfoVO;
import com.cool.store.vo.LineListVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @Author suzhuhong
* @Date 2024/12/31 14:02
* @Version 1.0
*/
@RestController
@RequestMapping("/pc/invoicing")
@Api("发票")
public class InvoicingController {
@Resource
InvoicingService invoicingService;
@ApiOperation("提交发票")
@PostMapping("/submitInvoicing")
public ResponseResult<Boolean> submitInvoicing(@RequestBody InvoicingDTO invoicingDTO) {
LoginUserInfo user = CurrentUserHolder.getUser();
return ResponseResult.success(invoicingService.addInvoicing(invoicingDTO,user));
}
@ApiOperation("编辑发票")
@PostMapping("/editInvoicing")
public ResponseResult<Boolean> editInvoicing(@RequestBody InvoicingDTO invoicingDTO) {
LoginUserInfo user = CurrentUserHolder.getUser();
return ResponseResult.success(invoicingService.editInvoicing(invoicingDTO,user));
}
@ApiOperation("查询发票")
@GetMapping("/getInvoicingByShopId")
@ApiImplicitParams({
@ApiImplicitParam(name = "shopId", value = "门店shopId", required = true)
})
public ResponseResult<InvoicingDTO> getInvoicingByShopId(@RequestParam("shopId")Long shopId) {
return ResponseResult.success(invoicingService.getInvoicingByShopId(shopId));
}
}

View File

@@ -0,0 +1,39 @@
package com.cool.store.controller.webb;
import com.cool.store.dto.ocr.InvoiceDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.AliyunService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author suzhuhong
* @Date 2025/1/2 9:46
* @Version 1.0
*/
@RestController
@RequestMapping({"/pc/orc"})
@Slf4j
@Api(tags = "PC文字识别OCR")
public class PCOcrController {
@Resource
AliyunService aliyunService;
@GetMapping(path = "/getInvoice")
@ApiOperation("根据发票解析获取数据")
public ResponseResult<InvoiceDTO> getInvoice(@RequestParam(value = "imageUrl")String imageUrl){
return ResponseResult.success(aliyunService.getRecognizeInvoiceWithOptions(imageUrl));
}
}

View File

@@ -0,0 +1,42 @@
package com.cool.store.controller.webc;
import com.cool.store.dto.InvoicingDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.InvoicingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author suzhuhong
* @Date 2024/12/31 14:13
* @Version 1.0
*/
@RestController
@RequestMapping("/mini/invoicing")
@Api("小程序发票")
public class MiniInvoicingController {
@Resource
InvoicingService invoicingService;
@ApiOperation("小程序查询发票详情")
@GetMapping("/getInvoicingByShopId")
@ApiImplicitParams({
@ApiImplicitParam(name = "shopId", value = "门店shopId", required = true)
})
public ResponseResult<InvoicingDTO> getInvoicingByShopId(@RequestParam("shopId")Long shopId) {
return ResponseResult.success(invoicingService.getInvoicingByShopId(shopId));
}
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.controller.webc;
import com.cool.store.dto.ocr.InvoiceDTO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.IDCardSideEnum;
import com.cool.store.exception.ServiceException;
@@ -64,4 +65,10 @@ public class OcrController {
throw new ServiceException(ErrorCodeEnum.FOOD_BUSINESS_LICENSE_PARSE_FAIL);
}
}
@GetMapping(path = "/getInvoice")
@ApiOperation("根据发票解析获取数据")
public ResponseResult<InvoiceDTO> getInvoice(@RequestParam(value = "imageUrl")String imageUrl){
return ResponseResult.success(aliyunService.getRecognizeInvoiceWithOptions(imageUrl));
}
}

View File

@@ -1,17 +1,29 @@
package com.cool.store.controller.webc;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.OpenCityDTO;
import com.cool.store.dto.ocr.InvoiceDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.IDCardSideEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ApiException;
import com.cool.store.exception.ServiceException;
import com.cool.store.job.XxlJobHandler;
import com.cool.store.mapper.HyOpenAreaInfoMapper;
import com.cool.store.request.xfsgFirstOrderListRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.xfsgFirstOderListResponse;
import com.cool.store.service.AliyunService;
import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.RegionService;
import com.cool.store.utils.poi.ExcelUtil;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.RegionPathNameVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -19,10 +31,14 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.ByteArrayOutputStream;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -53,6 +69,9 @@ public class TestController {
@Resource
private XxlJobHandler xxlJobHandler;
@Resource
ShopStageInfoDAO shopStageInfoDAO;
@PostMapping("/getFirstOrders")
public ResponseResult<xfsgFirstOderListResponse> getFirstOrders(@RequestBody xfsgFirstOrderListRequest storeCodeList) {
xfsgFirstOderListResponse firstOrderList = coolStoreStartFlowService.getFirstOrderList(storeCodeList);
@@ -192,4 +211,54 @@ public class TestController {
xxlJobHandler.threeAcceptanceBookingMessage();
return ResponseResult.success();
}
@GetMapping("/stageDataHandler")
public ResponseResult stageDataHandler(){
//查询所有完成初始化铺位加盟合同的完成情况
List<ShopStageInfoDO> subStages = shopStageInfoDAO.getSubStages(ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
List<ShopStageInfoDO> existSubStages = shopStageInfoDAO.getSubStages(ShopSubStageEnum.SHOP_STAGE_8_5.getShopSubStage());
//existSubStages
List<Long> shopIds = existSubStages.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
//-100 800 840 如果是-100或者800直接 发票回传是-100 如果是840 发票回传是直接完成 890
List<ShopStageInfoDO> list = new ArrayList<>();
for (ShopStageInfoDO x : subStages) {
if (shopIds.contains(x.getShopId())) {
log.info("已存在");
continue;
}
ShopStageInfoDO shopStageInfo = new ShopStageInfoDO();
shopStageInfo.setLineId(x.getLineId());
shopStageInfo.setShopId(x.getShopId());
//发票回传 是2
ShopStageEnum shopStageEnum = ShopStageEnum.SHOP_STAGE_2;
shopStageInfo.setShopStage(shopStageEnum.getShopStage());
ShopSubStageEnum shopSubStageEnum = ShopSubStageEnum.SHOP_STAGE_8_5;
shopStageInfo.setShopSubStage(shopSubStageEnum.getShopSubStage());
//默认是已完成
ShopSubStageStatusEnum initStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_3;
//如果加盟合同没完成 则发票回传是未开始
if (x.getShopSubStageStatus() == -100 || x.getShopSubStageStatus() == 800) {
initStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00;
}
shopStageInfo.setShopSubStageStatus(initStatus.getShopSubStageStatus());
shopStageInfo.setRemark(shopSubStageEnum.getShopSubStageName() + CommonConstants.PATH_BAR + initStatus.getShopSubStageStatusName());
shopStageInfo.setIsTerminated(Boolean.FALSE);
LocalDate localDate = LocalDate.parse(x.getPlanCompleteTime()).plusDays(1);
shopStageInfo.setPlanCompleteTime(shopSubStageEnum.getPlanCompleteTime(localDate));
list.add(shopStageInfo);
}
log.info("list:{}",JSONObject.toJSONString(list));
shopStageInfoDAO.batchInsert(list);
return ResponseResult.success();
}
}

View File

@@ -1,5 +1,5 @@
spring.application.name=zxjp-web
spring.profiles.active=test
spring.profiles.active=@profileActive@
server.port=40300
server.servlet.context-path=/zxjp
@@ -58,5 +58,5 @@ wx.pay.apiV3Key=wxpayzhenghu123JKJHkjafWXCertUt1
wx.pay.payNotifyUrl=https://abstore-api.coolstore.cn/zxjp/mini/wechatPay/payNotify
wx.pay.backNotifyUrl=https://abstore-api.coolstore.cn/zxjp/mini/wechatPay/refundNotify
aliyun.accessKeyId=LTAI5tQ6QBnWaB5LaJYz6zcD
aliyun.accessKeySecret=spqsOgtfr54cwK861O3N3fInydTgjA
aliyun.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
aliyun.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa