|
|
@@ -35,7 +35,6 @@ import com.itextpdf.text.pdf.PdfPCell;
|
|
|
import com.itextpdf.text.pdf.PdfPRow;
|
|
|
import com.itextpdf.text.pdf.PdfPTable;
|
|
|
import com.itextpdf.text.pdf.PdfWriter;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
@@ -43,6 +42,7 @@ import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
@@ -53,45 +53,45 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapper> implements ExpenseAccountService {
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private AdminMapper adminMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExpenseAccountMapper expenseAccountMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private PublicReleaseMapper publicReleaseMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExpenseAccountLogMapper expenseAccountLogMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private AsyncUtils asyncUtils;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private WeChatUtils weChatUtils;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExpenseAccountDetailsMapper expenseAccountDetailsMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExpenseAccountPrivateMapper expenseAccountPrivateMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExpenseAccountExamineMapper expenseAccountExamineMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private JDBCIdGenerator idGenerator;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private FinanceCountMapper financeCountMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExpenseRelationshipMapper expenseRelationshipMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private DepartmentService departmentService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private DepartmentMapper departmentMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExpenseConfigDetailsMapper expenseConfigDetailsMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private TOrderPublicReleaseCountMapper tOrderPublicReleaseCountMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private OrderNewService orderNewService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private OrderYearMaxDurationMapper orderYearMaxDurationMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private UserMapper userMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private TOrderMidMapper tOrderMidMapper;
|
|
|
|
|
|
|
|
|
@@ -973,12 +973,12 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
}else {
|
|
|
status =1;
|
|
|
List<ExpenseAccountExamine> list=expenseAccountExamineMapper.selectByEaidAndProcessStatus(newEa.getId(), useEa.getProcessStatus());
|
|
|
- StringBuffer aname =new StringBuffer();
|
|
|
+ StringBuilder aname =new StringBuilder();
|
|
|
for (ExpenseAccountExamine e : list) {
|
|
|
if (e.getStatus()==0){
|
|
|
Admin ad=adminMapper.queryById(e.getAuditor());
|
|
|
aids.add(ad);
|
|
|
- aname=aname.append(ad.getName()).append(",");
|
|
|
+ aname.append(ad.getName()).append(",");
|
|
|
}
|
|
|
}
|
|
|
newEa.setExamineName(aname.substring(0,aname.length()-1));
|
|
|
@@ -1080,7 +1080,6 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
|
|
|
/**
|
|
|
* 审核流程推送,只要不是完成状态就继续判断是否跳过
|
|
|
- * @param newEa
|
|
|
*/
|
|
|
private void examineByprocess( ExpenseAccount newEa,AdminListBo admin,OrganizationListOut dep,List<ExpenseConfigDetails> list) {
|
|
|
List<ExpenseAccountExamine> examineList;
|
|
|
@@ -1102,7 +1101,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
if (flag){
|
|
|
String str=String.format("重复审核人跳过[%s]。",EAProcessStatus.getDesc(newEa.getProcessStatus()));
|
|
|
Date date=new Date();
|
|
|
- date.setTime(date.getTime()+1000l);
|
|
|
+ date.setTime(date.getTime()+ 1000L);
|
|
|
addExpenseAccountLog(newEa.getId(),1,newEa.getProcessStatus(),aid,str,date,2);
|
|
|
if (Objects.equals(newEa.getProcessStatus(), EAProcessStatus.BMFZRSH.getCode())){
|
|
|
addFinanceCount(admin.getDepFinance(),newEa.getCreateTime());
|
|
|
@@ -1118,7 +1117,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
//审核通过标记
|
|
|
boolean flag3= false;
|
|
|
Date date2=new Date();
|
|
|
- date2.setTime(date2.getTime()+1000l);
|
|
|
+ date2.setTime(date2.getTime()+ 1000L);
|
|
|
String tip=null;
|
|
|
String aid=null;
|
|
|
if (Objects.equals(newEa.getProcessStatus(), EAProcessStatus.CWFS.getCode())){
|
|
|
@@ -1147,7 +1146,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
tip="特批(部门设置)";
|
|
|
}
|
|
|
}
|
|
|
- }else if (newEa.getProcessStatus()==EAProcessStatus.CWGGLYSH.getCode()){
|
|
|
+ }else if (Objects.equals(newEa.getProcessStatus(), EAProcessStatus.CWGGLYSH.getCode())){
|
|
|
if (dep.getExpenseRetrialFinanceExamine()==0){
|
|
|
flag2=true;
|
|
|
tip=EAProcessStatus.CWGGLYSH.getDesc();
|
|
|
@@ -1158,7 +1157,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
flag3=true;
|
|
|
}
|
|
|
}
|
|
|
- }else if (newEa.getProcessStatus()==EAProcessStatus.GSFSSH.getCode()){
|
|
|
+ }else if (Objects.equals(newEa.getProcessStatus(), EAProcessStatus.GSFSSH.getCode())){
|
|
|
if (dep.getExpenseRetrialFinanceExamine()==0){
|
|
|
flag2=true;
|
|
|
tip=EAProcessStatus.GSFSSH.getDesc();
|
|
|
@@ -1168,7 +1167,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
flag3=true;
|
|
|
}
|
|
|
}
|
|
|
- }else if (newEa.getProcessStatus()==EAProcessStatus.CNSH.getCode()){
|
|
|
+ }else if (Objects.equals(newEa.getProcessStatus(), EAProcessStatus.CNSH.getCode())){
|
|
|
if (dep.getExpenseRetrialFinanceExamine()==0){
|
|
|
flag2=true;
|
|
|
tip=EAProcessStatus.CNSH.getDesc();
|
|
|
@@ -1198,17 +1197,11 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
}
|
|
|
|
|
|
private boolean pushExpenseExamine(List<ExpenseConfigDetails> list, ExpenseAccount newEa, Integer status) {
|
|
|
- int configDetails=0;
|
|
|
- if (status==EAProcessStatus.CWFS.getCode())configDetails=1;
|
|
|
- else if (status==EAProcessStatus.DSZSH.getCode())configDetails=2;
|
|
|
- else if (status==EAProcessStatus.CWGGLYSH.getCode())configDetails=3;
|
|
|
- else if (status==EAProcessStatus.GSFSSH.getCode())configDetails=4;
|
|
|
- else if (status==EAProcessStatus.CNSH.getCode())configDetails=5;
|
|
|
- int finalConfigDetails = configDetails;
|
|
|
+ int finalConfigDetails = getFinalConfigDetails(status);
|
|
|
//查询审核表,如果为空就新增,不然直接判定审核
|
|
|
List<ExpenseAccountExamine> expenseAccountExamines = expenseAccountExamineMapper.selectByEaidAndProcessStatus(newEa.getId(), status);
|
|
|
int count = 0;
|
|
|
- int size=10;
|
|
|
+ int size;
|
|
|
if (expenseAccountExamines.isEmpty()){
|
|
|
List<ExpenseConfigDetails> collect = list.stream().filter(e -> e.getType() == finalConfigDetails).collect(Collectors.toList());
|
|
|
size= collect.size();
|
|
|
@@ -1218,7 +1211,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
eae.setAuditorname(e.getAdminName());
|
|
|
eae.setStatus(0);
|
|
|
Integer i = expenseAccountExamineMapper.selectYesByParam(newEa.getId(), e.getAid());
|
|
|
- if (status==EAProcessStatus.CNSH.getCode()){
|
|
|
+ if (Objects.equals(status, EAProcessStatus.CNSH.getCode())){
|
|
|
eae.setStatus(0);
|
|
|
count++;
|
|
|
}else {
|
|
|
@@ -1244,6 +1237,16 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ private int getFinalConfigDetails(Integer status) {
|
|
|
+ int configDetails=0;
|
|
|
+ if (Objects.equals(status, EAProcessStatus.CWFS.getCode()))configDetails=1;
|
|
|
+ else if (Objects.equals(status, EAProcessStatus.DSZSH.getCode()))configDetails=2;
|
|
|
+ else if (Objects.equals(status, EAProcessStatus.CWGGLYSH.getCode()))configDetails=3;
|
|
|
+ else if (Objects.equals(status, EAProcessStatus.GSFSSH.getCode()))configDetails=4;
|
|
|
+ else if (Objects.equals(status, EAProcessStatus.CNSH.getCode()))configDetails=5;
|
|
|
+ return configDetails;
|
|
|
+ }
|
|
|
+
|
|
|
private void addNoticeAndEmail(ExpenseAccount in, Integer status, String str,String aname, List<Admin> aids) {
|
|
|
Date date= new Date();
|
|
|
|
|
|
@@ -1324,7 +1327,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
public Object selectById(Integer id) {
|
|
|
OutExpenseAccount useEa = expenseAccountMapper.selectByid(id);
|
|
|
//判断当前角色是否审核
|
|
|
- useEa.setExamine(pushExpenseAccountGetExamine( id, useEa.getProcessStatus()));;
|
|
|
+ useEa.setExamine(pushExpenseAccountGetExamine( id, useEa.getProcessStatus()));
|
|
|
if (useEa.getDebitId()!=null){
|
|
|
pushExpenseAccountGetDebitAmount(useEa);
|
|
|
|
|
|
@@ -1363,23 +1366,23 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
BigDecimal count = new BigDecimal(0);
|
|
|
BigDecimal amount = new BigDecimal(0);
|
|
|
BigDecimal realAmount = new BigDecimal(0);
|
|
|
- List<String> typeList = new ArrayList<String>();
|
|
|
+ List<String> typeList = new ArrayList<>();
|
|
|
for (ExpenseAccount e : list) {
|
|
|
count=count.add(e.getTotalAmount());
|
|
|
amount=amount.add(e.getAmount());
|
|
|
realAmount=realAmount.add(e.getRealAmount());
|
|
|
- StringBuffer types=new StringBuffer();
|
|
|
+ StringBuilder types=new StringBuilder();
|
|
|
if (e.getType()!=0){
|
|
|
- types=types.append(EATypes.getDescByCode(e.getType()));
|
|
|
+ types.append(EATypes.getDescByCode(e.getType()));
|
|
|
}else {
|
|
|
- types=types.append(e.getTypeOther());
|
|
|
+ types.append(e.getTypeOther());
|
|
|
}
|
|
|
if (e.getType()==2){
|
|
|
if (e.getSecondaryType()==0){
|
|
|
- types=types.append("-").append(e.getSecondaryTypeOther());
|
|
|
+ types.append("-").append(e.getSecondaryTypeOther());
|
|
|
}else{
|
|
|
String descByCode = EAsecondaryTypes.getDescByCode(e.getSecondaryType());
|
|
|
- types=types.append("-").append(descByCode);
|
|
|
+ types.append("-").append(descByCode);
|
|
|
}
|
|
|
}
|
|
|
if (!typeList.contains(types.toString()))typeList.add(types.toString());
|
|
|
@@ -1391,7 +1394,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
in.setTypeOther(String.join(",",typeList));
|
|
|
expenseAccountMapper.insertSelective(in);
|
|
|
List<OutExpenseAccountLog> newLog=new ArrayList<>();
|
|
|
- list.stream().forEach(e -> {
|
|
|
+ list.forEach(e -> {
|
|
|
ExpenseRelationship er=new ExpenseRelationship();
|
|
|
er.setId(in.getId());
|
|
|
er.setEaId(e.getId());
|
|
|
@@ -1419,7 +1422,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
if (res.getAid().equals(TokenManager.getAdminId())){
|
|
|
res.setExamine(2);
|
|
|
}else {
|
|
|
- res.setExamine(pushExpenseAccountGetExamine( id, res.getProcessStatus()));;
|
|
|
+ res.setExamine(pushExpenseAccountGetExamine( id, res.getProcessStatus()));
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
@@ -1430,7 +1433,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
List<SonExpenseAccount> orderSonList = new ArrayList<>();
|
|
|
//用来去重
|
|
|
List<String> strList = new ArrayList<>();
|
|
|
- sonList.stream().forEach(e -> {
|
|
|
+ sonList.forEach(e -> {
|
|
|
if (e.getOrderNo()==null){
|
|
|
orderSonList.add(e);
|
|
|
}else if (!orderList.contains(e.getOrderNo())){
|
|
|
@@ -1609,15 +1612,17 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
if (in.getRemarks()!=null)update.setRemarks(in.getRemarks());
|
|
|
if (in.getEaaid()!=null)update.setEaaid(in.getEaaid());
|
|
|
addExpenseAccountExamine(in.getId(),update);
|
|
|
- if (outExpenseAccount.getStatus()==0){
|
|
|
- addExpenseAccountLogAndNoticEmail(outExpenseAccount,outExpenseAccount.getStatus(),"发起报销审核");
|
|
|
- }else if (outExpenseAccount.getStatus()==3){
|
|
|
- addExpenseAccountLogAndNoticEmail(outExpenseAccount,4,"修改并发起审核");
|
|
|
+ if (outExpenseAccount != null && outExpenseAccount.getStatus() == 0) {
|
|
|
+ addExpenseAccountLogAndNoticEmail(outExpenseAccount, outExpenseAccount.getStatus(), "发起报销审核");
|
|
|
}
|
|
|
update.setStatus(in.getStatus());
|
|
|
- update.setProcessStatus(outExpenseAccount.getProcessStatus());
|
|
|
+ if (outExpenseAccount != null) {
|
|
|
+ update.setProcessStatus(outExpenseAccount.getProcessStatus());
|
|
|
+ }
|
|
|
update.setId(in.getId());
|
|
|
- update.setExamineName(outExpenseAccount.getExamineName());
|
|
|
+ if (outExpenseAccount != null) {
|
|
|
+ update.setExamineName(outExpenseAccount.getExamineName());
|
|
|
+ }
|
|
|
expenseAccountMapper.updateByPrimaryKeySelective(update);
|
|
|
// expenseAccountMapper.updateByOrderRemarks(in.getId());
|
|
|
}else if (in.getStatus()==4){
|
|
|
@@ -1630,10 +1635,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
expenseAccountLogMapper.updateUseLogByUseId(e.getEaId(),e.getId());
|
|
|
}else {
|
|
|
List<OutExpenseAccountLog> outExpenseAccountLogs = expenseAccountLogMapper.selectByEaid(in.getId());
|
|
|
- for (int i=0;i<list.size();i++){
|
|
|
- ExpenseRelationship e =list.get(i);
|
|
|
+ for (ExpenseRelationship e : list) {
|
|
|
for (OutExpenseAccountLog eal : outExpenseAccountLogs) {
|
|
|
-
|
|
|
eal.setEaid(e.getEaId());
|
|
|
}
|
|
|
expenseAccountLogMapper.insertBatch(outExpenseAccountLogs);
|
|
|
@@ -1757,7 +1760,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
ExpenseAccountDetails ea= new ExpenseAccountDetails();
|
|
|
ea.setId(id);
|
|
|
ea.setRealAmount(amount);
|
|
|
- String name=TokenManager.getAdminToken().getName();
|
|
|
+ String name= Objects.requireNonNull(TokenManager.getAdminToken()).getName();
|
|
|
Integer eaid = expenseAccountDetailsMapper.selectExpenseAccountById(id);
|
|
|
addExpenseAccountLog(eaid,5,3,TokenManager.getAdminId(),String.format("财务[%s]修改实际报销金额为%s。",name,amount));
|
|
|
expenseAccountDetailsMapper.updateByPrimaryKeySelective(ea);
|
|
|
@@ -1771,7 +1774,6 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
|
|
|
/**
|
|
|
* 计算当前报销显示抵扣金额
|
|
|
- * @param useEa
|
|
|
*/
|
|
|
private void pushExpenseAccountGetDebitAmount(OutExpenseAccount useEa) {
|
|
|
ExpenseAccount debit = expenseAccountMapper.selectByPrimaryKey(useEa.getDebitId());
|
|
|
@@ -1821,8 +1823,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
@Override
|
|
|
public List<OutExpenseAccount> selectDebitOrder(String depId,Integer id) {
|
|
|
String aid= TokenManager.getAdminId();
|
|
|
- List<OutExpenseAccount> list = expenseAccountMapper.selectByaidAndType(aid, depId, 4,id);
|
|
|
- return list;
|
|
|
+ return expenseAccountMapper.selectByaidAndType(aid, depId, 4,id);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1922,7 +1923,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
out.setBhs(1);
|
|
|
}
|
|
|
//如果不存在就新增
|
|
|
- if (!map.keySet().contains(out.getAid())) {
|
|
|
+ if (!map.containsKey(out.getAid())) {
|
|
|
List<OutExpenseAccountStatistics> list2 = new ArrayList<>();
|
|
|
list2.add(out);
|
|
|
map.put(out.getAid(), list2);
|
|
|
@@ -1987,18 +1988,18 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
List<ExpenseAccount> expenseAccounts = expenseAccountMapper.selectListByMainId(ea.getId());
|
|
|
List<String> typeList=new ArrayList<>();
|
|
|
for (ExpenseAccount e : expenseAccounts) {
|
|
|
- StringBuffer types=new StringBuffer();
|
|
|
+ StringBuilder types=new StringBuilder();
|
|
|
if (e.getType()!=0){
|
|
|
- types=types.append(EATypes.getDescByCode(e.getType()));
|
|
|
+ types.append(EATypes.getDescByCode(e.getType()));
|
|
|
}else {
|
|
|
- types=types.append(e.getTypeOther());
|
|
|
+ types.append(e.getTypeOther());
|
|
|
}
|
|
|
if (e.getType()==2){
|
|
|
if (e.getSecondaryType()==0){
|
|
|
- types=types.append("-").append(e.getSecondaryTypeOther());
|
|
|
+ types.append("-").append(e.getSecondaryTypeOther());
|
|
|
}else{
|
|
|
String descByCode = EAsecondaryTypes.getDescByCode(e.getSecondaryType());
|
|
|
- types=types.append("-").append(descByCode);
|
|
|
+ types.append("-").append(descByCode);
|
|
|
}
|
|
|
}
|
|
|
if (!typeList.contains(types.toString()))typeList.add(types.toString());
|