From 5a0186fd919d442b67f53d00588b70eb86a5a0dd Mon Sep 17 00:00:00 2001 From: 17602169347 Date: Thu, 5 Jan 2023 09:42:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CustomerJGController.java | 347 ++++++++++++++++++ .../customer/entity/CustomerJGEntity.java | 100 +++++ .../customer/mapper/CustomerJGMapper.java | 17 + .../model/customer/CustomerCrForm.java | 60 +++ .../model/customer/CustomerInfoVO.java | 62 ++++ .../model/customer/CustomerListQuery.java | 27 ++ .../model/customer/CustomerListVO.java | 72 ++++ .../model/customer/CustomerPagination.java | 28 ++ .../CustomerPaginationExportModel.java | 29 ++ .../model/customer/CustomerUpForm.java | 71 ++++ .../customer/service/CustomerJGService.java | 35 ++ .../service/impl/CustomerJGServiceImpl.java | 232 ++++++++++++ .../src/main/java/jnpf/module_name_1/test.txt | 0 .../src/main/java/jnpf/module_name_2/test.txt | 0 .../src/main/resources/CustomerMapper.xml | 7 + .../scm/basicInformation/customer/Detail.vue | 132 +++++++ .../basicInformation/customer/ExportBox.vue | 68 ++++ .../scm/basicInformation/customer/Form.vue | 241 ++++++++++++ .../scm/basicInformation/customer/index.vue | 277 ++++++++++++++ .../scm/basicInformation/supplier/index.vue | 14 +- 20 files changed, 1817 insertions(+), 2 deletions(-) create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/controller/CustomerJGController.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/entity/CustomerJGEntity.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/mapper/CustomerJGMapper.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerCrForm.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerInfoVO.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerListQuery.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerListVO.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerPagination.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerPaginationExportModel.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerUpForm.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/service/CustomerJGService.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/customer/service/impl/CustomerJGServiceImpl.java delete mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/module_name_1/test.txt delete mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/module_name_2/test.txt create mode 100644 SC-boot/linkage-scm/src/main/resources/CustomerMapper.xml create mode 100644 SC-web/src/views/scm/basicInformation/customer/Detail.vue create mode 100644 SC-web/src/views/scm/basicInformation/customer/ExportBox.vue create mode 100644 SC-web/src/views/scm/basicInformation/customer/Form.vue create mode 100644 SC-web/src/views/scm/basicInformation/customer/index.vue diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/controller/CustomerJGController.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/controller/CustomerJGController.java new file mode 100644 index 00000000..9fd3a6c6 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/controller/CustomerJGController.java @@ -0,0 +1,347 @@ + + +package jnpf.customer.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.customer.model.customer.*; +import jnpf.customer.model.customer.CustomerPagination; +import jnpf.customer.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.customer.entity.CustomerJGEntity; +import jnpf.customer.service.CustomerJGService; +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 = "customer") +@RequestMapping("/api/customer/Customer") +public class CustomerJGController { + + @Autowired + private GeneraterSwapUtil generaterSwapUtil; + + @Autowired + private ConfigValueUtil configValueUtil; + + @Autowired + private UserProvider userProvider; + + @Autowired + private CustomerJGService customerService; + + + + + /** + * 列表 + * + * @param customerPagination + * @return + */ + @PostMapping("/getList") + public ActionResult list(@RequestBody CustomerPagination customerPagination)throws IOException{ + List list= customerService.getList(customerPagination); + //处理id字段转名称,若无需转或者为空可删除 + for(CustomerJGEntity entity:list){ + entity.setStatus(generaterSwapUtil.switchSelectValue(entity.getStatus() ,"1" ,"2")); + } + List listVO=JsonUtil.getJsonToList(list,CustomerListVO.class); + for(CustomerListVO customerVO:listVO){ + } + + + PageListVO vo=new PageListVO(); + vo.setList(listVO); + PaginationVO page=JsonUtil.getJsonToBean(customerPagination,PaginationVO.class); + vo.setPagination(page); + return ActionResult.success(vo); + } + + + /** + * 创建 + * + * @param customerCrForm + * @return + */ + @PostMapping + @Transactional + public ActionResult create(@RequestBody @Valid CustomerCrForm customerCrForm) throws DataException { + String mainId =RandomUtil.uuId(); + UserInfo userInfo=userProvider.get(); + CustomerJGEntity entity = JsonUtil.getJsonToBean(customerCrForm, CustomerJGEntity.class); + entity.setId(mainId); + customerService.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(CustomerPaginationExportModel customerPaginationExportModel) throws IOException { + if (StringUtil.isEmpty(customerPaginationExportModel.getSelectKey())){ + return ActionResult.fail("请选择导出字段"); + } + CustomerPagination customerPagination=JsonUtil.getJsonToBean(customerPaginationExportModel, CustomerPagination.class); + List list= customerService.getTypeList(customerPagination,customerPaginationExportModel.getDataType()); + //处理id字段转名称,若无需转或者为空可删除 + for(CustomerJGEntity entity:list){ + entity.setStatus(generaterSwapUtil.switchSelectValue(entity.getStatus() ,"1" ,"2")); + } + List listVO=JsonUtil.getJsonToList(list,CustomerListVO.class); + for(CustomerListVO customerVO:listVO){ + } + + //转换为map输出 + List>mapList=JsonUtil.getJsonToListMap(JsonUtil.getObjectToStringDateFormat(listVO,"yyyy-MM-dd HH:mm:ss")); + String[]keys=!StringUtil.isEmpty(customerPaginationExportModel.getSelectKey())?customerPaginationExportModel.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 "supplierCd" : + entitys.add(new ExcelExportEntity("客户编码" ,"supplierCd")); + break; + case "supplierNm" : + entitys.add(new ExcelExportEntity("客户名称" ,"supplierNm")); + break; + case "orgId" : + entitys.add(new ExcelExportEntity("所属公司ID" ,"orgId")); + break; + case "orgName" : + entitys.add(new ExcelExportEntity("公司代码" ,"orgName")); + break; + case "customerLevel" : + entitys.add(new ExcelExportEntity("客户等级" ,"customerLevel")); + break; + case "contactName" : + entitys.add(new ExcelExportEntity("联系人" ,"contactName")); + break; + case "address" : + entitys.add(new ExcelExportEntity("地址" ,"address")); + break; + case "contactPhone" : + entitys.add(new ExcelExportEntity("电话" ,"contactPhone")); + 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){ + CustomerJGEntity entity= customerService.getInfo(id); + CustomerInfoVO vo=JsonUtil.getJsonToBean(entity, CustomerInfoVO.class); + + //子表 + //副表 + return ActionResult.success(vo); + } + + /** + * 表单信息(详情页) + * + * @param id + * @return + */ + @GetMapping("/detail/{id}") + public ActionResult detailInfo(@PathVariable("id") String id){ + CustomerJGEntity entity= customerService.getInfo(id); + CustomerInfoVO vo=JsonUtil.getJsonToBean(entity, CustomerInfoVO.class); + + //子表数据转换 + + //附表数据转换 + +//添加到详情表单对象中 + vo.setStatus(generaterSwapUtil.switchSelectValue(vo.getStatus() ,"1" ,"2")); + + return ActionResult.success(vo); + } + + + + + /** + * 更新 + * + * @param id + * @return + */ + @PutMapping("/{id}") + @Transactional + public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid CustomerUpForm customerUpForm) throws DataException { + UserInfo userInfo=userProvider.get(); + CustomerJGEntity entity= customerService.getInfo(id); + if(entity!=null){ + CustomerJGEntity subentity=JsonUtil.getJsonToBean(customerUpForm, CustomerJGEntity.class); + customerService.update(id, subentity); + return ActionResult.success("更新成功"); + }else{ + return ActionResult.fail("更新失败,数据不存在"); + } + } + + + + /** + * 删除 + * + * @param id + * @return + */ + @DeleteMapping("/{id}") + @Transactional + public ActionResult delete(@PathVariable("id") String id){ + CustomerJGEntity entity= customerService.getInfo(id); + if(entity!=null){ + customerService.delete(entity); + + } + return ActionResult.success("删除成功"); + } + + + + + + + + + + + +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/entity/CustomerJGEntity.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/entity/CustomerJGEntity.java new file mode 100644 index 00000000..81389bf8 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/entity/CustomerJGEntity.java @@ -0,0 +1,100 @@ +package jnpf.customer.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_customer") +public class CustomerJGEntity { + + @TableId("ID") + private String id; + + @TableField("F_CREATORUSERID") + private String creatoruserid; + + @TableField("F_CREATORUSERNAME") + private String creatorusername; + + @TableField("F_CREATORTIME") + private Date creatortime; + + @TableField("F_LASTMODIFYUSERID") + private String lastmodifyuserid; + + @TableField("F_LASTMODIFYUSERNAME") + private String lastmodifyusername; + + @TableField("F_LASTMODIFYTIME") + private Date lastmodifytime; + + @TableField("F_DELETEUSERID") + private String deleteuserid; + + @TableField("F_DELETEUSERNAME") + private String deleteusername; + + @TableField("F_DELETETIME") + private Date deletetime; + + @TableField("F_DELETEMARK") + private String deletemark; + + @TableField("orgnize_id") + private String originId; + + @TableField("department_id") + private String deptId; + + @TableField("SUPPLIER_CD") + private String supplierCd; + + @TableField("SUPPLIER_NM") + private String supplierNm; + + @TableField("SUPPLIER_SITE_ID") + private String supplierSiteId; + + @TableField("SUPPLIER_SITE_CODE") + private String supplierSiteCode; + + @TableField("ORG_ID") + private String orgId; + + @TableField("ORG_NAME") + private String orgName; + + @TableField("VAT_REGISTRATION_NUM") + private String vatRegistrationNum; + + @TableField("CUSTOMER_LEVEL") + private String customerLevel; + + @TableField("CONTACT_NAME") + private String contactName; + + @TableField("CONTACT_PHONE") + private String contactPhone; + + @TableField("STATUS") + private String status; + + @TableField("ADDRESS") + private String address; + +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/mapper/CustomerJGMapper.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/mapper/CustomerJGMapper.java new file mode 100644 index 00000000..627e63d6 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/mapper/CustomerJGMapper.java @@ -0,0 +1,17 @@ +package jnpf.customer.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import jnpf.customer.entity.CustomerJGEntity; + +/** + * + * 客户档案 + * 版本: V3.2.0 + * 版权: LINKAGE-BOOT + * 作者: LINKAGE-BOOT研发团队 + * 日期: 2023-01-04 + */ +public interface CustomerJGMapper extends BaseMapper { + +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerCrForm.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerCrForm.java new file mode 100644 index 00000000..83db3708 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerCrForm.java @@ -0,0 +1,60 @@ + + +package jnpf.customer.model.customer; + +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 CustomerCrForm { + + /** 客户编码 **/ + @JsonProperty("supplierCd") + private String supplierCd; + + /** 客户名称 **/ + @JsonProperty("supplierNm") + private String supplierNm; + + /** 所属公司ID **/ + @JsonProperty("orgId") + private String orgId; + + /** 公司代码 **/ + @JsonProperty("orgName") + private String orgName; + + /** 客户等级 **/ + @JsonProperty("customerLevel") + private String customerLevel; + + /** 联系人 **/ + @JsonProperty("contactName") + private String contactName; + + /** 地址 **/ + @JsonProperty("address") + private String address; + + /** 电话 **/ + @JsonProperty("contactPhone") + private String contactPhone; + + /** 是否启用 **/ + @JsonProperty("status") + private String status; + + + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerInfoVO.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerInfoVO.java new file mode 100644 index 00000000..f8992f5f --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerInfoVO.java @@ -0,0 +1,62 @@ + + + +package jnpf.customer.model.customer; + +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 CustomerInfoVO{ + /** 主键 **/ + @JsonProperty("id") + private String id; + + /** 客户编码 **/ + @JsonProperty("supplierCd") + private String supplierCd; + + /** 客户名称 **/ + @JsonProperty("supplierNm") + private String supplierNm; + + /** 所属公司ID **/ + @JsonProperty("orgId") + private String orgId; + + /** 公司代码 **/ + @JsonProperty("orgName") + private String orgName; + + /** 客户等级 **/ + @JsonProperty("customerLevel") + private String customerLevel; + + /** 联系人 **/ + @JsonProperty("contactName") + private String contactName; + + /** 地址 **/ + @JsonProperty("address") + private String address; + + /** 电话 **/ + @JsonProperty("contactPhone") + private String contactPhone; + + /** 是否启用 **/ + @JsonProperty("status") + private String status; + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerListQuery.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerListQuery.java new file mode 100644 index 00000000..6d50e414 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerListQuery.java @@ -0,0 +1,27 @@ +package jnpf.customer.model.customer; + +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 CustomerListQuery extends Pagination { + + /** 客户编码 */ + private String supplierCd; + + /** 客户名称 */ + private String supplierNm; + /** + * 菜单id + */ + private String menuId; +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerListVO.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerListVO.java new file mode 100644 index 00000000..767e46fa --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerListVO.java @@ -0,0 +1,72 @@ + + +package jnpf.customer.model.customer; + + +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 CustomerListVO{ + + /** 主键 */ + private String id; + + + /** 客户编码 **/ + @JsonProperty("supplierCd") + private String supplierCd; + + + /** 客户名称 **/ + @JsonProperty("supplierNm") + private String supplierNm; + + + /** 所属公司ID **/ + @JsonProperty("orgId") + private String orgId; + + + /** 公司代码 **/ + @JsonProperty("orgName") + private String orgName; + + + /** 客户等级 **/ + @JsonProperty("customerLevel") + private String customerLevel; + + + /** 联系人 **/ + @JsonProperty("contactName") + private String contactName; + + + /** 地址 **/ + @JsonProperty("address") + private String address; + + + /** 电话 **/ + @JsonProperty("contactPhone") + private String contactPhone; + + + /** 是否启用 **/ + @JsonProperty("status") + private String status; + + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerPagination.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerPagination.java new file mode 100644 index 00000000..5a77daaf --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerPagination.java @@ -0,0 +1,28 @@ +package jnpf.customer.model.customer; + + +import lombok.Data; +import jnpf.base.Pagination; +import java.util.List; + +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class CustomerPagination extends Pagination { + + /** 客户编码 */ + private String supplierCd; + + /** 客户名称 */ + private String supplierNm; + /** + * 菜单id + */ + private String menuId; +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerPaginationExportModel.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerPaginationExportModel.java new file mode 100644 index 00000000..bf659776 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerPaginationExportModel.java @@ -0,0 +1,29 @@ +package jnpf.customer.model.customer; + +import lombok.Data; +import jnpf.base.Pagination; +import java.util.*; +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-01-04 + */ +@Data +public class CustomerPaginationExportModel extends Pagination { + + private String selectKey; + + private String json; + + private String dataType; + + + /** 客户编码 */ + private String supplierCd; + + /** 客户名称 */ + private String supplierNm; +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerUpForm.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerUpForm.java new file mode 100644 index 00000000..98fd08b5 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/model/customer/CustomerUpForm.java @@ -0,0 +1,71 @@ + + +package jnpf.customer.model.customer; + +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 CustomerUpForm{ + /** 主键 */ + private String id; + + + /** 客户编码 **/ + @JsonProperty("supplierCd") + private String supplierCd; + + + /** 客户名称 **/ + @JsonProperty("supplierNm") + private String supplierNm; + + + /** 所属公司ID **/ + @JsonProperty("orgId") + private String orgId; + + + /** 公司代码 **/ + @JsonProperty("orgName") + private String orgName; + + + /** 客户等级 **/ + @JsonProperty("customerLevel") + private String customerLevel; + + + /** 联系人 **/ + @JsonProperty("contactName") + private String contactName; + + + /** 地址 **/ + @JsonProperty("address") + private String address; + + + /** 电话 **/ + @JsonProperty("contactPhone") + private String contactPhone; + + + /** 是否启用 **/ + @JsonProperty("status") + private String status; + + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/CustomerJGService.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/CustomerJGService.java new file mode 100644 index 00000000..5a0408bd --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/CustomerJGService.java @@ -0,0 +1,35 @@ +package jnpf.customer.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import jnpf.customer.entity.CustomerJGEntity; +import jnpf.customer.model.customer.CustomerPagination; + +import java.util.*; +/** + * + * 客户档案 + * 版本: V3.2.0 + * 版权: LINKAGE-BOOT + * 作者: LINKAGE-BOOT研发团队 + * 日期: 2023-01-04 + */ +public interface CustomerJGService extends IService { + + List getList(CustomerPagination customerPagination); + + List getTypeList(CustomerPagination customerPagination, String dataType); + + + + CustomerJGEntity getInfo(String id); + + void delete(CustomerJGEntity entity); + + void create(CustomerJGEntity entity); + + boolean update(String id, CustomerJGEntity entity); + +// 子表方法 + + //列表子表数据方法 +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/impl/CustomerJGServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/impl/CustomerJGServiceImpl.java new file mode 100644 index 00000000..0ce1aa9c --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/impl/CustomerJGServiceImpl.java @@ -0,0 +1,232 @@ +package jnpf.customer.service.impl; + +import jnpf.customer.entity.*; +import jnpf.customer.mapper.CustomerJGMapper; +import jnpf.customer.service.*; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import jnpf.util.RandomUtil; +import java.math.BigDecimal; +import cn.hutool.core.util.ObjectUtil; +import jnpf.permission.model.authorize.AuthorizeConditionModel; + + +import jnpf.customer.model.customer.CustomerPagination; + +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 CustomerJGServiceImpl extends ServiceImpl implements CustomerJGService{ + + + @Autowired + private UserProvider userProvider; + + @Autowired + private AuthorizeService authorizeService; + + + + + + @Override + public List getList(CustomerPagination customerPagination){ + String userId=userProvider.get().getUserId(); + List AllIdList =new ArrayList(); + int total=0; + int customerNum =0; + QueryWrapper customerQueryWrapper=new QueryWrapper<>(); + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); + if (ObjectUtil.isEmpty(customerObj)){ + return new ArrayList<>(); + } else { + customerQueryWrapper = (QueryWrapper)customerObj; + customerNum++; + } + } + } + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); + if (ObjectUtil.isEmpty(customerObj)){ + return new ArrayList<>(); + } else { + customerQueryWrapper = (QueryWrapper)customerObj; + customerNum++; + } + + + } + } + if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){ + customerNum++; + customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierCd,customerPagination.getSupplierCd()); + } + + if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){ + customerNum++; + customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierNm,customerPagination.getSupplierNm()); + } + + if(AllIdList.size()>0){ + customerQueryWrapper.lambda().in(CustomerJGEntity::getId, AllIdList); + } + //排序 + if(StringUtil.isEmpty(customerPagination.getSidx())){ + customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd); + }else{ + try { + String sidx = customerPagination.getSidx(); + CustomerJGEntity customerEntity = new CustomerJGEntity(); + Field declaredField = customerEntity.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + customerQueryWrapper="asc".equals(customerPagination.getSort().toLowerCase())?customerQueryWrapper.orderByAsc(value):customerQueryWrapper.orderByDesc(value); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } + } + if((total>0 && AllIdList.size()>0) || total==0){ + Page page=new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize()); + IPage userIPage=this.page(page, customerQueryWrapper); + return customerPagination.setData(userIPage.getRecords(),userIPage.getTotal()); + }else{ + List list = new ArrayList(); + return customerPagination.setData(list, list.size()); + } + } + @Override + public List getTypeList(CustomerPagination customerPagination,String dataType){ + String userId=userProvider.get().getUserId(); + List AllIdList =new ArrayList(); + int total=0; + int customerNum =0; + QueryWrapper customerQueryWrapper=new QueryWrapper<>(); + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); + if (ObjectUtil.isEmpty(customerObj)){ + return new ArrayList<>(); + } else { + customerQueryWrapper = (QueryWrapper)customerObj; + customerNum++; + } + } + } + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); + if (ObjectUtil.isEmpty(customerObj)){ + return new ArrayList<>(); + } else { + customerQueryWrapper = (QueryWrapper)customerObj; + customerNum++; + } + + + } + } + if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){ + customerNum++; + customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierCd,customerPagination.getSupplierCd()); + } + + if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){ + customerNum++; + customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierNm,customerPagination.getSupplierNm()); + } + + if(AllIdList.size()>0){ + customerQueryWrapper.lambda().in(CustomerJGEntity::getId, AllIdList); + } + //排序 + if(StringUtil.isEmpty(customerPagination.getSidx())){ + customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd); + }else{ + try { + String sidx = customerPagination.getSidx(); + CustomerJGEntity customerEntity = new CustomerJGEntity(); + Field declaredField = customerEntity.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + customerQueryWrapper="asc".equals(customerPagination.getSort().toLowerCase())?customerQueryWrapper.orderByAsc(value):customerQueryWrapper.orderByDesc(value); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } + } + if("0".equals(dataType)){ + if((total>0 && AllIdList.size()>0) || total==0){ + Page page=new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize()); + IPage userIPage=this.page(page, customerQueryWrapper); + return customerPagination.setData(userIPage.getRecords(),userIPage.getTotal()); + }else{ + List list = new ArrayList(); + return customerPagination.setData(list, list.size()); + } + }else{ + return this.list(customerQueryWrapper); + } + } + + @Override + public CustomerJGEntity getInfo(String id){ + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.lambda().eq(CustomerJGEntity::getId,id); + return this.getOne(queryWrapper); + } + + @Override + public void create(CustomerJGEntity entity){ + this.save(entity); + } + + @Override + public boolean update(String id, CustomerJGEntity entity){ + entity.setId(id); + return this.updateById(entity); + } + @Override + public void delete(CustomerJGEntity entity){ + if(entity!=null){ + this.removeById(entity.getId()); + } + } + //子表方法 + + //列表子表数据方法 + + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/module_name_1/test.txt b/SC-boot/linkage-scm/src/main/java/jnpf/module_name_1/test.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/module_name_2/test.txt b/SC-boot/linkage-scm/src/main/java/jnpf/module_name_2/test.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/SC-boot/linkage-scm/src/main/resources/CustomerMapper.xml b/SC-boot/linkage-scm/src/main/resources/CustomerMapper.xml new file mode 100644 index 00000000..0af72e67 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/resources/CustomerMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/SC-web/src/views/scm/basicInformation/customer/Detail.vue b/SC-web/src/views/scm/basicInformation/customer/Detail.vue new file mode 100644 index 00000000..685cb90b --- /dev/null +++ b/SC-web/src/views/scm/basicInformation/customer/Detail.vue @@ -0,0 +1,132 @@ + + diff --git a/SC-web/src/views/scm/basicInformation/customer/ExportBox.vue b/SC-web/src/views/scm/basicInformation/customer/ExportBox.vue new file mode 100644 index 00000000..e61a2182 --- /dev/null +++ b/SC-web/src/views/scm/basicInformation/customer/ExportBox.vue @@ -0,0 +1,68 @@ + + + + \ No newline at end of file diff --git a/SC-web/src/views/scm/basicInformation/customer/Form.vue b/SC-web/src/views/scm/basicInformation/customer/Form.vue new file mode 100644 index 00000000..91f3a0d0 --- /dev/null +++ b/SC-web/src/views/scm/basicInformation/customer/Form.vue @@ -0,0 +1,241 @@ + + diff --git a/SC-web/src/views/scm/basicInformation/customer/index.vue b/SC-web/src/views/scm/basicInformation/customer/index.vue new file mode 100644 index 00000000..f98e9ef0 --- /dev/null +++ b/SC-web/src/views/scm/basicInformation/customer/index.vue @@ -0,0 +1,277 @@ + + + diff --git a/SC-web/src/views/scm/basicInformation/supplier/index.vue b/SC-web/src/views/scm/basicInformation/supplier/index.vue index 7e8c011b..c16db104 100644 --- a/SC-web/src/views/scm/basicInformation/supplier/index.vue +++ b/SC-web/src/views/scm/basicInformation/supplier/index.vue @@ -65,8 +65,18 @@ - + + + + + + +