From 2c54901b25c629852490fba7d931d85d931f98b7 Mon Sep 17 00:00:00 2001 From: 17602169347 Date: Wed, 4 Jan 2023 13:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E6=A1=A3=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SupplierController.java | 353 ++++++++++++++++++ .../jnpf/supplier/entity/SupplierEntity.java | 103 +++++ .../jnpf/supplier/mapper/SupplierMapper.java | 17 + .../model/supplier/SupplierCrForm.java | 68 ++++ .../model/supplier/SupplierInfoVO.java | 70 ++++ .../model/supplier/SupplierListQuery.java | 27 ++ .../model/supplier/SupplierListVO.java | 82 ++++ .../model/supplier/SupplierPagination.java | 28 ++ .../SupplierPaginationExportModel.java | 29 ++ .../model/supplier/SupplierUpForm.java | 81 ++++ .../supplier/service/SupplierService.java | 34 ++ .../service/impl/SupplierServiceImpl.java | 234 ++++++++++++ .../src/main/resources/SupplierMapper.xml | 7 + .../basicInformation/supplier/Detail.vue | 153 ++++++++ .../basicInformation/supplier/ExportBox.vue | 68 ++++ .../views/basicInformation/supplier/Form.vue | 266 +++++++++++++ .../views/basicInformation/supplier/index.vue | 283 ++++++++++++++ 17 files changed, 1903 insertions(+) create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/controller/SupplierController.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/entity/SupplierEntity.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/mapper/SupplierMapper.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierCrForm.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierInfoVO.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierListQuery.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierListVO.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierPagination.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierPaginationExportModel.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierUpForm.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/SupplierService.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/impl/SupplierServiceImpl.java create mode 100644 SC-boot/linkage-scm/src/main/resources/SupplierMapper.xml create mode 100644 SC-web/src/views/basicInformation/supplier/Detail.vue create mode 100644 SC-web/src/views/basicInformation/supplier/ExportBox.vue create mode 100644 SC-web/src/views/basicInformation/supplier/Form.vue create mode 100644 SC-web/src/views/basicInformation/supplier/index.vue diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/controller/SupplierController.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/controller/SupplierController.java new file mode 100644 index 00000000..3bd29d94 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/controller/SupplierController.java @@ -0,0 +1,353 @@ + + +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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.config.ConfigValueUtil; +import jnpf.exception.DataException; +import org.springframework.transaction.annotation.Transactional; +import jnpf.base.entity.ProvinceEntity; +import jnpf.supplier.model.supplier.*; +import jnpf.supplier.model.supplier.SupplierPagination; +import jnpf.entity.*; +import jnpf.util.*; +import jnpf.base.util.*; +import jnpf.base.vo.ListVO; +import jnpf.util.context.SpringContext; +import cn.hutool.core.util.ObjectUtil; +import lombok.extern.slf4j.Slf4j; +import lombok.Cleanup; +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.SupplierEntity; +import jnpf.supplier.service.SupplierService; +import org.springframework.web.bind.annotation.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.multipart.MultipartFile; +import javax.validation.Valid; +import java.io.FileNotFoundException; +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; + +/** + * + * 供应商档案 + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Slf4j +@RestController +@Api(tags = "供应商档案" , value = "supplier") +@RequestMapping("/api/supplier/Supplier") +public class SupplierController { + + @Autowired + private GeneraterSwapUtil generaterSwapUtil; + + @Autowired + private ConfigValueUtil configValueUtil; + + @Autowired + private UserProvider userProvider; + + @Autowired + private SupplierService supplierService; + + + + + /** + * 列表 + * + * @param supplierPagination + * @return + */ + @PostMapping("/getList") + public ActionResult list(@RequestBody SupplierPagination supplierPagination)throws IOException{ + List list= supplierService.getList(supplierPagination); + //处理id字段转名称,若无需转或者为空可删除 + for(SupplierEntity entity:list){ + entity.setStatus(generaterSwapUtil.switchSelectValue(entity.getStatus() ,"1" ,"0")); + } + List listVO=JsonUtil.getJsonToList(list,SupplierListVO.class); + for(SupplierListVO supplierVO:listVO){ + } + + + PageListVO vo=new PageListVO(); + vo.setList(listVO); + PaginationVO page=JsonUtil.getJsonToBean(supplierPagination,PaginationVO.class); + vo.setPagination(page); + return ActionResult.success(vo); + } + + + /** + * 创建 + * + * @param supplierCrForm + * @return + */ + @PostMapping + @Transactional + public ActionResult create(@RequestBody @Valid SupplierCrForm supplierCrForm) throws DataException { + String mainId =RandomUtil.uuId(); + UserInfo userInfo=userProvider.get(); + SupplierEntity entity = JsonUtil.getJsonToBean(supplierCrForm, SupplierEntity.class); + entity.setId(mainId); + supplierService.save(entity); + + + return ActionResult.success("创建成功"); +} + + + + /** + * 模板下载 + * + * @return + */ + @ApiOperation("模板下载") + @GetMapping("/templateDownload") + public ActionResult TemplateDownload(){ + UserInfo userInfo=userProvider.get(); + DownloadVO vo=DownloadVO.builder().build(); + try{ + vo.setName("职员信息.xlsx"); + vo.setUrl(UploaderUtil.uploaderFile("/api/Common/DownloadModel?encryption=" ,userInfo.getId()+"#"+"职员信息.xlsx"+"#"+"Temporary")); + }catch(Exception e){ + log.error("信息导出Excel错误:{}" ,e.getMessage()); + } + return ActionResult.success(vo); + } + /** + * 导出Excel + * + * @return + */ + @ApiOperation("导出Excel") + @GetMapping("/Actions/Export") + public ActionResult Export(SupplierPaginationExportModel supplierPaginationExportModel) throws IOException { + if (StringUtil.isEmpty(supplierPaginationExportModel.getSelectKey())){ + return ActionResult.fail("请选择导出字段"); + } + SupplierPagination supplierPagination=JsonUtil.getJsonToBean(supplierPaginationExportModel, SupplierPagination.class); + List list= supplierService.getTypeList(supplierPagination,supplierPaginationExportModel.getDataType()); + //处理id字段转名称,若无需转或者为空可删除 + for(SupplierEntity entity:list){ + entity.setStatus(generaterSwapUtil.switchSelectValue(entity.getStatus() ,"1" ,"0")); + } + List listVO=JsonUtil.getJsonToList(list,SupplierListVO.class); + for(SupplierListVO supplierVO:listVO){ + } + + //转换为map输出 + List>mapList=JsonUtil.getJsonToListMap(JsonUtil.getObjectToStringDateFormat(listVO,"yyyy-MM-dd HH:mm:ss")); + String[]keys=!StringUtil.isEmpty(supplierPaginationExportModel.getSelectKey())?supplierPaginationExportModel.getSelectKey().split(","):new String[0]; + UserInfo userInfo=userProvider.get(); + DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),mapList,keys,userInfo); + return ActionResult.success(vo); + } + //导出表格 + public DownloadVO creatModelExcel(String path,List>list,String[]keys,UserInfo userInfo){ + DownloadVO vo=DownloadVO.builder().build(); + List entitys=new ArrayList<>(); + if(keys.length>0){ + for(String key:keys){ + switch(key){ + case "supplierCode" : + entitys.add(new ExcelExportEntity("供应商编码" ,"supplierCode")); + break; + case "supplierName" : + entitys.add(new ExcelExportEntity("供应商名称" ,"supplierName")); + break; + case "supplierSiteId" : + entitys.add(new ExcelExportEntity("地点ID" ,"supplierSiteId")); + break; + case "supplierSiteCode" : + entitys.add(new ExcelExportEntity("地点名称" ,"supplierSiteCode")); + break; + case "companyId" : + entitys.add(new ExcelExportEntity("所属公司编码" ,"companyId")); + break; + case "companyName" : + entitys.add(new ExcelExportEntity("所属公司名称" ,"companyName")); + break; + case "contactName" : + entitys.add(new ExcelExportEntity("联系人" ,"contactName")); + break; + case "contactPhone" : + entitys.add(new ExcelExportEntity("联系电话" ,"contactPhone")); + break; + case "supplierLevel" : + entitys.add(new ExcelExportEntity("供应商等级" ,"supplierLevel")); + break; + case "address" : + entitys.add(new ExcelExportEntity("地址" ,"address")); + break; + case "status" : + entitys.add(new ExcelExportEntity("启用" ,"status")); + break; + default: + break; + } + } + } + + ExportParams exportParams = new ExportParams(null, "表单信息"); + exportParams.setType(ExcelType.XSSF); + try{ + @Cleanup Workbook workbook = new HSSFWorkbook(); + if (entitys.size()>0){ + workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list); + } + String name = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx"; + + String fileName = configValueUtil.getTemporaryFilePath() + name; + @Cleanup FileOutputStream output = new FileOutputStream(XSSEscape.escapePath(fileName)); + workbook.write(output); + //上传文件 + UploadUtil.uploadFile(configValueUtil.getFileType(), fileName, FileTypeEnum.TEMPORARY, name); + + vo.setName(name); + vo.setUrl(UploaderUtil.uploaderFile(userInfo.getId() + "#" + name + "#" + "Temporary")); + } catch (Exception e) { + log.error("信息导出Excel错误:{}", e.getMessage()); + e.printStackTrace(); + } + return vo; + } + + + /** + * 批量删除 + * + * @param ids + * @return + */ + @DeleteMapping("/batchRemove/{ids}") + @Transactional + public ActionResult batchRemove(@PathVariable("ids") String ids){ + String[] idList = ids.split(","); + int i =0; + for (String allId : idList){ + this.delete(allId); + i++; + } + if (i == 0 ){ + return ActionResult.fail("删除失败"); + } + return ActionResult.success("删除成功"); + } + + + /** + * 信息 + * + * @param id + * @return + */ + @GetMapping("/{id}") + public ActionResult info(@PathVariable("id") String id){ + SupplierEntity entity= supplierService.getInfo(id); + SupplierInfoVO vo=JsonUtil.getJsonToBean(entity, SupplierInfoVO.class); + + //子表 + //副表 + return ActionResult.success(vo); + } + + /** + * 表单信息(详情页) + * + * @param id + * @return + */ + @GetMapping("/detail/{id}") + public ActionResult detailInfo(@PathVariable("id") String id){ + SupplierEntity entity= supplierService.getInfo(id); + SupplierInfoVO vo=JsonUtil.getJsonToBean(entity, SupplierInfoVO.class); + + //子表数据转换 + + //附表数据转换 + +//添加到详情表单对象中 + vo.setStatus(generaterSwapUtil.switchSelectValue(vo.getStatus() ,"1" ,"0")); + + return ActionResult.success(vo); + } + + + + + /** + * 更新 + * + * @param id + * @return + */ + @PutMapping("/{id}") + @Transactional + public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid SupplierUpForm supplierUpForm) throws DataException { + UserInfo userInfo=userProvider.get(); + SupplierEntity entity= supplierService.getInfo(id); + if(entity!=null){ + SupplierEntity subentity=JsonUtil.getJsonToBean(supplierUpForm, SupplierEntity.class); + supplierService.update(id, subentity); + return ActionResult.success("更新成功"); + }else{ + return ActionResult.fail("更新失败,数据不存在"); + } + } + + + + /** + * 删除 + * + * @param id + * @return + */ + @DeleteMapping("/{id}") + @Transactional + public ActionResult delete(@PathVariable("id") String id){ + SupplierEntity entity= supplierService.getInfo(id); + if(entity!=null){ + supplierService.delete(entity); + + } + return ActionResult.success("删除成功"); + } + + + + + + + + + + + +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/entity/SupplierEntity.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/entity/SupplierEntity.java new file mode 100644 index 00000000..2f93a57e --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/entity/SupplierEntity.java @@ -0,0 +1,103 @@ +package jnpf.supplier.entity; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonProperty; + + +/** + * + * 供应商档案 + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +@TableName("jg_supplier") +public class SupplierEntity { + + @TableId("ID") + private String id; + + @TableField("CREATOR_USER_ID") + private String creatorUserId; + + @TableField("CREATOR_USER_NAME") + private String creatorUserName; + + @TableField("CREATOR_TIME") + private Date creatorTime; + + @TableField("LAST_MODIFY_USER_ID") + private String lastModifyUserId; + + @TableField("LAST_MODIFY_USER_NAME") + private String lastModifyUserName; + + @TableField("LAST_MODIFY_TIME") + private Date lastModifyTime; + + @TableField("DELETE_USER_ID") + private String deleteUserId; + + @TableField("DELETE_USER_NAME") + private String deleteUserName; + + @TableField("DELETE_TIME") + private Date deleteTime; + + @TableField("DELETE_MARK") + private String deleteMark; + + @TableField("SUPPLIER_CODE") + private String supplierCode; + + @TableField("SUPPLIER_NAME") + private String supplierName; + + @TableField("SUPPLIER_SITE_ID") + private String supplierSiteId; + + @TableField("SUPPLIER_SITE_CODE") + private String supplierSiteCode; + + @TableField("COMPANY_ID") + private String companyId; + + @TableField("COMPANY_NAME") + private String companyName; + + @TableField("VAT_REGISTRATION_NUM") + private String vatRegistrationNum; + + @TableField("ORG_ID") + private String orgId; + + @TableField("DEPARTMENT_ID") + private String departmentId; + + @TableField("SUPPLY") + private Integer supply; + + @TableField("CONTACT_NAME") + private String contactName; + + @TableField("CONTACT_PHONE") + private String contactPhone; + + @TableField("SUPPLIER_LEVEL") + private String supplierLevel; + + @TableField("ADDRESS") + private String address; + + @TableField("STATUS") + private String status; + +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/mapper/SupplierMapper.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/mapper/SupplierMapper.java new file mode 100644 index 00000000..79eaf719 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/mapper/SupplierMapper.java @@ -0,0 +1,17 @@ +package jnpf.supplier.mapper; + + +import jnpf.supplier.entity.SupplierEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * + * 供应商档案 + * 版本: V3.2.0 + * 版权: LINKAGE-BOOT + * 作者: LINKAGE-BOOT研发团队 + * 日期: 2023-01-04 + */ +public interface SupplierMapper extends BaseMapper { + +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierCrForm.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierCrForm.java new file mode 100644 index 00000000..86f455a0 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierCrForm.java @@ -0,0 +1,68 @@ + + +package jnpf.supplier.model.supplier; + +import lombok.Data; +import java.util.List; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + + +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class SupplierCrForm { + + /** 供应商编码 **/ + @JsonProperty("supplierCode") + private String supplierCode; + + /** 供应商名称 **/ + @JsonProperty("supplierName") + private String supplierName; + + /** 地点ID **/ + @JsonProperty("supplierSiteId") + private String supplierSiteId; + + /** 地点名称 **/ + @JsonProperty("supplierSiteCode") + private String supplierSiteCode; + + /** 所属公司编码 **/ + @JsonProperty("companyId") + private String companyId; + + /** 所属公司名称 **/ + @JsonProperty("companyName") + private String companyName; + + /** 联系人 **/ + @JsonProperty("contactName") + private String contactName; + + /** 联系电话 **/ + @JsonProperty("contactPhone") + private String contactPhone; + + /** 供应商等级 **/ + @JsonProperty("supplierLevel") + private String supplierLevel; + + /** 地址 **/ + @JsonProperty("address") + private String address; + + /** 启用 **/ + @JsonProperty("status") + private String status; + + + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierInfoVO.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierInfoVO.java new file mode 100644 index 00000000..e803e7b8 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierInfoVO.java @@ -0,0 +1,70 @@ + + + +package jnpf.supplier.model.supplier; + +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class SupplierInfoVO{ + /** 主键 **/ + @JsonProperty("id") + private String id; + + /** 供应商编码 **/ + @JsonProperty("supplierCode") + private String supplierCode; + + /** 供应商名称 **/ + @JsonProperty("supplierName") + private String supplierName; + + /** 地点ID **/ + @JsonProperty("supplierSiteId") + private String supplierSiteId; + + /** 地点名称 **/ + @JsonProperty("supplierSiteCode") + private String supplierSiteCode; + + /** 所属公司编码 **/ + @JsonProperty("companyId") + private String companyId; + + /** 所属公司名称 **/ + @JsonProperty("companyName") + private String companyName; + + /** 联系人 **/ + @JsonProperty("contactName") + private String contactName; + + /** 联系电话 **/ + @JsonProperty("contactPhone") + private String contactPhone; + + /** 供应商等级 **/ + @JsonProperty("supplierLevel") + private String supplierLevel; + + /** 地址 **/ + @JsonProperty("address") + private String address; + + /** 启用 **/ + @JsonProperty("status") + private String status; + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierListQuery.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierListQuery.java new file mode 100644 index 00000000..0f3fbdae --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierListQuery.java @@ -0,0 +1,27 @@ +package jnpf.supplier.model.supplier; + +import lombok.Data; +import java.util.Date; +import jnpf.base.Pagination; +import java.util.List; +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class SupplierListQuery extends Pagination { + + /** 供应商编码 */ + private String supplierCode; + + /** 供应商名称 */ + private String supplierName; + /** + * 菜单id + */ + private String menuId; +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierListVO.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierListVO.java new file mode 100644 index 00000000..2abc3dc9 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierListVO.java @@ -0,0 +1,82 @@ + + +package jnpf.supplier.model.supplier; + + +import lombok.Data; +import java.sql.Time; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class SupplierListVO{ + + /** 主键 */ + private String id; + + + /** 供应商编码 **/ + @JsonProperty("supplierCode") + private String supplierCode; + + + /** 供应商名称 **/ + @JsonProperty("supplierName") + private String supplierName; + + + /** 地点ID **/ + @JsonProperty("supplierSiteId") + private String supplierSiteId; + + + /** 地点名称 **/ + @JsonProperty("supplierSiteCode") + private String supplierSiteCode; + + + /** 所属公司编码 **/ + @JsonProperty("companyId") + private String companyId; + + + /** 所属公司名称 **/ + @JsonProperty("companyName") + private String companyName; + + + /** 联系人 **/ + @JsonProperty("contactName") + private String contactName; + + + /** 联系电话 **/ + @JsonProperty("contactPhone") + private String contactPhone; + + + /** 供应商等级 **/ + @JsonProperty("supplierLevel") + private String supplierLevel; + + + /** 地址 **/ + @JsonProperty("address") + private String address; + + + /** 启用 **/ + @JsonProperty("status") + private String status; + + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierPagination.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierPagination.java new file mode 100644 index 00000000..ef76dbc7 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierPagination.java @@ -0,0 +1,28 @@ +package jnpf.supplier.model.supplier; + + +import lombok.Data; +import jnpf.base.Pagination; +import java.util.List; + +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class SupplierPagination extends Pagination { + + /** 供应商编码 */ + private String supplierCode; + + /** 供应商名称 */ + private String supplierName; + /** + * 菜单id + */ + private String menuId; +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierPaginationExportModel.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierPaginationExportModel.java new file mode 100644 index 00000000..be9429ac --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierPaginationExportModel.java @@ -0,0 +1,29 @@ +package jnpf.supplier.model.supplier; + +import lombok.Data; +import jnpf.base.Pagination; +import java.util.*; +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class SupplierPaginationExportModel extends Pagination { + + private String selectKey; + + private String json; + + private String dataType; + + + /** 供应商编码 */ + private String supplierCode; + + /** 供应商名称 */ + private String supplierName; +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierUpForm.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierUpForm.java new file mode 100644 index 00000000..2fbbda69 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/model/supplier/SupplierUpForm.java @@ -0,0 +1,81 @@ + + +package jnpf.supplier.model.supplier; + +import lombok.Data; +import java.util.List; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.Data; + +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class SupplierUpForm{ + /** 主键 */ + private String id; + + + /** 供应商编码 **/ + @JsonProperty("supplierCode") + private String supplierCode; + + + /** 供应商名称 **/ + @JsonProperty("supplierName") + private String supplierName; + + + /** 地点ID **/ + @JsonProperty("supplierSiteId") + private String supplierSiteId; + + + /** 地点名称 **/ + @JsonProperty("supplierSiteCode") + private String supplierSiteCode; + + + /** 所属公司编码 **/ + @JsonProperty("companyId") + private String companyId; + + + /** 所属公司名称 **/ + @JsonProperty("companyName") + private String companyName; + + + /** 联系人 **/ + @JsonProperty("contactName") + private String contactName; + + + /** 联系电话 **/ + @JsonProperty("contactPhone") + private String contactPhone; + + + /** 供应商等级 **/ + @JsonProperty("supplierLevel") + private String supplierLevel; + + + /** 地址 **/ + @JsonProperty("address") + private String address; + + + /** 启用 **/ + @JsonProperty("status") + private String status; + + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/SupplierService.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/SupplierService.java new file mode 100644 index 00000000..f3228135 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/SupplierService.java @@ -0,0 +1,34 @@ +package jnpf.supplier.service; + +import jnpf.supplier.entity.SupplierEntity; +import com.baomidou.mybatisplus.extension.service.IService; +import jnpf.supplier.model.supplier.SupplierPagination; +import java.util.*; +/** + * + * 供应商档案 + * 版本: V3.2.0 + * 版权: LINKAGE-BOOT + * 作者: LINKAGE-BOOT研发团队 + * 日期: 2023-01-04 + */ +public interface SupplierService extends IService { + + List getList(SupplierPagination supplierPagination); + + List getTypeList(SupplierPagination supplierPagination, String dataType); + + + + SupplierEntity getInfo(String id); + + void delete(SupplierEntity entity); + + void create(SupplierEntity entity); + + boolean update(String id, SupplierEntity entity); + +// 子表方法 + + //列表子表数据方法 +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/impl/SupplierServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/impl/SupplierServiceImpl.java new file mode 100644 index 00000000..e73a7773 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/impl/SupplierServiceImpl.java @@ -0,0 +1,234 @@ +package jnpf.supplier.service.impl; + +import jnpf.entity.*; +import jnpf.supplier.entity.SupplierEntity; +import jnpf.supplier.mapper.SupplierMapper; +import jnpf.service.*; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import jnpf.supplier.service.SupplierService; +import jnpf.util.RandomUtil; +import java.math.BigDecimal; +import cn.hutool.core.util.ObjectUtil; +import jnpf.permission.model.authorize.AuthorizeConditionModel; + + +import jnpf.supplier.model.supplier.SupplierPagination; + +import jnpf.permission.service.AuthorizeService; +import java.lang.reflect.Field; +import com.baomidou.mybatisplus.annotation.TableField; +import java.util.stream.Collectors; + + + + + + +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import java.text.SimpleDateFormat; +import jnpf.util.*; +import java.util.*; + +/** + * + * 供应商档案 + * 版本: V3.2.0 + * 版权: LINKAGE-BOOT + * 作者: LINKAGE-BOOT研发团队 + * 日期: 2023-01-04 + */ +@Service +public class SupplierServiceImpl extends ServiceImpl implements SupplierService { + + + @Autowired + private UserProvider userProvider; + + @Autowired + private AuthorizeService authorizeService; + + + + + + @Override + public List getList(SupplierPagination supplierPagination){ + String userId=userProvider.get().getUserId(); + List AllIdList =new ArrayList(); + int total=0; + int supplierNum =0; + QueryWrapper supplierQueryWrapper=new QueryWrapper<>(); + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); + if (ObjectUtil.isEmpty(supplierObj)){ + return new ArrayList<>(); + } else { + supplierQueryWrapper = (QueryWrapper)supplierObj; + supplierNum++; + } + } + } + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); + if (ObjectUtil.isEmpty(supplierObj)){ + return new ArrayList<>(); + } else { + supplierQueryWrapper = (QueryWrapper)supplierObj; + supplierNum++; + } + + + } + } + if(StringUtil.isNotEmpty(supplierPagination.getSupplierCode())){ + supplierNum++; + supplierQueryWrapper.lambda().like(SupplierEntity::getSupplierCode,supplierPagination.getSupplierCode()); + } + + if(StringUtil.isNotEmpty(supplierPagination.getSupplierName())){ + supplierNum++; + supplierQueryWrapper.lambda().like(SupplierEntity::getSupplierName,supplierPagination.getSupplierName()); + } + + if(AllIdList.size()>0){ + supplierQueryWrapper.lambda().in(SupplierEntity::getId, AllIdList); + } + //排序 + if(StringUtil.isEmpty(supplierPagination.getSidx())){ + supplierQueryWrapper.lambda().orderByDesc(SupplierEntity::getSupplierCode); + }else{ + try { + String sidx = supplierPagination.getSidx(); + SupplierEntity supplierEntity = new SupplierEntity(); + Field declaredField = supplierEntity.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + supplierQueryWrapper="asc".equals(supplierPagination.getSort().toLowerCase())?supplierQueryWrapper.orderByAsc(value):supplierQueryWrapper.orderByDesc(value); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } + } + if((total>0 && AllIdList.size()>0) || total==0){ + Page page=new Page<>(supplierPagination.getCurrentPage(), supplierPagination.getPageSize()); + IPage userIPage=this.page(page, supplierQueryWrapper); + return supplierPagination.setData(userIPage.getRecords(),userIPage.getTotal()); + }else{ + List list = new ArrayList(); + return supplierPagination.setData(list, list.size()); + } + } + @Override + public List getTypeList(SupplierPagination supplierPagination,String dataType){ + String userId=userProvider.get().getUserId(); + List AllIdList =new ArrayList(); + int total=0; + int supplierNum =0; + QueryWrapper supplierQueryWrapper=new QueryWrapper<>(); + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); + if (ObjectUtil.isEmpty(supplierObj)){ + return new ArrayList<>(); + } else { + supplierQueryWrapper = (QueryWrapper)supplierObj; + supplierNum++; + } + } + } + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); + if (ObjectUtil.isEmpty(supplierObj)){ + return new ArrayList<>(); + } else { + supplierQueryWrapper = (QueryWrapper)supplierObj; + supplierNum++; + } + + + } + } + if(StringUtil.isNotEmpty(supplierPagination.getSupplierCode())){ + supplierNum++; + supplierQueryWrapper.lambda().like(SupplierEntity::getSupplierCode,supplierPagination.getSupplierCode()); + } + + if(StringUtil.isNotEmpty(supplierPagination.getSupplierName())){ + supplierNum++; + supplierQueryWrapper.lambda().like(SupplierEntity::getSupplierName,supplierPagination.getSupplierName()); + } + + if(AllIdList.size()>0){ + supplierQueryWrapper.lambda().in(SupplierEntity::getId, AllIdList); + } + //排序 + if(StringUtil.isEmpty(supplierPagination.getSidx())){ + supplierQueryWrapper.lambda().orderByDesc(SupplierEntity::getSupplierCode); + }else{ + try { + String sidx = supplierPagination.getSidx(); + SupplierEntity supplierEntity = new SupplierEntity(); + Field declaredField = supplierEntity.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + supplierQueryWrapper="asc".equals(supplierPagination.getSort().toLowerCase())?supplierQueryWrapper.orderByAsc(value):supplierQueryWrapper.orderByDesc(value); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } + } + if("0".equals(dataType)){ + if((total>0 && AllIdList.size()>0) || total==0){ + Page page=new Page<>(supplierPagination.getCurrentPage(), supplierPagination.getPageSize()); + IPage userIPage=this.page(page, supplierQueryWrapper); + return supplierPagination.setData(userIPage.getRecords(),userIPage.getTotal()); + }else{ + List list = new ArrayList(); + return supplierPagination.setData(list, list.size()); + } + }else{ + return this.list(supplierQueryWrapper); + } + } + + @Override + public SupplierEntity getInfo(String id){ + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.lambda().eq(SupplierEntity::getId,id); + return this.getOne(queryWrapper); + } + + @Override + public void create(SupplierEntity entity){ + this.save(entity); + } + + @Override + public boolean update(String id, SupplierEntity entity){ + entity.setId(id); + return this.updateById(entity); + } + @Override + public void delete(SupplierEntity entity){ + if(entity!=null){ + this.removeById(entity.getId()); + } + } + //子表方法 + + //列表子表数据方法 + + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/resources/SupplierMapper.xml b/SC-boot/linkage-scm/src/main/resources/SupplierMapper.xml new file mode 100644 index 00000000..66141a71 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/resources/SupplierMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/SC-web/src/views/basicInformation/supplier/Detail.vue b/SC-web/src/views/basicInformation/supplier/Detail.vue new file mode 100644 index 00000000..2ed04789 --- /dev/null +++ b/SC-web/src/views/basicInformation/supplier/Detail.vue @@ -0,0 +1,153 @@ + + diff --git a/SC-web/src/views/basicInformation/supplier/ExportBox.vue b/SC-web/src/views/basicInformation/supplier/ExportBox.vue new file mode 100644 index 00000000..e61a2182 --- /dev/null +++ b/SC-web/src/views/basicInformation/supplier/ExportBox.vue @@ -0,0 +1,68 @@ + + + + \ No newline at end of file diff --git a/SC-web/src/views/basicInformation/supplier/Form.vue b/SC-web/src/views/basicInformation/supplier/Form.vue new file mode 100644 index 00000000..b0bafb3c --- /dev/null +++ b/SC-web/src/views/basicInformation/supplier/Form.vue @@ -0,0 +1,266 @@ + + diff --git a/SC-web/src/views/basicInformation/supplier/index.vue b/SC-web/src/views/basicInformation/supplier/index.vue new file mode 100644 index 00000000..7e8c011b --- /dev/null +++ b/SC-web/src/views/basicInformation/supplier/index.vue @@ -0,0 +1,283 @@ + + +