自助开票链接取消功能

master
wanghaomei 2 years ago
parent f2ddabf2ea
commit ace714e754

@ -15,6 +15,9 @@ public class HttpResult<T> {
@Schema(description = "业务数据")
private T data;
@Schema(description = "成功标志")
private boolean success = true;
private String type;
public String getType() {
@ -41,6 +44,7 @@ public class HttpResult<T> {
HttpResult<T> r = new HttpResult<>();
r.setCode(code);
r.setMsg(msg);
r.setSuccess(false);
return r;
}
@ -63,6 +67,7 @@ public class HttpResult<T> {
r.setCode(code);
r.setMsg(msg);
r.setData(data);
r.setSuccess(false);
return r;
}
@ -77,12 +82,14 @@ public class HttpResult<T> {
HttpResult<T> r = new HttpResult<>();
r.setMsg(msg);
r.setData(obj);
r.setSuccess(true);
return r;
}
public static <T> HttpResult<T> ok(T data) {
HttpResult<T> r = new HttpResult<>();
r.setData(data);
r.setSuccess(true);
return r;
}
@ -92,6 +99,7 @@ public class HttpResult<T> {
resultMap.put("obj", data);
HttpResult<Map<String, Object>> r = new HttpResult<>();
r.setData(resultMap);
r.setSuccess(true);
return r;
}
@ -115,6 +123,14 @@ public class HttpResult<T> {
this.msg = msg;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public T getData() {
return data;
}
@ -128,6 +144,7 @@ public class HttpResult<T> {
r.code = retCode;
r.msg = msg;
r.data = retData;
r.setSuccess(false);
return r;
}

@ -1,9 +1,6 @@
package com.djy.invoice.controller;
import com.alibaba.fastjson.JSONObject;
import com.djy.core.http.HttpResult;
import com.djy.invoice.dto.SendEmail;
import com.djy.invoice.dto.SendEmailParams;
import com.djy.invoice.model.InvInvoiceInfo;
import com.djy.invoice.model.InvLinkInfo;
import com.djy.invoice.service.InvLinkInfoService;
@ -13,7 +10,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
@ -70,6 +66,14 @@ public class InvLinkInfoController {
return HttpResult.ok(list);
}
@Operation(description = "取消发票自助链接")
@PostMapping("cancelLink")
public HttpResult cancelLink(String linkId)
{
return invLinkInfoService.cancelLink(linkId);
}
// @Operation(description = "获取参数")
// @PostMapping("getParameter")
// public HttpResult getParameter() {

@ -12,6 +12,10 @@ import java.util.List;
@Getter
@Setter
public class InvLinkInfo {
public static final String StatusCreate = "0";
public static final String StatusSent = "1";
public static final String StatusAllFinish = "2";
public static final String StatusPartFinish = "3";
private String GID;
@ -28,7 +32,9 @@ public class InvLinkInfo {
private Date ModifyTime;
//通知邮箱
private String Email;
//状态(未开票、开票中、已开票、部分开票)
/**
* 0123
*/
private String Status;
//Remark
private String Remark;

@ -2,6 +2,7 @@ package com.djy.invoice.model.mapper;
import com.djy.core.cmapper.CommonMapper;
import com.djy.invoice.model.InvLinkInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -11,6 +12,8 @@ public interface InvLinkInfoMapper extends CommonMapper<InvLinkInfo> {
InvLinkInfo selectByGID(InvLinkInfo linkinfo);
InvLinkInfo getByGID(@Param("linkId") String linkId);
void add(InvLinkInfo linkinfo);
void deleteByGID(InvLinkInfo linkinfo);
@ -21,5 +24,6 @@ public interface InvLinkInfoMapper extends CommonMapper<InvLinkInfo> {
List<InvLinkInfo> selectLinkInfoByStatus();
void clearInvLink(@Param("linkId") String linkId);
}

@ -22,4 +22,6 @@ public interface InvLinkInfoService {
HttpResult getInvoice(InvLinkInfo info);
List<InvInvoiceInfo> getLinkInvoice(InvLinkInfo info);
HttpResult cancelLink(String linkId);
}

@ -2,7 +2,6 @@ package com.djy.invoice.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.djy.core.http.HttpResult;
import com.djy.invoice.dto.*;
@ -734,6 +733,28 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
}
/**
*
*
* @param linkId
* @return
*/
public HttpResult cancelLink(String linkId) {
log.info("取消发票链接:{}", linkId);
InvLinkInfo linkInfo = invLinkInfoMapper.getByGID(linkId);
if (linkInfo == null) {
log.info("取消发票链接返回:未找到数据{}",linkId);
return HttpResult.error(1001, "未找到相关数据");
} else if (!linkInfo.getStatus().equals(InvLinkInfo.StatusCreate)) {
log.info("取消发票链接返回:当前状态不能取消{}",linkId);
return HttpResult.error(1002, "当前状态不能取消");
} else {
clearLinkAll(linkId);
log.info("取消发票链接返回:操作成功{}",linkId);
return HttpResult.okWithMsg("操作成功");
}
}
// @Transactional
// @Override
//生成发票、发票明细、发票分配
@ -858,7 +879,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
List<InvBusinessInfo> businesses = new ArrayList<>();
for (String str : businessIds) {
InvBusinessInfo business = invBusinessInfoMapper.getById(str);
List<InvFeeInfo> list = invFeeInfoMapper.getListByBusinessIdAndLinkId(business.getGID(),link.getGID());
List<InvFeeInfo> list = invFeeInfoMapper.getListByBusinessIdAndLinkId(business.getGID(), link.getGID());
//获取人民币合计
List<InvFeeInfo> rmbfees = list.stream().filter(s -> s.getCurrency().equals("RMB")).filter(s -> s.getBusinessId().equals(str)).collect(Collectors.toList());
@ -1328,4 +1349,14 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
public void setUrlPath(String urlPath) {
InvLinkInfoServiceImpl.urlPath = urlPath;
}
//region 私有方法
/**
*
*/
private void clearLinkAll(String linkId) {
invLinkInfoMapper.clearInvLink(linkId);
}
//endregion
}

@ -36,6 +36,10 @@
SELECT * from InvLinkInfo linkinfo where linkinfo.GID = #{GID}
</select>
<select id="getByGID" resultMap="invLinkInfoMap" parameterType="String">
SELECT * from InvLinkInfo linkinfo where linkinfo.GID = #{linkId}
</select>
<select id="selectLinkInfoByStatus" resultMap="invLinkInfoMap" >
SELECT * from InvLinkInfo linkinfo where linkinfo.Status='1'
</select>
@ -58,6 +62,13 @@
delete from InvLinkInfo where GID=#{GID}
</delete>
<delete id="clearInvLink" parameterType="String" >
delete from InvLinkInfo where GID=#{linkId};
delete from InvFeeInfo where LinkId=#{linkId};
delete from InvInvoiceInfo where GID in (select InvoiceId from InvInvoiceSplit where LinkId=#{linkId});
delete from InvInvoiceDetail where GID in (select InvoiceDetailId from InvInvoiceSplit where LinkId=#{linkId});
delete from InvInvoiceSplit where LinkId=#{linkId};
</delete>
<update id="updateById" parameterType="com.djy.invoice.model.InvLinkInfo" >

Loading…
Cancel
Save