初始化供应商编号

pull/451/head
starrysky 2019-08-15 09:06:11 +08:00
parent 4e890f4a01
commit b5d26b09f8
2 changed files with 17 additions and 8 deletions

View File

@ -13,6 +13,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar; import java.util.Calendar;
/** /**
@ -40,14 +42,8 @@ public class SupplierInfoController {
@GetMapping(value = "/initSupplierCode") @GetMapping(value = "/initSupplierCode")
@PreAuthorize("hasAnyRole('ADMIN','BDSUPPLIERINFO_ALL','BDSUPPLIERINFO_SELECT')") @PreAuthorize("hasAnyRole('ADMIN','BDSUPPLIERINFO_ALL','BDSUPPLIERINFO_SELECT')")
public ResponseEntity initSupplierCode(){ public ResponseEntity initSupplierCode(){
Calendar calendar = Calendar.getInstance(); DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");//设置日期格式
int year = calendar.get(Calendar.YEAR); String supplierCode = "GYS"+ LocalDateTime.now().format(fmt);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
String supplierCode = "GYS" + year + month + day + hour + minute + second;
return new ResponseEntity(supplierCode,HttpStatus.OK); return new ResponseEntity(supplierCode,HttpStatus.OK);
} }

View File

@ -12,6 +12,10 @@ import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
/** /**
* @author * @author
@ -35,6 +39,15 @@ public class WareHouseController {
return new ResponseEntity(wareHouseService.create(resources), HttpStatus.CREATED); return new ResponseEntity(wareHouseService.create(resources), HttpStatus.CREATED);
} }
@Log("初始化仓库编号")
@GetMapping(value = "/initWareHouseCode")
public ResponseEntity initWareHouseCode(){
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");//设置日期格式
String supplierCode = "CK"+ LocalDateTime.now().format(fmt);
return new ResponseEntity(supplierCode,HttpStatus.OK);
}
@Log("查看仓库详情") @Log("查看仓库详情")
@GetMapping(value = "/wareHouse/{id}") @GetMapping(value = "/wareHouse/{id}")
public ResponseEntity getMessureUnits(@PathVariable Long id){ public ResponseEntity getMessureUnits(@PathVariable Long id){