|
|
@@ -16,7 +16,6 @@
|
|
|
*/
|
|
|
package com.trade.purchase.extra.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -27,7 +26,6 @@ import com.smecloud.apigw.constant.HttpMethod;
|
|
|
import com.smecloud.apigw.model.ApiRequest;
|
|
|
import com.smecloud.apigw.model.ApiResult;
|
|
|
import com.smecloud.apigw.model.ApigwConfig;
|
|
|
-import com.smecloud.apigw.util.SHAUtil;
|
|
|
import com.trade.purchase.extra.entity.Claim;
|
|
|
import com.trade.purchase.extra.entity.ClaimItem;
|
|
|
import com.trade.purchase.extra.entity.JdTenant;
|
|
|
@@ -44,7 +42,6 @@ import com.trade.purchase.vojo.JDYitems;
|
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Data;
|
|
|
-import org.apache.commons.codec.binary.Base64;
|
|
|
import org.springblade.check.dto.AuditProecessDTO;
|
|
|
import org.springblade.check.entity.AuditPathsActs;
|
|
|
import org.springblade.check.entity.AuditPathsLevels;
|
|
|
@@ -76,7 +73,6 @@ import java.security.SecureRandom;
|
|
|
import java.security.cert.X509Certificate;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -139,14 +135,14 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
Claim::getClaimDate, claim.getBeginClaimDate(), claim.getEndClaimDate())
|
|
|
.eq(ObjectUtil.isNotEmpty(claim.getUserId()), Claim::getUserId, claim.getUserId())
|
|
|
.eq(ObjectUtil.isNotEmpty(claim.getBelongToCorpId()), Claim::getBelongToCorpId, claim.getBelongToCorpId())
|
|
|
- .eq(ObjectUtil.isNotEmpty(claim.getStatus()),Claim::getStatus, claim.getStatus())
|
|
|
+ .eq(ObjectUtil.isNotEmpty(claim.getStatus()), Claim::getStatus, claim.getStatus())
|
|
|
.eq(Claim::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Claim::getIsDeleted, 0)
|
|
|
.orderByDesc(Claim::getCreateTime);
|
|
|
|
|
|
IPage<Claim> page = baseMapper.selectPage(Condition.getPage(query), leadsQueryWrapper);
|
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(page)){
|
|
|
+ if (ObjectUtil.isNotEmpty(page)) {
|
|
|
page.getRecords().forEach(e -> {
|
|
|
//获得所属公司名称
|
|
|
R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(e.getBelongToCorpId());
|
|
|
@@ -198,11 +194,11 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
item.setUpdateTime(new Date());
|
|
|
claimItemMapper.updateById(item);
|
|
|
}
|
|
|
- i ++;
|
|
|
+ i++;
|
|
|
}
|
|
|
|
|
|
List<CommonFile> fileList = claim.getFileList();
|
|
|
- if (ObjectUtil.isNotEmpty(fileList)){
|
|
|
+ if (ObjectUtil.isNotEmpty(fileList)) {
|
|
|
fileList.forEach(file -> {
|
|
|
if (ObjectUtil.isEmpty(file.getId())) {
|
|
|
file.setPid(claim.getId());
|
|
|
@@ -236,7 +232,7 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
@Override
|
|
|
public void checkClaim(Claim claim) {
|
|
|
Claim detail = baseMapper.selectById(claim);
|
|
|
- if (detail.getStatus() == 1){
|
|
|
+ if (detail.getStatus() == 1) {
|
|
|
throw new SecurityException("订单已开启审核,请勿重复提交");
|
|
|
}
|
|
|
// 判断是否有审批流,如果审批流已开启就进入审批流,否则直接走申请通过
|
|
|
@@ -264,7 +260,7 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
List<ClaimItem> list = claimItemMapper.selectList(lambdaQueryWrapper);
|
|
|
Claim claim1 = baseMapper.selectById(claim.getId());
|
|
|
|
|
|
- if (CollectionUtil.isEmpty(list)){
|
|
|
+ if (CollectionUtil.isEmpty(list)) {
|
|
|
throw new SecurityException("开启审批失败:单据明细不能为空");
|
|
|
}
|
|
|
//明细总数量
|
|
|
@@ -304,7 +300,7 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
* @param id
|
|
|
*/
|
|
|
@Override
|
|
|
- public void passCheck(Long id) {
|
|
|
+ public R passCheck(Long id) {
|
|
|
Claim claim = baseMapper.selectById(id);
|
|
|
if (ObjectUtil.isEmpty(claim)) {
|
|
|
throw new SecurityException("审批失败");
|
|
|
@@ -312,13 +308,14 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
claim.setStatus(3);
|
|
|
baseMapper.updateById(claim);
|
|
|
editItemStatus(id, 3);
|
|
|
+ return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 审核不通过
|
|
|
*/
|
|
|
@Override
|
|
|
- public void passCancel(Long id) {
|
|
|
+ public R passCancel(Long id) {
|
|
|
Claim claim = baseMapper.selectById(id);
|
|
|
if (ObjectUtil.isEmpty(claim)) {
|
|
|
throw new SecurityException("审批失败");
|
|
|
@@ -326,6 +323,7 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
claim.setStatus(0);
|
|
|
baseMapper.updateById(claim);
|
|
|
editItemStatus(id, 0);
|
|
|
+ return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -334,7 +332,7 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
* @param id
|
|
|
*/
|
|
|
@Override
|
|
|
- public void underReview(Long id) {
|
|
|
+ public R underReview(Long id) {
|
|
|
Claim claim = baseMapper.selectById(id);
|
|
|
if (ObjectUtil.isEmpty(claim)) {
|
|
|
throw new SecurityException("审批失败");
|
|
|
@@ -342,6 +340,7 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
claim.setStatus(2);
|
|
|
baseMapper.updateById(claim);
|
|
|
editItemStatus(id, 2);
|
|
|
+ return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
private void editItemStatus(Long pid, Integer status) {
|
|
|
@@ -362,17 +361,17 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
|
|
|
String accountName = null;
|
|
|
|
|
|
- if ("681169".equals(AuthUtil.getTenantId())){
|
|
|
+ if ("681169".equals(AuthUtil.getTenantId())) {
|
|
|
|
|
|
if (claimOne == null) {
|
|
|
throw new SecurityException("未查到相关数据,操作失败");
|
|
|
}
|
|
|
|
|
|
- if(!ObjectUtil.isNotEmpty(claimOne.getBelongToCorpId())){
|
|
|
+ if (!ObjectUtil.isNotEmpty(claimOne.getBelongToCorpId())) {
|
|
|
throw new SecurityException("所属公司不能为空");
|
|
|
}
|
|
|
|
|
|
- if (!StringUtil.isNotBlank(claimOne.getSubjectCode())){
|
|
|
+ if (!StringUtil.isNotBlank(claimOne.getSubjectCode())) {
|
|
|
throw new SecurityException("科目编码不能为空");
|
|
|
}
|
|
|
|
|
|
@@ -398,9 +397,8 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
.eq(JdTenant::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(JdTenant::getAccountName, accountName);
|
|
|
JdTenant jdTenant = jdTenantMapper.selectOne(jdTenantLambdaQueryWrapper);
|
|
|
- if (jdTenant != null)
|
|
|
- {
|
|
|
- if (ObjectUtil.isNotEmpty(itemList)){
|
|
|
+ if (jdTenant != null) {
|
|
|
+ if (ObjectUtil.isNotEmpty(itemList)) {
|
|
|
try {
|
|
|
//财务保存凭证
|
|
|
this.ClaimSaveVoucher(claimOne.getPaymentTime(), accountName, claimOne.getSubjectCode(), itemList, claimOne.getUserName());
|
|
|
@@ -416,6 +414,11 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
return claim;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public BigDecimal getCost(String statusDate, String endDate) {
|
|
|
+ return baseMapper.getCost(statusDate,endDate);
|
|
|
+ }
|
|
|
+
|
|
|
//财务生成账单
|
|
|
public void ClaimSaveVoucher(Date PaymentTime, String accountName, String subjectCode, List<ClaimItem> itemList, String userName) throws Exception {
|
|
|
// TODO 临时屏蔽
|
|
|
@@ -465,14 +468,14 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
}
|
|
|
|
|
|
//金蝶保存凭证测试-生成凭证
|
|
|
- public JdyTool.voucher toSaleCollectionJinDie(Date date,String subjectCode, String accountId, String groupName, List<ClaimItem> itemList, String userName) {
|
|
|
+ public JdyTool.voucher toSaleCollectionJinDie(Date date, String subjectCode, String accountId, String groupName, List<ClaimItem> itemList, String userName) {
|
|
|
JDYitems item = new JDYitems();
|
|
|
item.setDate(new SimpleDateFormat("yyyy-MM-dd").format(date));
|
|
|
List<JDYentries> entriesList = new ArrayList<>();
|
|
|
List<JDYitems> jdYitems = new ArrayList<>();
|
|
|
|
|
|
itemList.forEach(claimItem -> {
|
|
|
- if (!StringUtil.isNotBlank(claimItem.getSubjectName())){
|
|
|
+ if (!StringUtil.isNotBlank(claimItem.getSubjectName())) {
|
|
|
throw new SecurityException("明细科目名称不能为空");
|
|
|
}
|
|
|
|
|
|
@@ -483,9 +486,9 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
JDYentries d = new JDYentries();
|
|
|
d.setDc("1");
|
|
|
|
|
|
- if (null != claimItem.getSubjectName() && !claimItem.getSubjectName().equals("")){
|
|
|
+ if (null != claimItem.getSubjectName() && !claimItem.getSubjectName().equals("")) {
|
|
|
d.setAccount_number(claimItem.getSubjectName());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new SecurityException("科目编码为空");
|
|
|
}
|
|
|
d.setExplanation(claimItem.getExplanation());
|
|
|
@@ -507,15 +510,15 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
});
|
|
|
|
|
|
//金额合计
|
|
|
- String sumAccount = itemList.stream().map(ClaimItem :: getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).toString();
|
|
|
+ String sumAccount = itemList.stream().map(ClaimItem::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).toString();
|
|
|
|
|
|
//财务贷方
|
|
|
JDYentries c = new JDYentries();
|
|
|
c.setDc("-1");
|
|
|
|
|
|
- if (null != subjectCode && !subjectCode.equals("")){
|
|
|
+ if (null != subjectCode && !subjectCode.equals("")) {
|
|
|
c.setAccount_number(subjectCode);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new SecurityException("科目编码为空");
|
|
|
}
|
|
|
c.setExplanation(userName + "报销");
|
|
|
@@ -577,12 +580,12 @@ public class ClaimServiceImpl extends ServiceImpl<ClaimMapper, Claim> implements
|
|
|
String s = MD5Util.hashMAC(key, secret);
|
|
|
Map<String, String> querys = new LinkedHashMap<>();
|
|
|
querys.put("app_key", key);
|
|
|
- querys.put("app_signature",s);
|
|
|
+ querys.put("app_signature", s);
|
|
|
request.setQuerys(querys);
|
|
|
ApiResult results = ApigwClient.getInstance().send(request);
|
|
|
- System.out.println("金蝶返回数据======》"+results.getBody());
|
|
|
+ System.out.println("金蝶返回数据======》" + results.getBody());
|
|
|
JSONObject jsonObject = JSONObject.parseObject(results.getBody());
|
|
|
- System.out.println("app-token======>"+jsonObject.getJSONObject("data").getString("access_token"));
|
|
|
+ System.out.println("app-token======>" + jsonObject.getJSONObject("data").getString("access_token"));
|
|
|
|
|
|
/* //获取测试账套token的url
|
|
|
String getTokenUrl = "https://api.kingdee.com/auth/user/access_token?client_id=" + jdTenant.getClientId() +
|