|
|
|
@ -1,56 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package jnpf.supplier.controller;
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import jnpf.base.ActionResult;
|
|
|
|
|
import jnpf.base.vo.PageListVO;
|
|
|
|
|
import jnpf.base.vo.PaginationVO;
|
|
|
|
|
import jnpf.base.UserInfo;
|
|
|
|
|
import jnpf.base.vo.DownloadVO;
|
|
|
|
|
import jnpf.base.vo.PageListVO;
|
|
|
|
|
import jnpf.base.vo.PaginationVO;
|
|
|
|
|
import jnpf.config.ConfigValueUtil;
|
|
|
|
|
import jnpf.exception.DataException;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import jnpf.supplier.entity.SupplierEntity;
|
|
|
|
|
import jnpf.supplier.entity.SupplierMobileEntity;
|
|
|
|
|
import jnpf.supplier.model.supplier.*;
|
|
|
|
|
import jnpf.supplier.model.supplier.SupplierPagination;
|
|
|
|
|
import jnpf.supplier.service.SupplierService;
|
|
|
|
|
import jnpf.util.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import jnpf.util.enums.FileTypeEnum;
|
|
|
|
|
import jnpf.util.file.UploadUtil;
|
|
|
|
|
import lombok.Cleanup;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import jnpf.supplier.entity.SupplierMobileEntity;
|
|
|
|
|
import jnpf.supplier.service.SupplierMobileService;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import jnpf.util.GeneraterSwapUtil;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import jnpf.util.file.UploadUtil;
|
|
|
|
|
import jnpf.util.enums.FileTypeEnum;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* supplier
|
|
|
|
|
* 供应商档案
|
|
|
|
|
* @版本: V3.2.0
|
|
|
|
|
* @版权: LINKAGE-BOOT
|
|
|
|
|
* @作者: LINKAGE-BOOT研发团队
|
|
|
|
|
* @日期: 2023-02-13
|
|
|
|
|
* @日期: 2023-02-16
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
|
|
|
|
@Api(tags = "supplier" , value = "supplier")
|
|
|
|
|
@RequestMapping("/api/supplier/Supplier")
|
|
|
|
|
public class SupplierMobileController {
|
|
|
|
|
@Api(tags = "供应商档案" , value = "example")
|
|
|
|
|
@RequestMapping("/api/example/Supplier")
|
|
|
|
|
public class SupplierController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private GeneraterSwapUtil generaterSwapUtil;
|
|
|
|
@ -62,7 +62,7 @@ public class SupplierMobileController {
|
|
|
|
|
private UserProvider userProvider;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SupplierMobileService supplierMobileService;
|
|
|
|
|
private SupplierService supplierService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -75,10 +75,12 @@ public class SupplierMobileController {
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/getList")
|
|
|
|
|
public ActionResult list(@RequestBody SupplierPagination supplierPagination)throws IOException{
|
|
|
|
|
List<SupplierMobileEntity> list= supplierMobileService.getList(supplierPagination);
|
|
|
|
|
List<SupplierMobileEntity> list= supplierService.getList(supplierPagination);
|
|
|
|
|
//处理id字段转名称,若无需转或者为空可删除
|
|
|
|
|
for(SupplierMobileEntity entity:list){
|
|
|
|
|
entity.setCompanyId(generaterSwapUtil.comSelectValues(entity.getCompanyId()));
|
|
|
|
|
Map<String,Object> companyIdMap = new HashMap<>();
|
|
|
|
|
entity.setCompanyId(generaterSwapUtil.getPopupSelectValue("394016341591396805","F_Id","F_FullName",entity.getCompanyId(),companyIdMap));
|
|
|
|
|
entity.setProvince(generaterSwapUtil.provinceData(entity.getProvince()));
|
|
|
|
|
entity.setStatus(generaterSwapUtil.switchSelectValue(entity.getStatus() ,"1" ,"0"));
|
|
|
|
|
}
|
|
|
|
|
List<SupplierListVO> listVO=JsonUtil.getJsonToList(list,SupplierListVO.class);
|
|
|
|
@ -105,9 +107,10 @@ public class SupplierMobileController {
|
|
|
|
|
public ActionResult create(@RequestBody @Valid SupplierCrForm supplierCrForm) throws DataException {
|
|
|
|
|
String mainId =RandomUtil.uuId();
|
|
|
|
|
UserInfo userInfo=userProvider.get();
|
|
|
|
|
SupplierMobileEntity entity = JsonUtil.getJsonToBean(supplierCrForm, SupplierMobileEntity.class);
|
|
|
|
|
supplierCrForm.setCreatorTime(DateUtil.getNow());
|
|
|
|
|
SupplierEntity entity = JsonUtil.getJsonToBean(supplierCrForm, SupplierEntity.class);
|
|
|
|
|
entity.setId(mainId);
|
|
|
|
|
supplierMobileService.save(entity);
|
|
|
|
|
supplierService.save(entity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ActionResult.success("创建成功");
|
|
|
|
@ -145,10 +148,12 @@ public class SupplierMobileController {
|
|
|
|
|
return ActionResult.fail("请选择导出字段");
|
|
|
|
|
}
|
|
|
|
|
SupplierPagination supplierPagination=JsonUtil.getJsonToBean(supplierPaginationExportModel, SupplierPagination.class);
|
|
|
|
|
List<SupplierMobileEntity> list= supplierMobileService.getTypeList(supplierPagination,supplierPaginationExportModel.getDataType());
|
|
|
|
|
List<SupplierEntity> list= supplierService.getTypeList(supplierPagination,supplierPaginationExportModel.getDataType());
|
|
|
|
|
//处理id字段转名称,若无需转或者为空可删除
|
|
|
|
|
for(SupplierMobileEntity entity:list){
|
|
|
|
|
entity.setCompanyId(generaterSwapUtil.comSelectValues(entity.getCompanyId()));
|
|
|
|
|
for(SupplierEntity entity:list){
|
|
|
|
|
Map<String,Object> companyIdMap = new HashMap<>();
|
|
|
|
|
entity.setCompanyId(generaterSwapUtil.getPopupSelectValue("394016341591396805","F_Id","F_FullName",entity.getCompanyId(),companyIdMap));
|
|
|
|
|
entity.setProvince(generaterSwapUtil.provinceData(entity.getProvince()));
|
|
|
|
|
entity.setStatus(generaterSwapUtil.switchSelectValue(entity.getStatus() ,"1" ,"0"));
|
|
|
|
|
}
|
|
|
|
|
List<SupplierListVO> listVO=JsonUtil.getJsonToList(list,SupplierListVO.class);
|
|
|
|
@ -172,33 +177,75 @@ public class SupplierMobileController {
|
|
|
|
|
case "supplierCode" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商编码" ,"supplierCode"));
|
|
|
|
|
break;
|
|
|
|
|
case "companyId" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("所属公司" ,"companyId"));
|
|
|
|
|
break;
|
|
|
|
|
case "supplierName" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商名称" ,"supplierName"));
|
|
|
|
|
break;
|
|
|
|
|
case "supplierSiteId" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商地点ID" ,"supplierSiteId"));
|
|
|
|
|
case "country" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("国家" ,"country"));
|
|
|
|
|
break;
|
|
|
|
|
case "supplierSiteCode" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商地点名称" ,"supplierSiteCode"));
|
|
|
|
|
case "supply" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供货指标" ,"supply"));
|
|
|
|
|
break;
|
|
|
|
|
case "companyId" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("公司名称" ,"companyId"));
|
|
|
|
|
break;
|
|
|
|
|
case "address" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("地址" ,"address"));
|
|
|
|
|
case "province" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("省" ,"province"));
|
|
|
|
|
break;
|
|
|
|
|
case "contactName" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("联系人" ,"contactName"));
|
|
|
|
|
break;
|
|
|
|
|
case "supplierLevel" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商等级" ,"supplierLevel"));
|
|
|
|
|
break;
|
|
|
|
|
case "contactPhone" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("联系电话" ,"contactPhone"));
|
|
|
|
|
break;
|
|
|
|
|
case "supplierLevel" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商等级" ,"supplierLevel"));
|
|
|
|
|
case "enterprise" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商性质" ,"enterprise"));
|
|
|
|
|
break;
|
|
|
|
|
case "address" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("地址" ,"address"));
|
|
|
|
|
break;
|
|
|
|
|
case "classification" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商类型" ,"classification"));
|
|
|
|
|
break;
|
|
|
|
|
case "bank" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("开户行" ,"bank"));
|
|
|
|
|
break;
|
|
|
|
|
case "vatRegistrationNum" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("纳税编号" ,"vatRegistrationNum"));
|
|
|
|
|
break;
|
|
|
|
|
case "bankAccount" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("银行账户" ,"bankAccount"));
|
|
|
|
|
break;
|
|
|
|
|
case "taxCode" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("默认税码" ,"taxCode"));
|
|
|
|
|
break;
|
|
|
|
|
case "payable" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("应付科目" ,"payable"));
|
|
|
|
|
break;
|
|
|
|
|
case "isPurchase" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("是否采购" ,"isPurchase"));
|
|
|
|
|
break;
|
|
|
|
|
case "prepaid" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("预付科目" ,"prepaid"));
|
|
|
|
|
break;
|
|
|
|
|
case "isPayment" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("是否付款" ,"isPayment"));
|
|
|
|
|
break;
|
|
|
|
|
case "status" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("启用" ,"status"));
|
|
|
|
|
break;
|
|
|
|
|
case "supplierSiteCode" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("供应商地点" ,"supplierSiteCode"));
|
|
|
|
|
break;
|
|
|
|
|
case "creatorTime" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("创建时间" ,"creatorTime"));
|
|
|
|
|
break;
|
|
|
|
|
case "lastModifyTime" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("修改时间" ,"lastModifyTime"));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -260,8 +307,14 @@ public class SupplierMobileController {
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/{id}")
|
|
|
|
|
public ActionResult<SupplierInfoVO> info(@PathVariable("id") String id){
|
|
|
|
|
SupplierMobileEntity entity= supplierMobileService.getInfo(id);
|
|
|
|
|
SupplierEntity entity= supplierService.getInfo(id);
|
|
|
|
|
SupplierInfoVO vo=JsonUtil.getJsonToBean(entity, SupplierInfoVO.class);
|
|
|
|
|
if(vo.getCreatorTime()!=null){
|
|
|
|
|
vo.setCreatorTime(vo.getCreatorTime());
|
|
|
|
|
}
|
|
|
|
|
if(vo.getLastModifyTime()!=null){
|
|
|
|
|
vo.setLastModifyTime(vo.getLastModifyTime());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//子表
|
|
|
|
|
//副表
|
|
|
|
@ -276,7 +329,7 @@ public class SupplierMobileController {
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/detail/{id}")
|
|
|
|
|
public ActionResult<SupplierInfoVO> detailInfo(@PathVariable("id") String id){
|
|
|
|
|
SupplierMobileEntity entity= supplierMobileService.getInfo(id);
|
|
|
|
|
SupplierEntity entity= supplierService.getInfo(id);
|
|
|
|
|
SupplierInfoVO vo=JsonUtil.getJsonToBean(entity, SupplierInfoVO.class);
|
|
|
|
|
|
|
|
|
|
//子表数据转换
|
|
|
|
@ -284,7 +337,9 @@ public class SupplierMobileController {
|
|
|
|
|
//附表数据转换
|
|
|
|
|
|
|
|
|
|
//添加到详情表单对象中
|
|
|
|
|
vo.setCompanyId(generaterSwapUtil.comSelectValues(vo.getCompanyId()));
|
|
|
|
|
Map<String,Object> companyIdMap = new HashMap<>();
|
|
|
|
|
vo.setCompanyId(generaterSwapUtil.getPopupSelectValue("394016341591396805","F_Id","F_FullName",vo.getCompanyId(),companyIdMap));
|
|
|
|
|
vo.setProvince(generaterSwapUtil.provinceData(vo.getProvince()));
|
|
|
|
|
vo.setStatus(generaterSwapUtil.switchSelectValue(vo.getStatus() ,"1" ,"0"));
|
|
|
|
|
|
|
|
|
|
return ActionResult.success(vo);
|
|
|
|
@ -303,10 +358,12 @@ public class SupplierMobileController {
|
|
|
|
|
@Transactional
|
|
|
|
|
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid SupplierUpForm supplierUpForm) throws DataException {
|
|
|
|
|
UserInfo userInfo=userProvider.get();
|
|
|
|
|
SupplierMobileEntity entity= supplierMobileService.getInfo(id);
|
|
|
|
|
SupplierEntity entity= supplierService.getInfo(id);
|
|
|
|
|
if(entity!=null){
|
|
|
|
|
SupplierMobileEntity subentity=JsonUtil.getJsonToBean(supplierUpForm, SupplierMobileEntity.class);
|
|
|
|
|
supplierMobileService.update(id, subentity);
|
|
|
|
|
supplierUpForm.setLastModifyTime(DateUtil.getNow());
|
|
|
|
|
SupplierEntity subentity=JsonUtil.getJsonToBean(supplierUpForm, SupplierEntity.class);
|
|
|
|
|
subentity.setCreatorTime(entity.getCreatorTime());
|
|
|
|
|
supplierService.update(id, subentity);
|
|
|
|
|
return ActionResult.success("更新成功");
|
|
|
|
|
}else{
|
|
|
|
|
return ActionResult.fail("更新失败,数据不存在");
|
|
|
|
@ -324,9 +381,9 @@ public class SupplierMobileController {
|
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
|
|
@Transactional
|
|
|
|
|
public ActionResult delete(@PathVariable("id") String id){
|
|
|
|
|
SupplierMobileEntity entity= supplierMobileService.getInfo(id);
|
|
|
|
|
SupplierEntity entity= supplierService.getInfo(id);
|
|
|
|
|
if(entity!=null){
|
|
|
|
|
supplierMobileService.delete(entity);
|
|
|
|
|
supplierService.delete(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("删除成功");
|
|
|
|
@ -337,9 +394,4 @@ public class SupplierMobileController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|