|
|
@ -22,7 +22,9 @@ import cn.iocoder.yudao.module.accounting.service.invoices.InvoicesService;
|
|
|
|
import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
|
|
|
|
import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
@ -44,6 +46,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|
|
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
|
|
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.*;
|
|
|
@ -79,7 +82,7 @@ public class VoucherController {
|
|
|
|
VoucherExportReqVO vo = new VoucherExportReqVO();
|
|
|
|
VoucherExportReqVO vo = new VoucherExportReqVO();
|
|
|
|
vo.setVoucherNum(createReqVO.getVoucherNum());
|
|
|
|
vo.setVoucherNum(createReqVO.getVoucherNum());
|
|
|
|
List<VoucherDO> voucherList = voucherService.getVoucherList(vo);
|
|
|
|
List<VoucherDO> voucherList = voucherService.getVoucherList(vo);
|
|
|
|
if (voucherList.size()>0){
|
|
|
|
if (voucherList.size() > 0) {
|
|
|
|
return error("凭证号重复!");
|
|
|
|
return error("凭证号重复!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return success(voucherService.createVoucher(createReqVO));
|
|
|
|
return success(voucherService.createVoucher(createReqVO));
|
|
|
@ -98,11 +101,11 @@ public class VoucherController {
|
|
|
|
@Parameter(name = "id", description = "编号", required = true)
|
|
|
|
@Parameter(name = "id", description = "编号", required = true)
|
|
|
|
@PreAuthorize("@ss.hasPermission('accounting:voucher:delete')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('accounting:voucher:delete')")
|
|
|
|
public CommonResult<Boolean> deleteVoucher(@RequestParam("id") Long[] id) {
|
|
|
|
public CommonResult<Boolean> deleteVoucher(@RequestParam("id") Long[] id) {
|
|
|
|
List<Long> listId = new ArrayList(Arrays.asList(id)) ;
|
|
|
|
List<Long> listId = new ArrayList(Arrays.asList(id));
|
|
|
|
List<VoucherDO> voucherList = voucherService.getVoucherList(listId);
|
|
|
|
List<VoucherDO> voucherList = voucherService.getVoucherList(listId);
|
|
|
|
for (VoucherDO voucher : voucherList) {
|
|
|
|
for (VoucherDO voucher : voucherList) {
|
|
|
|
if (voucher.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())){
|
|
|
|
if (voucher.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())) {
|
|
|
|
return error("凭证号:"+voucher.getVoucherNum()+" 该凭证已归档,请勿删除!");
|
|
|
|
return error("凭证号:" + voucher.getVoucherNum() + " 该凭证已归档,请勿删除!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
voucherService.deleteVoucher(id);
|
|
|
|
voucherService.deleteVoucher(id);
|
|
|
@ -134,7 +137,7 @@ public class VoucherController {
|
|
|
|
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
|
|
|
|
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
|
|
|
|
PageResult<VoucherRespVO> voucherRespVOPageResult = VoucherConvert.INSTANCE.convertPage(pageResult);
|
|
|
|
PageResult<VoucherRespVO> voucherRespVOPageResult = VoucherConvert.INSTANCE.convertPage(pageResult);
|
|
|
|
String jsonString = JSONObject.toJSONString(voucherRespVOPageResult);
|
|
|
|
String jsonString = JSONObject.toJSONString(voucherRespVOPageResult);
|
|
|
|
passwordsService.jsonToXmlConverter(response,pageVO.getInputPassword(),jsonString);
|
|
|
|
passwordsService.jsonToXmlConverter(response, pageVO.getInputPassword(), jsonString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/page")
|
|
|
|
@GetMapping("/page")
|
|
|
@ -142,14 +145,14 @@ public class VoucherController {
|
|
|
|
@PreAuthorize("@ss.hasPermission('accounting:voucher:query')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('accounting:voucher:query')")
|
|
|
|
public CommonResult<PageResult<VoucherRespVO>> getVoucherPage(@Valid VoucherPageReqVO pageVO) {
|
|
|
|
public CommonResult<PageResult<VoucherRespVO>> getVoucherPage(@Valid VoucherPageReqVO pageVO) {
|
|
|
|
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
|
|
|
|
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
|
|
|
|
int i=0;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
|
|
//完整性检查
|
|
|
|
//完整性检查,并设置会计凭证的完整性
|
|
|
|
List<VoucherDO> list = pageResult.getList();
|
|
|
|
List<VoucherDO> list = pageResult.getList();
|
|
|
|
for (VoucherDO voucherDO:list
|
|
|
|
for (VoucherDO voucherDO : list
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
//如果未归档才检查完整性
|
|
|
|
//如果未归档才检查完整性
|
|
|
|
if(!voucherDO.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())) {
|
|
|
|
if (!voucherDO.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())) {
|
|
|
|
String remark = " ";
|
|
|
|
String remark = " ";
|
|
|
|
Long id = voucherDO.getId();
|
|
|
|
Long id = voucherDO.getId();
|
|
|
|
AttachmentExportReqVO attachmentExportReqVO = new AttachmentExportReqVO();
|
|
|
|
AttachmentExportReqVO attachmentExportReqVO = new AttachmentExportReqVO();
|
|
|
@ -193,7 +196,7 @@ public class VoucherController {
|
|
|
|
voucherUpdateReqVO.setCherks(voucherDO.getCherks());
|
|
|
|
voucherUpdateReqVO.setCherks(voucherDO.getCherks());
|
|
|
|
voucherUpdateReqVO.setRemark(remark);
|
|
|
|
voucherUpdateReqVO.setRemark(remark);
|
|
|
|
voucherService.updateVoucher(voucherUpdateReqVO);
|
|
|
|
voucherService.updateVoucher(voucherUpdateReqVO);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
VoucherUpdateReqVO voucherUpdateReqVO = new VoucherUpdateReqVO();
|
|
|
|
VoucherUpdateReqVO voucherUpdateReqVO = new VoucherUpdateReqVO();
|
|
|
|
voucherUpdateReqVO.setId(voucherDO.getId());
|
|
|
|
voucherUpdateReqVO.setId(voucherDO.getId());
|
|
|
|
voucherUpdateReqVO.setCherks(Integer.valueOf(AccountingStatusEnum.COMPLETE.getValue()));
|
|
|
|
voucherUpdateReqVO.setCherks(Integer.valueOf(AccountingStatusEnum.COMPLETE.getValue()));
|
|
|
@ -201,9 +204,10 @@ public class VoucherController {
|
|
|
|
voucherService.updateVoucher(voucherUpdateReqVO);
|
|
|
|
voucherService.updateVoucher(voucherUpdateReqVO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询未归档的会计凭证返回前端
|
|
|
|
|
|
|
|
pageVO.setFileStatus(String.valueOf(0));
|
|
|
|
PageResult<VoucherDO> pageResult2 = voucherService.getVoucherPage(pageVO);
|
|
|
|
PageResult<VoucherDO> pageResult2 = voucherService.getVoucherPage(pageVO);
|
|
|
|
|
|
|
|
|
|
|
|
return success(VoucherConvert.INSTANCE.convertPage(pageResult2));
|
|
|
|
return success(VoucherConvert.INSTANCE.convertPage(pageResult2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|