@ -10,6 +10,8 @@ import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import io.swagger.annotations.Api ;
import io.swagger.annotations.ApiOperation ;
import jnpf.accounting.entity.AccountingEntity ;
import jnpf.accounting.mapper.AccountingMapper ;
import jnpf.arinvoices.entity.ArinvoicesEntity ;
import jnpf.arinvoices.entity.Arinvoices_item1Entity ;
import jnpf.base.ActionResult ;
@ -82,6 +84,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.* ;
import org.springframework.web.multipart.MultipartFile ;
import javax.annotation.Resource ;
import javax.validation.Valid ;
import java.io.File ;
import java.io.FileOutputStream ;
@ -90,6 +93,7 @@ import java.io.InputStream;
import java.math.BigDecimal ;
import java.nio.charset.Charset ;
import java.text.ParseException ;
import java.text.SimpleDateFormat ;
import java.util.* ;
import java.util.stream.Collectors ;
@ -168,6 +172,9 @@ public class PurchaseorderController {
@Autowired
private InvoicesItem1Service invoicesItem1Service ;
@Resource
private AccountingMapper accountingMapper ;
/ * *
* 归 档
*
@ -279,6 +286,16 @@ public class PurchaseorderController {
@PostMapping
@Transactional
public ActionResult create ( @RequestBody @Valid PurchaseorderCrForm purchaseorderCrForm ) throws DataException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( ) ;
String date = simpleDateFormat . format ( purchaseorderCrForm . getBusinessDate ( ) ) ;
List < AccountingEntity > list = accountingMapper . queryAccounting ( date ) ;
if ( list ! = null & & list . size ( ) > 0 ) {
if ( list . get ( 0 ) . getStatus ( ) . equals ( "1" ) ) {
return ActionResult . fail ( "账期已关闭,无法在此区间开展业务" ) ;
}
} else {
return ActionResult . fail ( "账期不存在,无法在此区间开展业务" ) ;
}
String mainId = RandomUtil . uuId ( ) ;
UserInfo userInfo = userProvider . get ( ) ;
//purchaseorderCrForm.setDocumentNo(generaterSwapUtil.getBillNumber("cgdj", false));
@ -366,6 +383,16 @@ public class PurchaseorderController {
@ApiOperation ( "上传文件" )
@PostMapping ( "/Uploader" )
public ActionResult Uploader ( ) throws Exception {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
String date = simpleDateFormat . format ( new Date ( ) ) ;
List < AccountingEntity > list1 = accountingMapper . queryAccounting ( date ) ;
if ( list1 ! = null & & list1 . size ( ) > 0 ) {
if ( list1 . get ( 0 ) . getStatus ( ) . equals ( "1" ) ) {
return ActionResult . fail ( "账期已关闭,无法在此区间开展业务" ) ;
}
} else {
return ActionResult . fail ( "账期不存在,无法在此区间开展业务" ) ;
}
List < MultipartFile > list = UpUtil . getFileAll ( ) ;
MultipartFile file = list . get ( 0 ) ;
if ( file . getOriginalFilename ( ) . endsWith ( ".zip" ) ) {
@ -972,6 +999,19 @@ public class PurchaseorderController {
@PutMapping ( "/{id}" )
@Transactional
public ActionResult update ( @PathVariable ( "id" ) String id , @RequestBody @Valid PurchaseorderUpForm purchaseorderUpForm ) throws DataException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( ) ;
String date = "" ;
if ( purchaseorderUpForm . getBusinessDate ( ) ! = null ) {
date = simpleDateFormat . format ( purchaseorderUpForm . getBusinessDate ( ) ) ;
}
List < AccountingEntity > list = accountingMapper . queryAccounting ( date ) ;
if ( list ! = null & & list . size ( ) > 0 ) {
if ( list . get ( 0 ) . getStatus ( ) . equals ( "1" ) ) {
return ActionResult . fail ( "账期已关闭,无法在此区间开展业务" ) ;
}
} else {
return ActionResult . fail ( "账期不存在,无法在此区间开展业务" ) ;
}
UserInfo userInfo = userProvider . get ( ) ;
PurchaseorderitemEntity entity = purchaseorderitemService . getInfo ( id ) ;
if ( ! entity . getStatus ( ) . equals ( "0" ) ) {