|
|
|
@ -15,22 +15,27 @@ import jnpf.model.yyssupplierinformation.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import jnpf.annotation.JnpfField;
|
|
|
|
|
import jnpf.base.vo.PageListVO;
|
|
|
|
|
import jnpf.base.vo.PaginationVO;
|
|
|
|
|
import jnpf.base.vo.DownloadVO;
|
|
|
|
|
import jnpf.config.ConfigValueUtil;
|
|
|
|
|
import jnpf.base.entity.ProvinceEntity;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import jnpf.engine.entity.FlowTaskEntity;
|
|
|
|
|
import jnpf.exception.WorkFlowException;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* yysSupplierInformation
|
|
|
|
|
*
|
|
|
|
|
* @版本: V3.5
|
|
|
|
|
* @版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
|
|
|
|
* @作者: JNPF开发平台组
|
|
|
|
@ -38,7 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
|
|
|
|
@Tag(name = "yysSupplierInformation" , description = "example")
|
|
|
|
|
@Tag(name = "yysSupplierInformation", description = "example")
|
|
|
|
|
@RequestMapping("/api/example/YysSupplierInformation")
|
|
|
|
|
public class YysSupplierInformationController {
|
|
|
|
|
|
|
|
|
@ -52,27 +57,26 @@ public class YysSupplierInformationController {
|
|
|
|
|
private YysSupplierInformationService yysSupplierInformationService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 列表
|
|
|
|
|
*
|
|
|
|
|
* @param yysSupplierInformationPagination
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
* 列表
|
|
|
|
|
*
|
|
|
|
|
* @param yysSupplierInformationPagination
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Operation(summary = "获取列表")
|
|
|
|
|
@PostMapping("/getList")
|
|
|
|
|
public ActionResult list(@RequestBody YysSupplierInformationPagination yysSupplierInformationPagination)throws IOException{
|
|
|
|
|
List<YysSupplierInformationEntity> list= yysSupplierInformationService.getList(yysSupplierInformationPagination);
|
|
|
|
|
List<Map<String, Object>> realList=new ArrayList<>();
|
|
|
|
|
public ActionResult list(@RequestBody YysSupplierInformationPagination yysSupplierInformationPagination) throws IOException {
|
|
|
|
|
List<YysSupplierInformationEntity> list = yysSupplierInformationService.getList(yysSupplierInformationPagination);
|
|
|
|
|
List<Map<String, Object>> realList = new ArrayList<>();
|
|
|
|
|
for (YysSupplierInformationEntity entity : list) {
|
|
|
|
|
Map<String, Object> yysSupplierInformationMap=JsonUtil.entityToMap(entity);
|
|
|
|
|
yysSupplierInformationMap.put("id", yysSupplierInformationMap.get("id"));
|
|
|
|
|
//副表数据
|
|
|
|
|
//子表数据
|
|
|
|
|
Map<String, Object> yysSupplierInformationMap = JsonUtil.entityToMap(entity);
|
|
|
|
|
yysSupplierInformationMap.put("id", yysSupplierInformationMap.get("id"));
|
|
|
|
|
//副表数据
|
|
|
|
|
//子表数据
|
|
|
|
|
realList.add(yysSupplierInformationMap);
|
|
|
|
|
}
|
|
|
|
|
//数据转换
|
|
|
|
|
realList = generaterSwapUtil.swapDataList(realList, YysSupplierInformationConstant.getFormData(), YysSupplierInformationConstant.getColumnData(), yysSupplierInformationPagination.getModuleId(),false);
|
|
|
|
|
realList = generaterSwapUtil.swapDataList(realList, YysSupplierInformationConstant.getFormData(), YysSupplierInformationConstant.getColumnData(), yysSupplierInformationPagination.getModuleId(), false);
|
|
|
|
|
|
|
|
|
|
//返回对象
|
|
|
|
|
PageListVO vo = new PageListVO();
|
|
|
|
@ -81,110 +85,125 @@ public class YysSupplierInformationController {
|
|
|
|
|
vo.setPagination(page);
|
|
|
|
|
return ActionResult.success(vo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建
|
|
|
|
|
*
|
|
|
|
|
* @param yysSupplierInformationForm
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
* 创建
|
|
|
|
|
*
|
|
|
|
|
* @param yysSupplierInformationForm
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping()
|
|
|
|
|
@Operation(summary = "创建")
|
|
|
|
|
public ActionResult create(@RequestBody @Valid YysSupplierInformationForm yysSupplierInformationForm) {
|
|
|
|
|
String b = yysSupplierInformationService.checkForm(yysSupplierInformationForm,0);
|
|
|
|
|
if (StringUtil.isNotEmpty(b)){
|
|
|
|
|
return ActionResult.fail(b );
|
|
|
|
|
String b = yysSupplierInformationService.checkForm(yysSupplierInformationForm, 0);
|
|
|
|
|
if (StringUtil.isNotEmpty(b)) {
|
|
|
|
|
return ActionResult.fail(b);
|
|
|
|
|
}
|
|
|
|
|
try{
|
|
|
|
|
yysSupplierInformationService.saveOrUpdate(yysSupplierInformationForm, null ,true);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
try {
|
|
|
|
|
yysSupplierInformationService.saveOrUpdate(yysSupplierInformationForm, null, true);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ActionResult.fail("新增数据失败");
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("创建成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 编辑
|
|
|
|
|
* @param id
|
|
|
|
|
* @param yysSupplierInformationForm
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
* 编辑
|
|
|
|
|
*
|
|
|
|
|
* @param id
|
|
|
|
|
* @param yysSupplierInformationForm
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PutMapping("/{id}")
|
|
|
|
|
@Operation(summary = "更新")
|
|
|
|
|
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid YysSupplierInformationForm yysSupplierInformationForm,
|
|
|
|
|
@RequestParam(value = "isImport", required = false) boolean isImport){
|
|
|
|
|
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid YysSupplierInformationForm yysSupplierInformationForm,
|
|
|
|
|
@RequestParam(value = "isImport", required = false) boolean isImport) {
|
|
|
|
|
yysSupplierInformationForm.setId(id);
|
|
|
|
|
if (!isImport) {
|
|
|
|
|
String b = yysSupplierInformationService.checkForm(yysSupplierInformationForm,1);
|
|
|
|
|
if (StringUtil.isNotEmpty(b)){
|
|
|
|
|
return ActionResult.fail(b );
|
|
|
|
|
String b = yysSupplierInformationService.checkForm(yysSupplierInformationForm, 1);
|
|
|
|
|
if (StringUtil.isNotEmpty(b)) {
|
|
|
|
|
return ActionResult.fail(b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
YysSupplierInformationEntity entity= yysSupplierInformationService.getInfo(id);
|
|
|
|
|
if(entity!=null){
|
|
|
|
|
try{
|
|
|
|
|
yysSupplierInformationService.saveOrUpdate(yysSupplierInformationForm,id,false);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
YysSupplierInformationEntity entity = yysSupplierInformationService.getInfo(id);
|
|
|
|
|
if (entity != null) {
|
|
|
|
|
try {
|
|
|
|
|
yysSupplierInformationService.saveOrUpdate(yysSupplierInformationForm, id, false);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ActionResult.fail("修改数据失败");
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("更新成功");
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
return ActionResult.fail("更新失败,数据不存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
* 删除
|
|
|
|
|
*
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Operation(summary = "删除")
|
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
|
|
@Transactional
|
|
|
|
|
public ActionResult delete(@PathVariable("id") String id){
|
|
|
|
|
YysSupplierInformationEntity entity= yysSupplierInformationService.getInfo(id);
|
|
|
|
|
if(entity!=null){
|
|
|
|
|
public ActionResult delete(@PathVariable("id") String id) {
|
|
|
|
|
YysSupplierInformationEntity entity = yysSupplierInformationService.getInfo(id);
|
|
|
|
|
if (entity != null) {
|
|
|
|
|
//主表数据删除
|
|
|
|
|
yysSupplierInformationService.delete(entity);
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("删除成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 表单信息(详情页)
|
|
|
|
|
* 详情页面使用-转换数据
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
* 表单信息(详情页)
|
|
|
|
|
* 详情页面使用-转换数据
|
|
|
|
|
*
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Operation(summary = "表单信息(详情页)")
|
|
|
|
|
@GetMapping("/detail/{id}")
|
|
|
|
|
public ActionResult detailInfo(@PathVariable("id") String id){
|
|
|
|
|
YysSupplierInformationEntity entity= yysSupplierInformationService.getInfo(id);
|
|
|
|
|
if(entity==null){
|
|
|
|
|
public ActionResult detailInfo(@PathVariable("id") String id) {
|
|
|
|
|
YysSupplierInformationEntity entity = yysSupplierInformationService.getInfo(id);
|
|
|
|
|
if (entity == null) {
|
|
|
|
|
return ActionResult.fail("表单数据不存在!");
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> yysSupplierInformationMap=JsonUtil.entityToMap(entity);
|
|
|
|
|
Map<String, Object> yysSupplierInformationMap = JsonUtil.entityToMap(entity);
|
|
|
|
|
yysSupplierInformationMap.put("id", yysSupplierInformationMap.get("id"));
|
|
|
|
|
//副表数据
|
|
|
|
|
//子表数据
|
|
|
|
|
yysSupplierInformationMap = generaterSwapUtil.swapDataDetail(yysSupplierInformationMap,YysSupplierInformationConstant.getFormData(),"591239930433244933",false);
|
|
|
|
|
yysSupplierInformationMap = generaterSwapUtil.swapDataDetail(yysSupplierInformationMap, YysSupplierInformationConstant.getFormData(), "591239930433244933", false);
|
|
|
|
|
return ActionResult.success(yysSupplierInformationMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取详情(编辑页)
|
|
|
|
|
* 编辑页面使用-不转换数据
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
* 获取详情(编辑页)
|
|
|
|
|
* 编辑页面使用-不转换数据
|
|
|
|
|
*
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Operation(summary = "信息")
|
|
|
|
|
@GetMapping("/{id}")
|
|
|
|
|
public ActionResult info(@PathVariable("id") String id){
|
|
|
|
|
YysSupplierInformationEntity entity= yysSupplierInformationService.getInfo(id);
|
|
|
|
|
if(entity==null){
|
|
|
|
|
public ActionResult info(@PathVariable("id") String id) {
|
|
|
|
|
YysSupplierInformationEntity entity = yysSupplierInformationService.getInfo(id);
|
|
|
|
|
if (entity == null) {
|
|
|
|
|
return ActionResult.fail("表单数据不存在!");
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> yysSupplierInformationMap=JsonUtil.entityToMap(entity);
|
|
|
|
|
Map<String, Object> yysSupplierInformationMap = JsonUtil.entityToMap(entity);
|
|
|
|
|
yysSupplierInformationMap.put("id", yysSupplierInformationMap.get("id"));
|
|
|
|
|
//副表数据
|
|
|
|
|
//子表数据
|
|
|
|
|
yysSupplierInformationMap = generaterSwapUtil.swapDataForm(yysSupplierInformationMap,YysSupplierInformationConstant.getFormData(),YysSupplierInformationConstant.TABLEFIELDKEY,YysSupplierInformationConstant.TABLERENAMES);
|
|
|
|
|
yysSupplierInformationMap = generaterSwapUtil.swapDataForm(yysSupplierInformationMap, YysSupplierInformationConstant.getFormData(), YysSupplierInformationConstant.TABLEFIELDKEY, YysSupplierInformationConstant.TABLERENAMES);
|
|
|
|
|
return ActionResult.success(yysSupplierInformationMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "测试连接sqlserver数据库返回数据")
|
|
|
|
|
@GetMapping("/test")
|
|
|
|
|
public ActionResult test() {
|
|
|
|
|
return ActionResult.success(yysSupplierInformationService.test());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|