Browse Source

完善代码

yuansh 2 months ago
parent
commit
a0189c6d05
41 changed files with 2384 additions and 29 deletions
  1. 287 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/controller/BaseApproverHeadController.java
  2. 269 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/controller/BaseApproverSetController.java
  3. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/controller/BaseProductClassController.java
  4. 14 1
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/controller/BaseShipArchiveRelateCustomerController.java
  5. 154 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseApproverDetails.java
  6. 76 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseApproverHead.java
  7. 70 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseApproverSet.java
  8. 92 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseApproverSetInfo.java
  9. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseProductClass.java
  10. 31 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/BaseApproverDetailsMapper.java
  11. 20 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/BaseApproverHeadMapper.java
  12. 31 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/BaseApproverSetInfoMapper.java
  13. 17 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/BaseApproverSetMapper.java
  14. 16 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/xml/BaseApproverDetailsMapper.xml
  15. 11 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/xml/BaseApproverHeadMapper.xml
  16. 16 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/xml/BaseApproverSetInfoMapper.xml
  17. 5 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/xml/BaseApproverSetMapper.xml
  18. 22 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/IBaseApproverDetailsService.java
  19. 71 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/IBaseApproverHeadService.java
  20. 22 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/IBaseApproverSetInfoService.java
  21. 48 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/IBaseApproverSetService.java
  22. 27 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/impl/BaseApproverDetailsServiceImpl.java
  23. 383 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/impl/BaseApproverHeadServiceImpl.java
  24. 27 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/impl/BaseApproverSetInfoServiceImpl.java
  25. 79 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/impl/BaseApproverSetServiceImpl.java
  26. 75 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/vo/BaseApproverHeadPage.java
  27. 69 0
      srm-module-code/src/main/java/org/jeecg/modules/baseCode/vo/BaseApproverSetPage.java
  28. 26 17
      srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurInquiryFormController.java
  29. 2 2
      srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurOrderController.java
  30. 6 2
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrder.java
  31. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderHis.java
  32. 1 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProduct.java
  33. 1 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProductHis.java
  34. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurPaymentRequestDetails.java
  35. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurInquiryFormProductMapper.xml
  36. 6 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/service/IPurOrderService.java
  37. 382 3
      srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurOrderServiceImpl.java
  38. 3 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurInquiryFormAlert.java
  39. 1 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderAlert.java
  40. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderHisPage.java
  41. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderPage.java

+ 287 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/controller/BaseApproverHeadController.java

@@ -0,0 +1,287 @@
+package org.jeecg.modules.baseCode.controller;
+
+import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.system.vo.LoginUser;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.query.QueryRuleEnum;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.baseCode.entity.BaseApproverDetails;
+import org.jeecg.modules.baseCode.entity.BaseApproverHead;
+import org.jeecg.modules.baseCode.vo.BaseApproverHeadPage;
+import org.jeecg.modules.baseCode.service.IBaseApproverHeadService;
+import org.jeecg.modules.baseCode.service.IBaseApproverDetailsService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+
+/**
+ * @Description: 审批信息-主表
+ * @Author: jeecg-boot
+ * @Date: 2025-01-17
+ * @Version: V1.0
+ */
+@Api(tags = "审批信息-主表")
+@RestController
+@RequestMapping("/baseCode/baseApproverHead")
+@Slf4j
+public class BaseApproverHeadController {
+    @Autowired
+    private IBaseApproverHeadService baseApproverHeadService;
+    @Autowired
+    private IBaseApproverDetailsService baseApproverDetailsService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param baseApproverHead
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "审批信息-主表-分页列表查询")
+    @ApiOperation(value = "审批信息-主表-分页列表查询", notes = "审批信息-主表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BaseApproverHead>> queryPageList(BaseApproverHead baseApproverHead,
+                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                         HttpServletRequest req) {
+        QueryWrapper<BaseApproverHead> queryWrapper = QueryGenerator.initQueryWrapper(baseApproverHead, req.getParameterMap());
+        Page<BaseApproverHead> page = new Page<BaseApproverHead>(pageNo, pageSize);
+        IPage<BaseApproverHead> pageList = baseApproverHeadService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param baseApproverHeadPage
+     * @return
+     */
+    @AutoLog(value = "审批信息-主表-添加")
+    @ApiOperation(value = "审批信息-主表-添加", notes = "审批信息-主表-添加")
+//    @RequiresPermissions("baseCode:base_approver_head:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody BaseApproverHeadPage baseApproverHeadPage) {
+        BaseApproverHead baseApproverHead = new BaseApproverHead();
+        BeanUtils.copyProperties(baseApproverHeadPage, baseApproverHead);
+        baseApproverHeadService.saveMain(baseApproverHead, baseApproverHeadPage.getBaseApproverDetailsList());
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param baseApproverHeadPage
+     * @return
+     */
+    @AutoLog(value = "审批信息-主表-编辑")
+    @ApiOperation(value = "审批信息-主表-编辑", notes = "审批信息-主表-编辑")
+    // @RequiresPermissions("baseCode:base_approver_head:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody BaseApproverHeadPage baseApproverHeadPage) {
+        BaseApproverHead baseApproverHead = new BaseApproverHead();
+        BeanUtils.copyProperties(baseApproverHeadPage, baseApproverHead);
+        BaseApproverHead baseApproverHeadEntity = baseApproverHeadService.getById(baseApproverHead.getId());
+        if (baseApproverHeadEntity == null) {
+            return Result.error("未找到对应数据");
+        }
+        baseApproverHeadService.updateMain(baseApproverHead, baseApproverHeadPage.getBaseApproverDetailsList());
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "审批信息-主表-通过id删除")
+    @ApiOperation(value = "审批信息-主表-通过id删除", notes = "审批信息-主表-通过id删除")
+    //@RequiresPermissions("baseCode:base_approver_head:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        baseApproverHeadService.delMain(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "审批信息-主表-批量删除")
+    @ApiOperation(value = "审批信息-主表-批量删除", notes = "审批信息-主表-批量删除")
+    // @RequiresPermissions("baseCode:base_approver_head:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.baseApproverHeadService.delBatchMain(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "审批信息-主表-通过id查询")
+    @ApiOperation(value = "审批信息-主表-通过id查询", notes = "审批信息-主表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BaseApproverHead> queryById(@RequestParam(name = "id", required = true) String id) {
+        BaseApproverHead baseApproverHead = baseApproverHeadService.getById(id);
+        if (baseApproverHead == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(baseApproverHead);
+
+    }
+
+    /**
+     * @param id          订单主键
+     * @param approveInfo 审批信息
+     * @param approveType 审批状态(1-审批通过,-1 驳回)
+     * @return
+     */
+    @ApiOperation(value = "审批信息-审批", notes = "审批信息-审批")
+    @GetMapping(value = "/actionApprove")
+    public Result<String> actionApprove(@RequestParam(name = "id", required = true) String id,
+                                        String approveInfo,
+                                        @RequestParam(name = "approveType", required = true) int approveType) {
+
+        String returnResult = baseApproverHeadService.actionApprove(id, approveInfo, approveType);
+
+        return Result.OK(returnResult);
+
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "审批信息-明细通过主表ID查询")
+    @ApiOperation(value = "审批信息-明细主表ID查询", notes = "审批信息-明细-通主表ID查询")
+    @GetMapping(value = "/queryBaseApproverDetailsByMainId")
+    public Result<List<BaseApproverDetails>> queryBaseApproverDetailsListByMainId(@RequestParam(name = "id", required = true) String id) {
+        List<BaseApproverDetails> baseApproverDetailsList = baseApproverDetailsService.selectByMainId(id);
+        return Result.OK(baseApproverDetailsList);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param baseApproverHead
+     */
+    // @RequiresPermissions("baseCode:base_approver_head:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, BaseApproverHead baseApproverHead) {
+        // Step.1 组装查询条件查询数据
+        QueryWrapper<BaseApproverHead> queryWrapper = QueryGenerator.initQueryWrapper(baseApproverHead, request.getParameterMap());
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        //配置选中数据查询条件
+        String selections = request.getParameter("selections");
+        if (oConvertUtils.isNotEmpty(selections)) {
+            List<String> selectionList = Arrays.asList(selections.split(","));
+            queryWrapper.in("id", selectionList);
+        }
+        //Step.2 获取导出数据
+        List<BaseApproverHead> baseApproverHeadList = baseApproverHeadService.list(queryWrapper);
+
+        // Step.3 组装pageList
+        List<BaseApproverHeadPage> pageList = new ArrayList<BaseApproverHeadPage>();
+        for (BaseApproverHead main : baseApproverHeadList) {
+            BaseApproverHeadPage vo = new BaseApproverHeadPage();
+            BeanUtils.copyProperties(main, vo);
+            List<BaseApproverDetails> baseApproverDetailsList = baseApproverDetailsService.selectByMainId(main.getId());
+            vo.setBaseApproverDetailsList(baseApproverDetailsList);
+            pageList.add(vo);
+        }
+
+        // Step.4 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        mv.addObject(NormalExcelConstants.FILE_NAME, "审批信息-主表列表");
+        mv.addObject(NormalExcelConstants.CLASS, BaseApproverHeadPage.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("审批信息-主表数据", "导出人:" + sysUser.getRealname(), "审批信息-主表"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequiresPermissions("baseCode:base_approver_head:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            // 获取上传文件对象
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<BaseApproverHeadPage> list = ExcelImportUtil.importExcel(file.getInputStream(), BaseApproverHeadPage.class, params);
+                for (BaseApproverHeadPage page : list) {
+                    BaseApproverHead po = new BaseApproverHead();
+                    BeanUtils.copyProperties(page, po);
+                    baseApproverHeadService.saveMain(po, page.getBaseApproverDetailsList());
+                }
+                return Result.OK("文件导入成功!数据行数:" + list.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.OK("文件导入失败!");
+    }
+
+}

+ 269 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/controller/BaseApproverSetController.java

@@ -0,0 +1,269 @@
+package org.jeecg.modules.baseCode.controller;
+
+import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.system.vo.LoginUser;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.query.QueryRuleEnum;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.baseCode.entity.BaseApproverSetInfo;
+import org.jeecg.modules.baseCode.entity.BaseApproverSet;
+import org.jeecg.modules.baseCode.vo.BaseApproverSetPage;
+import org.jeecg.modules.baseCode.service.IBaseApproverSetService;
+import org.jeecg.modules.baseCode.service.IBaseApproverSetInfoService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+
+ /**
+ * @Description: 审批流程配置
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@Api(tags="审批流程配置")
+@RestController
+@RequestMapping("/baseCode/baseApproverSet")
+@Slf4j
+public class BaseApproverSetController {
+	@Autowired
+	private IBaseApproverSetService baseApproverSetService;
+	@Autowired
+	private IBaseApproverSetInfoService baseApproverSetInfoService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param baseApproverSet
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "审批流程表单配置分页列表查询")
+	@ApiOperation(value="审批流程表单配置分页列表查询", notes="审批流程表单配置分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BaseApproverSet>> queryPageList(BaseApproverSet baseApproverSet,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+        QueryWrapper<BaseApproverSet> queryWrapper = QueryGenerator.initQueryWrapper(baseApproverSet, req.getParameterMap());
+		Page<BaseApproverSet> page = new Page<BaseApproverSet>(pageNo, pageSize);
+		IPage<BaseApproverSet> pageList = baseApproverSetService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   添加
+	 *
+	 * @param baseApproverSetPage
+	 * @return
+	 */
+	@AutoLog(value = "审批流程表单配置添加")
+	@ApiOperation(value="审批流程表单配置添加", notes="审批流程表单配置添加")
+    @RequiresPermissions("baseCode:base_approver_set:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody BaseApproverSetPage baseApproverSetPage) {
+		BaseApproverSet baseApproverSet = new BaseApproverSet();
+		BeanUtils.copyProperties(baseApproverSetPage, baseApproverSet);
+		baseApproverSetService.saveMain(baseApproverSet, baseApproverSetPage.getBaseApproverSetInfoList());
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 *  编辑
+	 *
+	 * @param baseApproverSetPage
+	 * @return
+	 */
+	@AutoLog(value = "审批流程表单配置编辑")
+	@ApiOperation(value="审批流程表单配置编辑", notes="审批流程表单配置编辑")
+    @RequiresPermissions("baseCode:base_approver_set:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody BaseApproverSetPage baseApproverSetPage) {
+		BaseApproverSet baseApproverSet = new BaseApproverSet();
+		BeanUtils.copyProperties(baseApproverSetPage, baseApproverSet);
+		BaseApproverSet baseApproverSetEntity = baseApproverSetService.getById(baseApproverSet.getId());
+		if(baseApproverSetEntity==null) {
+			return Result.error("未找到对应数据");
+		}
+		baseApproverSetService.updateMain(baseApproverSet, baseApproverSetPage.getBaseApproverSetInfoList());
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "审批流程表单配置通过id删除")
+	@ApiOperation(value="审批流程表单配置通过id删除", notes="审批流程表单配置通过id删除")
+    @RequiresPermissions("baseCode:base_approver_set:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		baseApproverSetService.delMain(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "审批流程表单配置批量删除")
+	@ApiOperation(value="审批流程表单配置批量删除", notes="审批流程表单配置批量删除")
+    @RequiresPermissions("baseCode:base_approver_set:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.baseApproverSetService.delBatchMain(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "审批流程表单配置通过id查询")
+	@ApiOperation(value="审批流程表单配置通过id查询", notes="审批流程表单配置通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BaseApproverSet> queryById(@RequestParam(name="id",required=true) String id) {
+		BaseApproverSet baseApproverSet = baseApproverSetService.getById(id);
+		if(baseApproverSet==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(baseApproverSet);
+
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "审批流程表单配置通过主表ID查询")
+	@ApiOperation(value="审批流程表单配置主表ID查询", notes="审批流程表单配置-通主表ID查询")
+	@GetMapping(value = "/queryBaseApproverSetInfoByMainId")
+	public Result<List<BaseApproverSetInfo>> queryBaseApproverSetInfoListByMainId(@RequestParam(name="id",required=true) String id) {
+		List<BaseApproverSetInfo> baseApproverSetInfoList = baseApproverSetInfoService.selectByMainId(id);
+		return Result.OK(baseApproverSetInfoList);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param baseApproverSet
+    */
+    @RequiresPermissions("baseCode:base_approver_set:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, BaseApproverSet baseApproverSet) {
+      // Step.1 组装查询条件查询数据
+      QueryWrapper<BaseApproverSet> queryWrapper = QueryGenerator.initQueryWrapper(baseApproverSet, request.getParameterMap());
+      LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+      //配置选中数据查询条件
+      String selections = request.getParameter("selections");
+      if(oConvertUtils.isNotEmpty(selections)) {
+         List<String> selectionList = Arrays.asList(selections.split(","));
+         queryWrapper.in("id",selectionList);
+      }
+      //Step.2 获取导出数据
+      List<BaseApproverSet> baseApproverSetList = baseApproverSetService.list(queryWrapper);
+
+      // Step.3 组装pageList
+      List<BaseApproverSetPage> pageList = new ArrayList<BaseApproverSetPage>();
+      for (BaseApproverSet main : baseApproverSetList) {
+          BaseApproverSetPage vo = new BaseApproverSetPage();
+          BeanUtils.copyProperties(main, vo);
+          List<BaseApproverSetInfo> baseApproverSetInfoList = baseApproverSetInfoService.selectByMainId(main.getId());
+          vo.setBaseApproverSetInfoList(baseApproverSetInfoList);
+          pageList.add(vo);
+      }
+
+      // Step.4 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      mv.addObject(NormalExcelConstants.FILE_NAME, "base_approver_set列表");
+      mv.addObject(NormalExcelConstants.CLASS, BaseApproverSetPage.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("base_approver_set数据", "导出人:"+sysUser.getRealname(), "base_approver_set"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+    }
+
+    /**
+    * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    @RequiresPermissions("baseCode:base_approver_set:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          // 获取上传文件对象
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<BaseApproverSetPage> list = ExcelImportUtil.importExcel(file.getInputStream(), BaseApproverSetPage.class, params);
+              for (BaseApproverSetPage page : list) {
+                  BaseApproverSet po = new BaseApproverSet();
+                  BeanUtils.copyProperties(page, po);
+                  baseApproverSetService.saveMain(po, page.getBaseApproverSetInfoList());
+              }
+              return Result.OK("文件导入成功!数据行数:" + list.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.OK("文件导入失败!");
+    }
+
+}

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/controller/BaseProductClassController.java

@@ -60,6 +60,7 @@ public class BaseProductClassController extends JeecgController<BaseProductClass
                                                          HttpServletRequest req) {
         QueryWrapper<BaseProductClass> queryWrapper = QueryGenerator.initQueryWrapper(baseProductClass, req.getParameterMap());
         Page<BaseProductClass> page = new Page<BaseProductClass>(pageNo, pageSize);
+        queryWrapper.orderByAsc("sort_number");
         IPage<BaseProductClass> pageList = baseProductClassService.page(page, queryWrapper);
         return Result.OK(pageList);
     }
@@ -83,6 +84,7 @@ public class BaseProductClassController extends JeecgController<BaseProductClass
         QueryWrapper<BaseProductClass> queryWrapper = QueryGenerator.initQueryWrapper(baseProductClass, req.getParameterMap());
         Page<BaseProductClass> page = new Page<BaseProductClass>(pageNo, pageSize);
         queryWrapper.isNull("parent_id");
+        queryWrapper.orderByAsc("sort_number");
         IPage<BaseProductClass> pageList = baseProductClassService.page(page, queryWrapper);
         return Result.OK(pageList);
     }
@@ -244,6 +246,7 @@ public class BaseProductClassController extends JeecgController<BaseProductClass
         QueryWrapper<BaseProductClass> queryWrapper = new QueryWrapper();
         queryWrapper.eq("parent_id", id);
         queryWrapper.eq("del_flag", "0");
+        queryWrapper.orderByAsc("sort_number");
 
         List<BaseProductClass> list = baseProductClassService.list(queryWrapper);
 
@@ -262,6 +265,7 @@ public class BaseProductClassController extends JeecgController<BaseProductClass
         QueryWrapper<BaseProductClass> queryWrapper = new QueryWrapper();
         queryWrapper.eq("del_flag", "0");
 
+        queryWrapper.orderByAsc("sort_number");
         List<BaseProductClass> list = baseProductClassService.list(queryWrapper);
 
        // 构建树形结构

+ 14 - 1
srm-module-code/src/main/java/org/jeecg/modules/baseCode/controller/BaseShipArchiveRelateCustomerController.java

@@ -4,6 +4,7 @@ import java.util.Arrays;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.modules.baseCode.entity.BaseShipArchive;
 import org.jeecg.modules.baseCode.service.IBaseShipArchiveService;
 import org.jeecg.common.api.vo.Result;
@@ -17,6 +18,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 
 import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.modules.cuspCode.entity.CuspCustomerProfile;
+import org.jeecg.modules.cuspCode.service.ICuspCustomerProfileService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
@@ -39,6 +42,8 @@ public class BaseShipArchiveRelateCustomerController extends JeecgController<Bas
 	private IBaseShipArchiveRelateCustomerService baseShipArchiveRelateCustomerService;
 	 @Autowired
 	 private IBaseShipArchiveService baseShipArchiveService;
+	@Autowired
+	private ICuspCustomerProfileService cuspCustomerProfileService;
 	/**
 	 * 分页列表查询
 	 *
@@ -82,7 +87,15 @@ public class BaseShipArchiveRelateCustomerController extends JeecgController<Bas
 		baseShipArchiveRelateCustomerService.save(baseShipArchiveRelateCustomer);
 		BaseShipArchive ent = new BaseShipArchive();
 		ent.setId(baseShipArchiveRelateCustomer.getHeadId());
-		ent.setRelateCustomer(baseShipArchiveRelateCustomer.getCustomerId());
+		if(StringUtils.isNotBlank(baseShipArchiveRelateCustomer.getCustomerId())){
+			CuspCustomerProfile cuspCustomerProfile = cuspCustomerProfileService.getById(baseShipArchiveRelateCustomer.getCustomerId());
+			if(cuspCustomerProfile !=null){
+				ent.setRelateCustomer(cuspCustomerProfile.getName());
+			}else{
+
+				ent.setRelateCustomer(baseShipArchiveRelateCustomer.getCustomerId());
+			}
+		}
 		baseShipArchiveService.updateById(ent);
 		return Result.OK("添加成功!");
 	}

+ 154 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseApproverDetails.java

@@ -0,0 +1,154 @@
+package org.jeecg.modules.baseCode.entity;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import org.jeecg.common.constant.ProvinceCityArea;
+import org.jeecg.common.util.SpringContextUtils;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.UnsupportedEncodingException;
+
+/**
+ * @Description: 审批信息-明细
+ * @Author: jeecg-boot
+ * @Date: 2025-01-17
+ * @Version: V1.0
+ */
+@ApiModel(value = "base_approver_details对象", description = "审批信息-明细")
+@Data
+@TableName("base_approver_details")
+public class BaseApproverDetails implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键id")
+    private String id;
+    /**
+     * 主表主键
+     */
+    @ApiModelProperty(value = "主表主键")
+    private String headId;
+    /**
+     * 创建人
+     */
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 更新人
+     */
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+    /**
+     * 状态(1-启用,0-停用)
+     */
+    @Excel(name = "状态(1-启用,0-停用)", width = 15)
+    @ApiModelProperty(value = "状态(1-启用,0-停用)")
+    private Integer status;
+    /**
+     * 删除状态(0-正常,1-已删除)
+     */
+    @Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
+    @TableLogic
+    private Integer delFlag;
+    /**
+     * 订单主键
+     */
+    @Excel(name = "订单主键", width = 15)
+    @ApiModelProperty(value = "订单主键")
+    private String orderId;
+    /**
+     * 配置主键
+     */
+    @Excel(name = "配置主键", width = 15)
+    @ApiModelProperty(value = "配置主键")
+    private String baseId;
+    /**
+     * 审批人编码
+     */
+    @Excel(name = "审批人编码", width = 15)
+    @ApiModelProperty(value = "审批人编码")
+    private String approverId;
+    /**
+     * 审批人姓名
+     */
+    @Excel(name = "审批人姓名", width = 15)
+    @ApiModelProperty(value = "审批人姓名")
+    private String approverName;
+    /**
+     * 次序
+     */
+    @Excel(name = "次序", width = 15)
+    @ApiModelProperty(value = "次序")
+    private Integer indexNum;
+    /**
+     * 执行条件
+     */
+    @Excel(name = "执行条件", width = 15)
+    @ApiModelProperty(value = "执行条件")
+    private String execution;
+    /**
+     * 审批时间
+     */
+    @Excel(name = "审批时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "审批时间")
+    private Date approverTime;
+    /**
+     * 审批状态(1-审批通过,-1 驳回,0-未审批)
+     */
+    @Excel(name = "审批状态(1-审批通过,-1 驳回,0-未审批)", width = 15)
+    @ApiModelProperty(value = "审批状态(1-审批通过,-1 驳回,0-未审批)")
+    private Integer approverType;
+    /**
+     * 审批信息
+     */
+    @Excel(name = "审批信息", width = 15)
+    @ApiModelProperty(value = "审批信息")
+    private String approverInfo;
+    /**
+     * 是否即将审批(1-是,0-否)
+     */
+    @Excel(name = "是否即将审批(1-是,0-否)", width = 15)
+    @ApiModelProperty(value = "是否即将审批(1-是,0-否)")
+    private Integer isEnd;
+
+    //仅查看(1-是,0-否)
+    @ApiModelProperty(value = "仅查看(1-是,0-否)")
+    private Integer isView;
+    //审批说明
+    @ApiModelProperty(value = "审批说明")
+    private String notes;
+
+
+}

+ 76 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseApproverHead.java

@@ -0,0 +1,76 @@
+package org.jeecg.modules.baseCode.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import org.jeecg.common.constant.ProvinceCityArea;
+import org.jeecg.common.util.SpringContextUtils;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 审批信息-主表
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@ApiModel(value="base_approver_head对象", description="审批信息-主表")
+@Data
+@TableName("base_approver_head")
+public class BaseApproverHead implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键id*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键id")
+    private String id;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+	/**删除状态(0-正常,1-已删除)*/
+	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
+    @TableLogic
+    private Integer delFlag;
+	/**审批状态(0-审批中,1-审批通过,-1 驳回)*/
+	@Excel(name = "审批状态(0-审批中,1-审批通过,-1 驳回)", width = 15)
+    @ApiModelProperty(value = "审批状态(0-审批中,1-审批通过,-1 驳回)")
+    private Integer status;
+	/**订单主键*/
+	@Excel(name = "订单主键", width = 15)
+    @ApiModelProperty(value = "订单主键")
+    private String orderId;
+	/**配置主键*/
+	@Excel(name = "配置主键", width = 15)
+    @ApiModelProperty(value = "配置主键")
+    private String baseId;
+
+	//单据类型
+    @ApiModelProperty(value = "单据类型")
+    private String orderType;
+    //单据号
+    @ApiModelProperty(value = "单据号")
+    private String orderCode;
+}

+ 70 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseApproverSet.java

@@ -0,0 +1,70 @@
+package org.jeecg.modules.baseCode.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import org.jeecg.common.constant.ProvinceCityArea;
+import org.jeecg.common.util.SpringContextUtils;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: base_approver_set
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@ApiModel(value="base_approver_set对象", description="base_approver_set")
+@Data
+@TableName("base_approver_set")
+public class BaseApproverSet implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键id*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键id")
+    private String id;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+	/**状态(1-启用,0-停用)*/
+	@Excel(name = "状态(1-启用,0-停用)", width = 15)
+    @ApiModelProperty(value = "状态(1-启用,0-停用)")
+    @Dict(dicCode = "yes_or_no")
+    private Integer status;
+	/**删除状态(0-正常,1-已删除)*/
+	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
+    @TableLogic
+    private Integer delFlag;
+	/**表单全称*/
+	@Excel(name = "表单全称", width = 15)
+    @ApiModelProperty(value = "表单全称")
+    private String tableId;
+	/**名称*/
+	@Excel(name = "名称", width = 15)
+    @ApiModelProperty(value = "名称")
+    private String tableName;
+}

+ 92 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseApproverSetInfo.java

@@ -0,0 +1,92 @@
+package org.jeecg.modules.baseCode.entity;
+
+import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import org.jeecg.common.constant.ProvinceCityArea;
+import org.jeecg.common.util.SpringContextUtils;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import java.util.Date;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * @Description: base_approver_set_info
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@ApiModel(value="base_approver_set_info对象", description="base_approver_set_info")
+@Data
+@TableName("base_approver_set_info")
+public class BaseApproverSetInfo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键id*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键id")
+    private String id;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+	/**状态(1-启用,0-停用)*/
+	@Excel(name = "状态(1-启用,0-停用)", width = 15)
+    @ApiModelProperty(value = "状态(1-启用,0-停用)")
+    private Integer status;
+	/**删除状态(0-正常,1-已删除)*/
+	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
+    @TableLogic
+    private Integer delFlag;
+	/**审批人编码*/
+	@Excel(name = "审批人编码", width = 15)
+    @ApiModelProperty(value = "审批人编码")
+    private String approverId;
+	/**审批人姓名*/
+	@Excel(name = "审批人姓名", width = 15)
+    @ApiModelProperty(value = "审批人姓名")
+    private String approverName;
+	/**次序*/
+	@Excel(name = "次序", width = 15)
+    @ApiModelProperty(value = "次序")
+    private Integer indexNum;
+	/**执行条件*/
+	@Excel(name = "执行条件", width = 15)
+    @ApiModelProperty(value = "执行条件")
+    private String execution;
+	/**主表主键*/
+    @ApiModelProperty(value = "主表主键")
+    private String headId;
+
+    /**
+     * 是否即将审批(1-是,0-否)
+     */
+    @Excel(name = "是否即将审批(1-是,0-否)", width = 15)
+    @ApiModelProperty(value = "是否即将审批(1-是,0-否)")
+    private Integer isEnd;
+    //仅查看(1-是,0-否)
+    @ApiModelProperty(value = "仅查看(1-是,0-否)")
+    private Integer isView;
+    //审批说明
+    @ApiModelProperty(value = "审批说明")
+    private String notes;
+}

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/entity/BaseProductClass.java

@@ -87,6 +87,10 @@ public class BaseProductClass implements Serializable {
     @ApiModelProperty(value = "税率")
     private Double taxRate;
 
+    @Excel(name = "排序", width = 15)
+    @ApiModelProperty(value = "排序")
+    private Double sortNumber;
+
 	@TableField(exist = false)
     private List<BaseProductClass> children = new ArrayList<>();
 }

+ 31 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/BaseApproverDetailsMapper.java

@@ -0,0 +1,31 @@
+package org.jeecg.modules.baseCode.mapper;
+
+import java.util.List;
+import org.jeecg.modules.baseCode.entity.BaseApproverDetails;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @Description: 审批信息-明细
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+public interface BaseApproverDetailsMapper extends BaseMapper<BaseApproverDetails> {
+
+	/**
+	 * 通过主表id删除子表数据
+	 *
+	 * @param mainId 主表id
+	 * @return boolean
+	 */
+	public boolean deleteByMainId(@Param("mainId") String mainId);
+
+  /**
+   * 通过主表id查询子表数据
+   *
+   * @param mainId 主表id
+   * @return List<BaseApproverDetails>
+   */
+	public List<BaseApproverDetails> selectByMainId(@Param("mainId") String mainId);
+}

+ 20 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/BaseApproverHeadMapper.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.baseCode.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.baseCode.entity.BaseApproverHead;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 审批信息-主表
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+public interface BaseApproverHeadMapper extends BaseMapper<BaseApproverHead> {
+
+    public void deleteHeadByOrderId(String orderId);
+
+    public void deleteChildByOrderId(String orderId);
+}

+ 31 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/BaseApproverSetInfoMapper.java

@@ -0,0 +1,31 @@
+package org.jeecg.modules.baseCode.mapper;
+
+import java.util.List;
+import org.jeecg.modules.baseCode.entity.BaseApproverSetInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @Description: base_approver_set_info
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+public interface BaseApproverSetInfoMapper extends BaseMapper<BaseApproverSetInfo> {
+
+	/**
+	 * 通过主表id删除子表数据
+	 *
+	 * @param mainId 主表id
+	 * @return boolean
+	 */
+	public boolean deleteByMainId(@Param("mainId") String mainId);
+
+  /**
+   * 通过主表id查询子表数据
+   *
+   * @param mainId 主表id
+   * @return List<BaseApproverSetInfo>
+   */
+	public List<BaseApproverSetInfo> selectByMainId(@Param("mainId") String mainId);
+}

+ 17 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/BaseApproverSetMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.baseCode.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.baseCode.entity.BaseApproverSet;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: base_approver_set
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+public interface BaseApproverSetMapper extends BaseMapper<BaseApproverSet> {
+
+}

+ 16 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/xml/BaseApproverDetailsMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.baseCode.mapper.BaseApproverDetailsMapper">
+
+	<delete id="deleteByMainId" parameterType="java.lang.String">
+		DELETE 
+		FROM  base_approver_details 
+		WHERE
+			 head_id = #{mainId} 	</delete>
+	
+	<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.baseCode.entity.BaseApproverDetails">
+		SELECT * 
+		FROM  base_approver_details
+		WHERE
+			 head_id = #{mainId} 	</select>
+</mapper>

+ 11 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/xml/BaseApproverHeadMapper.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.baseCode.mapper.BaseApproverHeadMapper">
+
+    <delete id="deleteHeadByOrderId">
+        update base_approver_head set del_flag = 1 where order_id=#{orderId}
+    </delete>
+    <delete id="deleteHeadByOrderId">
+        update base_approver_details set del_flag = 1 where order_id=#{orderId}
+    </delete>
+</mapper>

+ 16 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/xml/BaseApproverSetInfoMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.baseCode.mapper.BaseApproverSetInfoMapper">
+
+	<delete id="deleteByMainId" parameterType="java.lang.String">
+		DELETE 
+		FROM  base_approver_set_info 
+		WHERE
+			 head_id = #{mainId} 	</delete>
+	
+	<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.baseCode.entity.BaseApproverSetInfo">
+		SELECT * 
+		FROM  base_approver_set_info
+		WHERE
+			 head_id = #{mainId} 	</select>
+</mapper>

+ 5 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/mapper/xml/BaseApproverSetMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.baseCode.mapper.BaseApproverSetMapper">
+
+</mapper>

+ 22 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/IBaseApproverDetailsService.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.baseCode.service;
+
+import org.jeecg.modules.baseCode.entity.BaseApproverDetails;
+import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+
+/**
+ * @Description: 审批信息-明细
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+public interface IBaseApproverDetailsService extends IService<BaseApproverDetails> {
+
+	/**
+	 * 通过主表id查询子表数据
+	 *
+	 * @param mainId 主表id
+	 * @return List<BaseApproverDetails>
+	 */
+	public List<BaseApproverDetails> selectByMainId(String mainId);
+}

+ 71 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/IBaseApproverHeadService.java

@@ -0,0 +1,71 @@
+package org.jeecg.modules.baseCode.service;
+
+import org.jeecg.modules.baseCode.entity.BaseApproverDetails;
+import org.jeecg.modules.baseCode.entity.BaseApproverHead;
+import com.baomidou.mybatisplus.extension.service.IService;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @Description: 审批信息-主表
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+public interface IBaseApproverHeadService extends IService<BaseApproverHead> {
+
+	/**
+	 * 审批
+	 * @param orderId 订单主键
+	 * @param approveInfo 审批信息
+	 * @param approveType 审批状态(1-审批通过,-1 驳回)
+	 */
+	public String actionApprove(String orderId,String approveInfo,int approveType);
+
+	/**
+	 * 提交时调用 审批准备
+	 * @param tableId
+	 * @param orderType
+	 * @param orderCode
+	 */
+	public void submitApprove(String tableId,String orderType,String orderCode,String orderId);
+
+	/**
+	 * 取消提交
+	 * @param orderId
+	 * @return
+	 */
+	public String submitApproveReturn( String orderId);
+
+	/**
+	 * 添加一对多
+	 *
+	 * @param baseApproverHead
+	 * @param baseApproverDetailsList
+	 */
+	public void saveMain(BaseApproverHead baseApproverHead,List<BaseApproverDetails> baseApproverDetailsList) ;
+	
+	/**
+	 * 修改一对多
+	 *
+   * @param baseApproverHead
+   * @param baseApproverDetailsList
+	 */
+	public void updateMain(BaseApproverHead baseApproverHead,List<BaseApproverDetails> baseApproverDetailsList);
+	
+	/**
+	 * 删除一对多
+	 *
+	 * @param id
+	 */
+	public void delMain (String id);
+	
+	/**
+	 * 批量删除一对多
+	 *
+	 * @param idList
+	 */
+	public void delBatchMain (Collection<? extends Serializable> idList);
+	
+}

+ 22 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/IBaseApproverSetInfoService.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.baseCode.service;
+
+import org.jeecg.modules.baseCode.entity.BaseApproverSetInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+
+/**
+ * @Description: base_approver_set_info
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+public interface IBaseApproverSetInfoService extends IService<BaseApproverSetInfo> {
+
+	/**
+	 * 通过主表id查询子表数据
+	 *
+	 * @param mainId 主表id
+	 * @return List<BaseApproverSetInfo>
+	 */
+	public List<BaseApproverSetInfo> selectByMainId(String mainId);
+}

+ 48 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/IBaseApproverSetService.java

@@ -0,0 +1,48 @@
+package org.jeecg.modules.baseCode.service;
+
+import org.jeecg.modules.baseCode.entity.BaseApproverSetInfo;
+import org.jeecg.modules.baseCode.entity.BaseApproverSet;
+import com.baomidou.mybatisplus.extension.service.IService;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @Description: base_approver_set
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+public interface IBaseApproverSetService extends IService<BaseApproverSet> {
+
+	/**
+	 * 添加一对多
+	 *
+	 * @param baseApproverSet
+	 * @param baseApproverSetInfoList
+	 */
+	public void saveMain(BaseApproverSet baseApproverSet,List<BaseApproverSetInfo> baseApproverSetInfoList) ;
+	
+	/**
+	 * 修改一对多
+	 *
+   * @param baseApproverSet
+   * @param baseApproverSetInfoList
+	 */
+	public void updateMain(BaseApproverSet baseApproverSet,List<BaseApproverSetInfo> baseApproverSetInfoList);
+	
+	/**
+	 * 删除一对多
+	 *
+	 * @param id
+	 */
+	public void delMain (String id);
+	
+	/**
+	 * 批量删除一对多
+	 *
+	 * @param idList
+	 */
+	public void delBatchMain (Collection<? extends Serializable> idList);
+	
+}

+ 27 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/impl/BaseApproverDetailsServiceImpl.java

@@ -0,0 +1,27 @@
+package org.jeecg.modules.baseCode.service.impl;
+
+import org.jeecg.modules.baseCode.entity.BaseApproverDetails;
+import org.jeecg.modules.baseCode.mapper.BaseApproverDetailsMapper;
+import org.jeecg.modules.baseCode.service.IBaseApproverDetailsService;
+import org.springframework.stereotype.Service;
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @Description: 审批信息-明细
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@Service
+public class BaseApproverDetailsServiceImpl extends ServiceImpl<BaseApproverDetailsMapper, BaseApproverDetails> implements IBaseApproverDetailsService {
+	
+	@Autowired
+	private BaseApproverDetailsMapper baseApproverDetailsMapper;
+	
+	@Override
+	public List<BaseApproverDetails> selectByMainId(String mainId) {
+		return baseApproverDetailsMapper.selectByMainId(mainId);
+	}
+}

+ 383 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/impl/BaseApproverHeadServiceImpl.java

@@ -0,0 +1,383 @@
+package org.jeecg.modules.baseCode.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.baseCode.entity.BaseApproverHead;
+import org.jeecg.modules.baseCode.entity.BaseApproverDetails;
+import org.jeecg.modules.baseCode.entity.BaseApproverSet;
+import org.jeecg.modules.baseCode.entity.BaseApproverSetInfo;
+import org.jeecg.modules.baseCode.mapper.BaseApproverDetailsMapper;
+import org.jeecg.modules.baseCode.mapper.BaseApproverHeadMapper;
+import org.jeecg.modules.baseCode.mapper.BaseApproverSetInfoMapper;
+import org.jeecg.modules.baseCode.mapper.BaseApproverSetMapper;
+import org.jeecg.modules.baseCode.service.IBaseApproverHeadService;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * @Description: 审批信息-主表
+ * @Author: jeecg-boot
+ * @Date: 2025-01-17
+ * @Version: V1.0
+ */
+@Service
+public class BaseApproverHeadServiceImpl extends ServiceImpl<BaseApproverHeadMapper, BaseApproverHead> implements IBaseApproverHeadService {
+
+    @Autowired
+    private BaseApproverHeadMapper baseApproverHeadMapper;//审批信息-主表
+    @Autowired
+    private BaseApproverDetailsMapper baseApproverDetailsMapper;//审批信息-子表
+
+    @Autowired
+    private BaseApproverSetMapper baseApproverSetMapper;//设置-主表
+    @Autowired
+    private BaseApproverSetInfoMapper baseApproverSetInfoMapper;//设置-子表
+
+
+    /**
+     * 审批
+     *
+     * @param orderId     订单主键
+     * @param approveInfo 审批信息
+     * @param approveType 审批状态(1-审批通过,-1 驳回)
+     */
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String actionApprove(String orderId, String approveInfo, int approveType) {
+
+        QueryWrapper<BaseApproverHead> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("order_id", orderId);
+//		queryWrapper.eq("order_type", "");
+        queryWrapper.eq("status", 0);
+        queryWrapper.eq("del_flag", 0);
+        List<BaseApproverHead> head = baseApproverHeadMapper.selectList(queryWrapper);
+
+        if (head.size() == 0) {
+            throw new JeecgBootException("该单据无需审批");
+        }
+
+        List<BaseApproverDetails> list = baseApproverDetailsMapper.selectByMainId(head.get(0).getId());
+
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userName = sysUser.getUsername();
+
+        //1、校验审批权限
+        boolean isPermission = false;
+        String resultMsg = "该单据您无需审批!";
+        String approverDetailsId = "";
+        int nextIndex = 0;
+
+        for (BaseApproverDetails o : list) {
+
+            String approverId = o.getApproverId();
+            int isEnd = o.getIsEnd();//是否即将审批(1-是,0-否)
+            int isView = o.getIsView();//仅查看(1-是,0-否)
+            int approverType = o.getApproverType();//审批状态(1-审批通过,-1 驳回,0-未审批)
+
+            if (approverId.equals(userName)) {
+
+                if (approverType == 0) {
+                    if (isEnd == 0) {
+
+                        resultMsg = "其他用户还未审批,请稍后再试";
+//						throw new JeecgBootException("其他用户还未审批,请稍后再试");
+                        break;
+                    }
+                    if (isView == 1) {
+
+                        resultMsg = "该单据您无需审批,请知悉";
+//						throw new JeecgBootException("该单据您无需审批,请知悉");
+                        break;
+                    }
+                    if (isEnd == 1 || isView == 0) {
+
+                        nextIndex = o.getIndexNum();
+                        approverDetailsId = o.getId();
+                        isPermission = true;
+                        break;
+                    }
+
+                } else {
+                    resultMsg = "该单据您已审批,请稍后再试";
+                    continue;
+                }
+
+            }
+
+        }
+        if (!isPermission) {
+
+            throw new JeecgBootException(resultMsg);
+        }
+
+        //2、执行审批操作
+        BaseApproverDetails detail = new BaseApproverDetails();
+        detail.setId(approverDetailsId);
+        detail.setApproverTime(new Date());
+        detail.setApproverType(approveType);
+        detail.setApproverInfo(approveInfo);
+        baseApproverDetailsMapper.updateById(detail);
+
+        List<BaseApproverDetails> list2 = baseApproverDetailsMapper.selectByMainId(head.get(0).getId());
+        for (BaseApproverDetails o : list2) {
+
+            int isEnd = o.getIsEnd() == null ? 0 : o.getIsEnd();//是否即将审批(1-是,0-否)
+            int isView = o.getIsView() == null ? 0 : o.getIsView();//仅查看(1-是,0-否)
+            int approverType = o.getApproverType() == null ? 0 : o.getApproverType();//审批状态(1-审批通过,-1 驳回,0-未审批)
+            //如果后续当前次序还有未审批的数据,则结束
+            if (isEnd == 1 && isView == 0 && approverType == 0) {
+                return "true";
+            }
+
+        }
+
+        List<BaseApproverDetails> childListNext = findMinObjects(list2, nextIndex);
+        for (BaseApproverDetails o : childListNext) {
+            //是否即将审批(1-是,0-否)
+            o.setIsEnd(1);
+            baseApproverDetailsMapper.updateById(o);
+        }
+
+        return "true";
+    }
+
+    /**
+     * 取消提交时调用 审批准备
+     *
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String submitApproveReturn( String orderId) {
+
+        QueryWrapper<BaseApproverHead> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("order_id", orderId);
+//		queryWrapper.eq("order_type", "");
+        queryWrapper.eq("status", 1);
+        queryWrapper.eq("del_flag", 0);
+        List<BaseApproverHead> head = baseApproverHeadMapper.selectList(queryWrapper);
+
+        if(head.size() > 0){
+
+            return "该订单已审批结束,无法取消";
+
+        }else{
+            baseApproverHeadMapper.deleteHeadByOrderId(orderId);
+            baseApproverHeadMapper.deleteChildByOrderId(orderId);
+            return null;
+        }
+
+
+    }
+    /**
+     * 提交时调用 审批准备
+     *
+     * @param tableId
+     * @param orderType
+     * @param orderCode
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void submitApprove(String tableId, String orderType, String orderCode, String orderId) {
+
+        QueryWrapper<BaseApproverSet> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("table_id", tableId);
+        queryWrapper.eq("status", 1);
+        queryWrapper.eq("del_flag", 0);
+        List<BaseApproverSet> listSet = baseApproverSetMapper.selectList(queryWrapper);
+        if (listSet.size() == 0) {
+            return;
+        }
+        List<BaseApproverSetInfo> setInfos = baseApproverSetInfoMapper.selectByMainId(listSet.get(0).getId());
+        if (setInfos.size() == 0) {
+            return;
+        }
+
+        BaseApproverHead baseApproverHead = new BaseApproverHead();
+
+        baseApproverHead.setBaseId(listSet.get(0).getId());
+        baseApproverHead.setOrderId(orderId);
+        baseApproverHead.setOrderType(orderType);
+        baseApproverHead.setOrderCode(orderCode);
+
+        List<BaseApproverDetails> childList = new ArrayList<>();
+
+        //是否仅有查看,无需审批
+        boolean isView = false;
+
+        for (BaseApproverSetInfo o : setInfos) {
+
+            BaseApproverDetails child = new BaseApproverDetails();
+
+            child.setOrderId(orderId);
+            child.setBaseId(o.getId());
+            child.setApproverId(o.getApproverId());
+            child.setApproverName(o.getApproverName());
+            child.setIndexNum(o.getIndexNum());
+            child.setExecution(o.getExecution());
+            child.setApproverType(0);//审批状态(1-审批通过,-1 驳回,0-未审批)
+
+            //是否即将审批(1-是,0-否)
+//			child.setIsEnd();
+
+            //仅查看(1-是,0-否)
+            child.setIsView(o.getIsView());
+            if (o.getIsView() == 0) {
+                isView = true;
+            }
+
+            child.setNotes(o.getNotes());
+            childList.add(child);
+        }
+
+        if (isView) {
+            //如果不需要审批,直接通过
+            baseApproverHead.setStatus(1);//审批状态(0-审批中,1-审批通过,-1 驳回)
+        } else {
+            baseApproverHead.setStatus(0);//审批状态(0-审批中,1-审批通过,-1 驳回)
+        }
+
+        baseApproverHeadMapper.insert(baseApproverHead);
+
+        if (childList != null && childList.size() > 0) {
+
+            int nextIndex = 0;
+            List<BaseApproverDetails> childListNext = findMinObjects(childList, -1);
+            if (childListNext.size() > 0) {
+                nextIndex = childListNext.get(0).getIndexNum();
+            }
+            for (BaseApproverDetails entity : childList) {
+
+                //如果仅查看的 审批人次序靠前,则赋默认值,便于后期查看
+                int next = entity.getIndexNum();
+                if (nextIndex >= next) {
+                    //是否即将审批(1-是,0-否)
+                    entity.setIsEnd(1);
+                }
+
+                //外键设置
+                entity.setHeadId(baseApproverHead.getId());
+                baseApproverDetailsMapper.insert(entity);
+            }
+        }
+
+    }
+
+    public static void main(String[] args) {
+        List<BaseApproverDetails> childList = new ArrayList<>();
+
+
+        BaseApproverDetails child = new BaseApproverDetails();
+        child.setApproverName("2222");
+        child.setIndexNum(2);
+        child.setIsView(1);
+        childList.add(child);
+        BaseApproverDetails child2 = new BaseApproverDetails();
+        child2.setApproverName("3333");
+        child2.setIndexNum(3);
+        childList.add(child2);
+        BaseApproverDetails child3 = new BaseApproverDetails();
+        child3.setApproverName("4444");
+        child3.setIndexNum(3);
+        childList.add(child3);
+        BaseApproverDetails child5 = new BaseApproverDetails();
+        child5.setApproverName("5555");
+        child5.setIndexNum(5);
+        childList.add(child5);
+        BaseApproverDetails child6 = new BaseApproverDetails();
+        child6.setApproverName("6666");
+        child6.setIndexNum(2);
+        childList.add(child6);
+
+        System.out.println(findMinObjects(childList, -1));
+
+    }
+
+    public static List<BaseApproverDetails> findMinObjects(List<BaseApproverDetails> childList, int nextIndex) {
+        if (childList.size() == 0) {
+            return null;
+        }
+
+        int minCode = Integer.MAX_VALUE;
+        List<BaseApproverDetails> minObjects = new ArrayList<>();
+
+        for (BaseApproverDetails obj : childList) {
+            //次序
+            if (obj.getIndexNum() != null && obj.getIndexNum() <= nextIndex) {
+                continue;
+            }
+            //仅查看(1-是,0-否)
+            if (obj.getIsView() != null && obj.getIsView() == 1) {
+                continue;
+            }
+            //是否即将审批(1-是,0-否)
+            if (obj.getIsEnd() != null && obj.getIsEnd() == 1) {
+                continue;
+            }
+            if (obj.getIndexNum() < minCode) {
+                minCode = obj.getIndexNum();
+                minObjects.clear();
+                minObjects.add(obj);
+            } else if (obj.getIndexNum() == minCode) {
+                minObjects.add(obj);
+            }
+        }
+
+        return minObjects;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void saveMain(BaseApproverHead baseApproverHead, List<BaseApproverDetails> baseApproverDetailsList) {
+        baseApproverHeadMapper.insert(baseApproverHead);
+        if (baseApproverDetailsList != null && baseApproverDetailsList.size() > 0) {
+            for (BaseApproverDetails entity : baseApproverDetailsList) {
+                //外键设置
+                entity.setHeadId(baseApproverHead.getId());
+                baseApproverDetailsMapper.insert(entity);
+            }
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updateMain(BaseApproverHead baseApproverHead, List<BaseApproverDetails> baseApproverDetailsList) {
+        baseApproverHeadMapper.updateById(baseApproverHead);
+
+        //1.先删除子表数据
+        baseApproverDetailsMapper.deleteByMainId(baseApproverHead.getId());
+
+        //2.子表数据重新插入
+        if (baseApproverDetailsList != null && baseApproverDetailsList.size() > 0) {
+            for (BaseApproverDetails entity : baseApproverDetailsList) {
+                //外键设置
+                entity.setHeadId(baseApproverHead.getId());
+                baseApproverDetailsMapper.insert(entity);
+            }
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delMain(String id) {
+        baseApproverDetailsMapper.deleteByMainId(id);
+        baseApproverHeadMapper.deleteById(id);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delBatchMain(Collection<? extends Serializable> idList) {
+        for (Serializable id : idList) {
+            baseApproverDetailsMapper.deleteByMainId(id.toString());
+            baseApproverHeadMapper.deleteById(id);
+        }
+    }
+
+}

+ 27 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/impl/BaseApproverSetInfoServiceImpl.java

@@ -0,0 +1,27 @@
+package org.jeecg.modules.baseCode.service.impl;
+
+import org.jeecg.modules.baseCode.entity.BaseApproverSetInfo;
+import org.jeecg.modules.baseCode.mapper.BaseApproverSetInfoMapper;
+import org.jeecg.modules.baseCode.service.IBaseApproverSetInfoService;
+import org.springframework.stereotype.Service;
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @Description: base_approver_set_info
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@Service
+public class BaseApproverSetInfoServiceImpl extends ServiceImpl<BaseApproverSetInfoMapper, BaseApproverSetInfo> implements IBaseApproverSetInfoService {
+	
+	@Autowired
+	private BaseApproverSetInfoMapper baseApproverSetInfoMapper;
+	
+	@Override
+	public List<BaseApproverSetInfo> selectByMainId(String mainId) {
+		return baseApproverSetInfoMapper.selectByMainId(mainId);
+	}
+}

+ 79 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/service/impl/BaseApproverSetServiceImpl.java

@@ -0,0 +1,79 @@
+package org.jeecg.modules.baseCode.service.impl;
+
+import org.jeecg.modules.baseCode.entity.BaseApproverSet;
+import org.jeecg.modules.baseCode.entity.BaseApproverSetInfo;
+import org.jeecg.modules.baseCode.mapper.BaseApproverSetInfoMapper;
+import org.jeecg.modules.baseCode.mapper.BaseApproverSetMapper;
+import org.jeecg.modules.baseCode.service.IBaseApproverSetService;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Collection;
+
+/**
+ * @Description: base_approver_set
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@Service
+public class BaseApproverSetServiceImpl extends ServiceImpl<BaseApproverSetMapper, BaseApproverSet> implements IBaseApproverSetService {
+
+	@Autowired
+	private BaseApproverSetMapper baseApproverSetMapper;
+	@Autowired
+	private BaseApproverSetInfoMapper baseApproverSetInfoMapper;
+	
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void saveMain(BaseApproverSet baseApproverSet, List<BaseApproverSetInfo> baseApproverSetInfoList) {
+		baseApproverSetMapper.insert(baseApproverSet);
+		if(baseApproverSetInfoList!=null && baseApproverSetInfoList.size()>0) {
+			for(BaseApproverSetInfo entity:baseApproverSetInfoList) {
+				//外键设置
+				entity.setId(null);
+				entity.setHeadId(baseApproverSet.getId());
+				baseApproverSetInfoMapper.insert(entity);
+			}
+		}
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateMain(BaseApproverSet baseApproverSet,List<BaseApproverSetInfo> baseApproverSetInfoList) {
+		baseApproverSetMapper.updateById(baseApproverSet);
+		
+		//1.先删除子表数据
+		baseApproverSetInfoMapper.deleteByMainId(baseApproverSet.getId());
+		
+		//2.子表数据重新插入
+		if(baseApproverSetInfoList!=null && baseApproverSetInfoList.size()>0) {
+			for(BaseApproverSetInfo entity:baseApproverSetInfoList) {
+				//外键设置
+				entity.setId(null);
+				entity.setHeadId(baseApproverSet.getId());
+				baseApproverSetInfoMapper.insert(entity);
+			}
+		}
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void delMain(String id) {
+		baseApproverSetInfoMapper.deleteByMainId(id);
+		baseApproverSetMapper.deleteById(id);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void delBatchMain(Collection<? extends Serializable> idList) {
+		for(Serializable id:idList) {
+			baseApproverSetInfoMapper.deleteByMainId(id.toString());
+			baseApproverSetMapper.deleteById(id);
+		}
+	}
+	
+}

+ 75 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/vo/BaseApproverHeadPage.java

@@ -0,0 +1,75 @@
+package org.jeecg.modules.baseCode.vo;
+
+import java.util.List;
+import org.jeecg.modules.baseCode.entity.BaseApproverHead;
+import org.jeecg.modules.baseCode.entity.BaseApproverDetails;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecgframework.poi.excel.annotation.ExcelEntity;
+import org.jeecgframework.poi.excel.annotation.ExcelCollection;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.util.Date;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecg.common.constant.ProvinceCityArea;
+import org.jeecg.common.util.SpringContextUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 审批信息-主表
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@Data
+@ApiModel(value="base_approver_headPage对象", description="审批信息-主表")
+public class BaseApproverHeadPage {
+
+	/**主键id*/
+	@ApiModelProperty(value = "主键id")
+    private String id;
+	/**创建人*/
+	@ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	@ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**更新人*/
+	@ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	@ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+	/**删除状态(0-正常,1-已删除)*/
+	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
+	@ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
+    private Integer delFlag;
+	/**审批状态(0-审批中,1-审批通过,-1 驳回)*/
+	@Excel(name = "审批状态(0-审批中,1-审批通过,-1 驳回)", width = 15)
+	@ApiModelProperty(value = "审批状态(0-审批中,1-审批通过,-1 驳回)")
+    private Integer status;
+	/**订单主键*/
+	@Excel(name = "订单主键", width = 15)
+	@ApiModelProperty(value = "订单主键")
+    private String orderId;
+	/**配置主键*/
+	@Excel(name = "配置主键", width = 15)
+	@ApiModelProperty(value = "配置主键")
+    private String baseId;
+	//单据类型
+	@ApiModelProperty(value = "单据类型")
+	private String orderType;
+	//单据号
+	@ApiModelProperty(value = "单据号")
+	private String orderCode;
+
+	@ExcelCollection(name="审批信息-明细")
+	@ApiModelProperty(value = "审批信息-明细")
+	private List<BaseApproverDetails> baseApproverDetailsList;
+
+}

+ 69 - 0
srm-module-code/src/main/java/org/jeecg/modules/baseCode/vo/BaseApproverSetPage.java

@@ -0,0 +1,69 @@
+package org.jeecg.modules.baseCode.vo;
+
+import java.util.List;
+import org.jeecg.modules.baseCode.entity.BaseApproverSet;
+import org.jeecg.modules.baseCode.entity.BaseApproverSetInfo;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecgframework.poi.excel.annotation.ExcelEntity;
+import org.jeecgframework.poi.excel.annotation.ExcelCollection;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.util.Date;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecg.common.constant.ProvinceCityArea;
+import org.jeecg.common.util.SpringContextUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: base_approver_set
+ * @Author: jeecg-boot
+ * @Date:   2025-01-17
+ * @Version: V1.0
+ */
+@Data
+@ApiModel(value="base_approver_setPage对象", description="base_approver_set")
+public class BaseApproverSetPage {
+
+	/**主键id*/
+	@ApiModelProperty(value = "主键id")
+    private String id;
+	/**创建人*/
+	@ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	@ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**更新人*/
+	@ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	@ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+	/**状态(1-启用,0-停用)*/
+	@Excel(name = "状态(1-启用,0-停用)", width = 15)
+	@ApiModelProperty(value = "状态(1-启用,0-停用)")
+    private Integer status;
+	/**删除状态(0-正常,1-已删除)*/
+	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
+	@ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
+    private Integer delFlag;
+	/**表单全称*/
+	@Excel(name = "表单全称", width = 15)
+	@ApiModelProperty(value = "表单全称")
+    private String tableId;
+	/**名称*/
+	@Excel(name = "名称", width = 15)
+	@ApiModelProperty(value = "名称")
+    private String tableName;
+
+	@ExcelCollection(name="base_approver_set_info")
+	@ApiModelProperty(value = "base_approver_set_info")
+	private List<BaseApproverSetInfo> baseApproverSetInfoList;
+
+}

+ 26 - 17
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurInquiryFormController.java

@@ -31,7 +31,8 @@ import org.jeecg.modules.baseCode.entity.*;
 import org.jeecg.modules.baseCode.service.*;
 import org.jeecg.modules.cuspCode.entity.CuspSupplierProfile;
 import org.jeecg.modules.cuspCode.service.ICuspSupplierProfileService;
-import org.jeecg.modules.purCode.service.IPurPurchaseQuotationProductService;
+import org.jeecg.modules.purCode.entity.*;
+import org.jeecg.modules.purCode.service.*;
 import org.jeecg.modules.purCode.vo.SupplierQuotationDetails;
 import org.jeecg.modules.saleCode.entity.SaleQuotationProduct;
 import org.jeecg.modules.saleCode.vo.SaleInquiryFormAlert;
@@ -50,13 +51,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.query.QueryRuleEnum;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.purCode.entity.PurInquiryFormShip;
-import org.jeecg.modules.purCode.entity.PurInquiryFormProduct;
-import org.jeecg.modules.purCode.entity.PurInquiryForm;
 import org.jeecg.modules.purCode.vo.PurInquiryFormPage;
-import org.jeecg.modules.purCode.service.IPurInquiryFormService;
-import org.jeecg.modules.purCode.service.IPurInquiryFormShipService;
-import org.jeecg.modules.purCode.service.IPurInquiryFormProductService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -111,6 +106,8 @@ public class PurInquiryFormController {
     @Autowired
     private IBaseProjectArchiveService baseProjectArchiveService;
     @Autowired
+    private IPurPurchaseQuotationService purPurchaseQuotationService;
+    @Autowired
     private ISysDictService sysDictService;
 
     @Value(value = "${jeecg.path.upload}")
@@ -278,23 +275,18 @@ public class PurInquiryFormController {
 
             }
 
-            Map<String,String> supplierMap = new HashMap<>();
             for (PurInquiryForm o : list) {
 
-                String supplier = o.getInquirySuppiler();
                 List<PurInquiryFormProduct> productList = purInquiryFormProductService.selectByMainId(o.getId());
 
                 for (PurInquiryFormProduct p : productList) {
-                    String proId = p.getProductId();
-
-                    String mapStr = supplierMap.get(proId);
 
-                    if (map.containsKey(proId) && !mapStr.equals(supplier)) {
+                    String sourceId = p.getSourceId();
+                    if (map.containsKey(sourceId)) {
                         continue;
                     }
-                    supplierMap.put(proId,supplier);
 
-                    map.put(proId, proId);
+                    map.put(sourceId, sourceId);
                     p.setHeadCode(o.getBillCode());
                     p.setHeadCodes(headCodes);
                     purInquiryFormProductList.add(p);
@@ -307,6 +299,7 @@ public class PurInquiryFormController {
             SupplierQuotationDetails saleInquiryForm = new SupplierQuotationDetails();
             saleInquiryForm.setQuotationProject(projectId);
             saleInquiryForm.setStatus(0);
+            saleInquiryForm.setSubmit("1");
 //
             QueryWrapper<SupplierQuotationDetails> querySupplierQuotationDetails = QueryGenerator.initQueryWrapper(saleInquiryForm, req.getParameterMap());
             Page<SupplierQuotationDetails> page2 = new Page<SupplierQuotationDetails>(-1, -1);
@@ -350,12 +343,16 @@ public class PurInquiryFormController {
             for (PurInquiryFormProduct a : purInquiryFormProductList) {
 
                 String productId = a.getProductId();
-                BigDecimal taxPriceUsd = a.getTaxPriceUsd();
+                String sourceId = a.getSourceId()==null || a.getSourceId()=="" ? "无" : a.getSourceId();//销售询价单子表主键
 
                 for (SupplierQuotationDetails o : pageList.getRecords()) {
 
+                    BigDecimal taxPriceUsd = a.getTaxPriceUsd();
+
                     String productIdo = o.getProductId();
-                    if (productId.equals(productIdo)) {
+                    String sourceId2 = o.getSourceId2()==null||o.getSourceId2()=="" ? "无" : o.getSourceId2();//销售询价单子表主键
+
+                    if (productId.equals(productIdo) && (sourceId.equals(sourceId2) || sourceId2.equals("无"))) {
 
                         BigDecimal getTaxPriceUsd = o.getTaxPriceUsd();
                         if (taxPriceUsd != null && taxPriceUsd.compareTo(getTaxPriceUsd) < 0) {
@@ -562,6 +559,18 @@ public class PurInquiryFormController {
                 sb.append("单号" + code).append("已取消提交,请勿再次取消提交;");
                 continue;
             }
+
+            QueryWrapper<PurPurchaseQuotation> purPurchaseQuotation = new QueryWrapper();
+            purPurchaseQuotation.eq("source_code", code);
+            purPurchaseQuotation.eq("del_flag", "0");
+
+            List<PurPurchaseQuotation> listPurPurchaseQuotation = purPurchaseQuotationService.list(purPurchaseQuotation);
+            if (listPurPurchaseQuotation.size() > 0) {
+                List<String> codeList = listPurPurchaseQuotation.stream().map(PurPurchaseQuotation::getBillCode).collect(Collectors.toList());
+                String codes = StringUtils.join(codeList.toArray(), ",");
+                sb.append("单号" + code).append("已被报价单使用,请勿取消提交" + codes + ";");
+                continue;
+            }
         }
 
         if (StringUtils.isNotBlank(sb.toString())) {

+ 2 - 2
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurOrderController.java

@@ -266,7 +266,7 @@ public class PurOrderController {
         int newV = Integer.valueOf(version) + 1;
 
         List<PurOrderShipHis> purOrderShipHisList = new ArrayList<>();
-        if (purOrderPage.getPurOrderShipList().size() > 0) {
+        if (purOrderPage.getPurOrderShipList() !=null && purOrderPage.getPurOrderShipList().size() > 0) {
             for (PurOrderShip o : purOrderPage.getPurOrderShipList()) {
                 PurOrderShipHis his = new PurOrderShipHis();
                 BeanUtils.copyProperties(o, his);
@@ -278,7 +278,7 @@ public class PurOrderController {
         }
 
         List<PurOrderProductHis> purOrderProductList = new ArrayList<>();
-        if (purOrderPage.getPurOrderProductList().size() > 0) {
+        if (purOrderPage.getPurOrderProductList() !=null && purOrderPage.getPurOrderProductList().size() > 0) {
 
             for (PurOrderProduct o : purOrderPage.getPurOrderProductList()) {
                 PurOrderProductHis his = new PurOrderProductHis();

+ 6 - 2
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrder.java

@@ -28,6 +28,10 @@ import io.swagger.annotations.ApiModelProperty;
 public class PurOrder implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    /**
+     * b2b 1是 0否 -1是且已删除
+     */
+    private Integer b2b;
 	/**主键id*/
 	@TableId(type = IdType.ASSIGN_ID)
     @ApiModelProperty(value = "主键id")
@@ -209,8 +213,8 @@ public class PurOrder implements Serializable {
     @ApiModelProperty(value = "来源")
     private String sourceCode;
 	/**来源2*/
-	@Excel(name = "来源2", width = 15)
-    @ApiModelProperty(value = "来源2")
+	@Excel(name = "来源2 销售订单单号", width = 15)
+    @ApiModelProperty(value = "来源2 销售订单单号")
     private String sourceCode2;
 
 	//订单总金额

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderHis.java

@@ -30,6 +30,10 @@ import io.swagger.annotations.ApiModelProperty;
 public class PurOrderHis implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    /**
+     * b2b 1是 0否 -1是且已删除
+     */
+    private Integer b2b;
 	/**历史主键*/
 	@Excel(name = "历史主键", width = 15)
     @ApiModelProperty(value = "历史主键")

+ 1 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProduct.java

@@ -131,7 +131,7 @@ public class PurOrderProduct implements Serializable {
     /**数量*/
     @Excel(name = "数量", width = 15)
     @ApiModelProperty(value = "数量")
-    private Double quantity;
+    private java.math.BigDecimal quantity;
     /**含税单价(tax price)*/
     @Excel(name = "含税单价(tax price)", width = 15)
     @ApiModelProperty(value = "含税单价(tax price)")

+ 1 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProductHis.java

@@ -133,7 +133,7 @@ public class PurOrderProductHis implements Serializable {
 	/**数量*/
 	@Excel(name = "数量", width = 15)
     @ApiModelProperty(value = "数量")
-    private Double quantity;
+    private java.math.BigDecimal quantity;
 	/**含税单价(tax price)*/
 	@Excel(name = "含税单价(tax price)", width = 15)
     @ApiModelProperty(value = "含税单价(tax price)")

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurPaymentRequestDetails.java

@@ -114,4 +114,6 @@ public class PurPaymentRequestDetails implements Serializable {
 	@Excel(name = "备注(notes)", width = 15)
     @ApiModelProperty(value = "备注(notes)")
     private String notes;
+    @ApiModelProperty(value = "来源主键")
+    private String sourceId;
 }

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurInquiryFormProductMapper.xml

@@ -40,6 +40,8 @@
 					  , b.need_ship
 					  , b.ship_inspection
 					  , b.notes
+					  , b.source_id sourceId2
+
 				 from pur_inquiry_form a
 						  left join pur_inquiry_form_product b on a.id = b.head_id
 

+ 6 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/service/IPurOrderService.java

@@ -4,6 +4,8 @@ import org.jeecg.modules.purCode.entity.PurOrderShip;
 import org.jeecg.modules.purCode.entity.PurOrderProduct;
 import org.jeecg.modules.purCode.entity.PurOrder;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.transaction.annotation.Transactional;
+
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.List;
@@ -47,5 +49,8 @@ public interface IPurOrderService extends IService<PurOrder> {
 	 * @param idList
 	 */
 	public void delBatchMain (Collection<? extends Serializable> idList);
-	
+
+	public void submitBatch(List<PurOrder> list);
+
+	public void returnSubmitBatch(List<PurOrder> list);
 }

+ 382 - 3
srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurOrderServiceImpl.java

@@ -1,5 +1,9 @@
 package org.jeecg.modules.purCode.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.purCode.entity.PurOrder;
 import org.jeecg.modules.purCode.entity.PurOrderShip;
 import org.jeecg.modules.purCode.entity.PurOrderProduct;
@@ -7,14 +11,19 @@ import org.jeecg.modules.purCode.mapper.PurOrderShipMapper;
 import org.jeecg.modules.purCode.mapper.PurOrderProductMapper;
 import org.jeecg.modules.purCode.mapper.PurOrderMapper;
 import org.jeecg.modules.purCode.service.IPurOrderService;
+import org.jeecg.modules.saleCode.entity.SaleOrder;
+import org.jeecg.modules.saleCode.entity.SaleOrderProduct;
+import org.jeecg.modules.saleCode.mapper.SaleOrderMapper;
+import org.jeecg.modules.saleCode.mapper.SaleOrderProductMapper;
+import org.jeecg.modules.saleCode.vo.SaleOrderPage;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import java.io.Serializable;
 import java.math.BigDecimal;
-import java.util.List;
-import java.util.Collection;
+import java.util.*;
 
 /**
  * @Description: 采购订单
@@ -31,7 +40,14 @@ public class PurOrderServiceImpl extends ServiceImpl<PurOrderMapper, PurOrder> i
 	private PurOrderShipMapper purOrderShipMapper;
 	@Autowired
 	private PurOrderProductMapper purOrderProductMapper;
-	
+	@Autowired
+	private SaleOrderProductMapper saleOrderProductMapper;
+	@Autowired
+	private SaleOrderMapper saleOrderMapper;
+	@Autowired
+	private ISerialPatternService serialPatternService;
+
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void saveMain(PurOrder purOrder, List<PurOrderShip> purOrderShipList,List<PurOrderProduct> purOrderProductList) {
@@ -61,6 +77,23 @@ public class PurOrderServiceImpl extends ServiceImpl<PurOrderMapper, PurOrder> i
 				entity.setId(null);
 				entity.setHeadId(purOrder.getId());
 				purOrderProductMapper.insert(entity);
+
+				String sourceId = entity.getSourceId();
+
+				if (StringUtils.isNotBlank(sourceId)) {
+
+					BigDecimal quantity = entity.getQuantity() == null ? BigDecimal.ZERO : entity.getQuantity();//采购数量
+
+					SaleOrderProduct arrival = saleOrderProductMapper.selectById(sourceId);
+					if (arrival != null) {
+						BigDecimal arrivalQuantity = arrival.getPurchaseQuantity() == null ? BigDecimal.ZERO : arrival.getPurchaseQuantity();//已采购数量
+
+						arrivalQuantity = arrivalQuantity.add(quantity);
+						arrival.setPurchaseQuantity(arrivalQuantity);
+						saleOrderProductMapper.updateById(arrival);
+					}
+				}
+
 			}
 		}
 	}
@@ -69,6 +102,38 @@ public class PurOrderServiceImpl extends ServiceImpl<PurOrderMapper, PurOrder> i
 	@Transactional(rollbackFor = Exception.class)
 	public void updateMain(PurOrder purOrder,List<PurOrderShip> purOrderShipList,List<PurOrderProduct> purOrderProductList) {
 
+		List<PurOrderProduct> detailsList = purOrderProductMapper.selectByMainId(purOrder.getId());
+		if (detailsList != null && detailsList.size() > 0) {
+
+			for(PurOrderProduct entity:detailsList) {
+
+				String sourceId = entity.getSourceId();
+				if (StringUtils.isNotBlank(sourceId)) {
+
+					BigDecimal quantity = entity.getQuantity() == null ? BigDecimal.ZERO : entity.getQuantity();//采购数量
+					SaleOrderProduct arrival = saleOrderProductMapper.selectById(sourceId);
+
+					if (arrival != null) {
+						BigDecimal arrivalQuantity = arrival.getPurchaseQuantity() == null ? BigDecimal.ZERO : arrival.getPurchaseQuantity();//已采购数量
+
+						arrivalQuantity = arrivalQuantity.subtract(quantity);
+
+						if (arrivalQuantity.compareTo(BigDecimal.ZERO) < 1) {
+							arrival.setPurchaseQuantity(BigDecimal.ZERO);
+						} else {
+
+							arrival.setPurchaseQuantity(arrivalQuantity);
+						}
+						saleOrderProductMapper.updateById(arrival);
+
+					}
+				}
+
+
+			}
+
+		}
+
 		BigDecimal totalAmount = BigDecimal.ZERO;
 		if(purOrderProductList!=null && purOrderProductList.size()>0) {
 			for(PurOrderProduct entity:purOrderProductList) {
@@ -99,10 +164,324 @@ public class PurOrderServiceImpl extends ServiceImpl<PurOrderMapper, PurOrder> i
 				entity.setId(null);
 				entity.setHeadId(purOrder.getId());
 				purOrderProductMapper.insert(entity);
+
+
+				String sourceId = entity.getSourceId();
+
+				if (StringUtils.isNotBlank(sourceId)) {
+
+					BigDecimal quantity = entity.getQuantity() == null ? BigDecimal.ZERO : entity.getQuantity();//采购数量
+
+					SaleOrderProduct arrival = saleOrderProductMapper.selectById(sourceId);
+					if (arrival != null) {
+						BigDecimal arrivalQuantity = arrival.getPurchaseQuantity() == null ? BigDecimal.ZERO : arrival.getPurchaseQuantity();//已采购数量
+
+						arrivalQuantity = arrivalQuantity.add(quantity);
+						arrival.setPurchaseQuantity(arrivalQuantity);
+						saleOrderProductMapper.updateById(arrival);
+					}
+				}
+
 			}
 		}
 	}
 
+	/**
+	 * 提交时执行B2B操作
+	 * @param list
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void submitBatch(List<PurOrder> list){
+
+		for(PurOrder o:list){
+
+			String id = o.getId();
+			//组织  上海/香港
+			String organize = o.getSysOrgCode();
+			String sourceCode2 = o.getSourceCode2();
+
+			if(StringUtils.isBlank(organize) || StringUtils.isBlank(sourceCode2)){
+				throw new RuntimeException(o.getBillCode()+"参数异常 organize、sourceCode");
+			}
+
+			QueryWrapper<SaleOrder> queryWrapper = new QueryWrapper<>();
+			queryWrapper.eq("bill_code", sourceCode2);
+			SaleOrder saleOrder = saleOrderMapper.selectOne(queryWrapper);
+			if(saleOrder == null || organize.equals(saleOrder.getOrganize())){
+				continue;
+			}
+
+			List<SaleOrderProduct> saleOrderProductsList = saleOrderProductMapper.selectByMainId(saleOrder.getId());
+			Map<String,SaleOrderProduct> saleOrderProductsListMap = new HashMap<>();
+			for(SaleOrderProduct listProduct:saleOrderProductsList){
+				String saleId = listProduct.getId();
+				saleOrderProductsListMap.put(listProduct.getId()+saleId, listProduct);
+			}
+
+			List<SaleOrderProduct> newSaleOrderProductsList = new ArrayList<>();
+
+			// 上海采购 香港销售
+			if(organize.equals("上海")){
+				BigDecimal headAmount = BigDecimal.ZERO;
+				List<PurOrderProduct> purOrderProductList = purOrderProductMapper.selectByMainId(id);
+
+				for(PurOrderProduct listProduct : purOrderProductList){
+
+					String sourceId = listProduct.getSourceId() == null || listProduct.getSourceId()=="" ? "否":listProduct.getSourceId();
+
+					//取上海采购订单的数量和香港销售订单的单价 组成新的上海销售订单
+					BigDecimal quantity = listProduct.getQuantity();
+
+					//生成上海销售
+					SaleOrderProduct saleOrderProduct;
+					if(saleOrderProductsListMap.containsKey(sourceId)){
+
+						saleOrderProduct = saleOrderProductsListMap.get(sourceId);
+
+						//取销售的单价
+						BigDecimal taxPrice = saleOrderProduct.getTaxPrice();
+						BigDecimal taxAmount = quantity.multiply(taxPrice);
+
+//						BigDecimal discount = saleOrderProduct.getDiscount() == null ? BigDecimal.ZERO:saleOrderProduct.getDiscount();
+//						BigDecimal discountUs = (new BigDecimal(100).subtract(discount).divide(new BigDecimal(100)));
+
+						saleOrderProduct.setQuantity(quantity);
+						saleOrderProduct.setTaxPrice(taxPrice);
+						saleOrderProduct.setSourceId(saleOrderProduct.getId());
+
+						saleOrderProduct.setDeliveryQuantity(BigDecimal.ZERO);
+						saleOrderProduct.setPurchaseQuantity(BigDecimal.ZERO);
+
+						saleOrderProduct.setDiscountedPrice(taxPrice);//折后单价
+						saleOrderProduct.setDiscountedAmount(taxAmount);//折后金额
+						saleOrderProduct.setTaxAmount(taxAmount);//含税金额
+						headAmount = headAmount.add(taxAmount);
+					}else{
+
+						BigDecimal taxPrice = listProduct.getTaxPrice();
+						BigDecimal taxAmount = quantity.multiply(taxPrice);
+
+						saleOrderProduct = new SaleOrderProduct();
+
+						BeanUtils.copyProperties(listProduct, saleOrderProduct);
+
+						saleOrderProduct.setDeliveryQuantity(BigDecimal.ZERO);
+						saleOrderProduct.setPurchaseQuantity(BigDecimal.ZERO);
+
+						saleOrderProduct.setSourceId(saleOrderProduct.getId());
+						saleOrderProduct.setDiscountedPrice(taxPrice);//折后单价
+						saleOrderProduct.setDiscountedAmount(taxAmount);//折后金额
+						headAmount = headAmount.add(taxAmount);
+					}
+					newSaleOrderProductsList.add(saleOrderProduct);
+
+				}
+
+				saleOrder.setOrganize("上海");
+				saleOrder.setId(UUID.randomUUID().toString());
+				saleOrder.setOrderMoney(headAmount);
+				saleOrder.setCreateBy(null);
+				saleOrder.setCreateTime(null);
+				saleOrder.setConfirmBy(null);
+				saleOrder.setConfirmTime(null);
+
+				saleOrder.setCustomer("上海哥宝海事管理有限公司");
+				saleOrder.setCustomerName("上海哥宝海事管理有限公司");
+
+				saleOrder.setSourceCode(o.getBillCode());
+
+				Result<String> result = serialPatternService.getNextSerial("sale_order", "bill_code");
+				if (!result.isSuccess()) {
+					throw new RuntimeException("编码销售获取失败");
+				}
+				saleOrder.setBillCode(result.getMessage());
+
+				saleOrder.setB2b(1);
+				o.setDelFlag(1);
+
+				saleOrderMapper.insert(saleOrder);
+				for(SaleOrderProduct a:newSaleOrderProductsList){
+					a.setId(null);
+					a.setCreateBy(null);
+					a.setCreateTime(null);
+					a.setHeadId(saleOrder.getId());
+					saleOrderProductMapper.insert(a);
+				}
+
+//				香港采购
+				o.setOrganize("香港");
+				o.setId(UUID.randomUUID().toString());
+				o.setCreateBy(null);
+				o.setCreateTime(null);
+				o.setConfirmBy(null);
+				o.setConfirmTime(null);
+				o.setSupplier("上海哥宝海事管理有限公司");
+				o.setSupplierName("上海哥宝海事管理有限公司");
+
+				o.setSourceCode(o.getBillCode());
+				o.setB2b(1);
+				o.setDelFlag(1);
+
+				Result<String> result2 = serialPatternService.getNextSerial("pur_order", "bill_code");
+				if (!result2.isSuccess()) {
+					throw new RuntimeException("编码采购获取失败");
+				}
+				saleOrder.setBillCode(result2.getMessage());
+				purOrderMapper.insert(o);
+
+				for(PurOrderProduct listProduct : purOrderProductList){
+					listProduct.setHeadId(o.getId());
+					listProduct.setSourceId(listProduct.getId());
+					listProduct.setId(null);
+					listProduct.setCreateBy(null);
+					listProduct.setCreateTime(null);
+					purOrderProductMapper.insert(listProduct);
+				}
+
+
+			}
+
+			// 香港采购 上海销售
+			if(organize.equals("香港")){
+
+
+				BigDecimal headAmount = BigDecimal.ZERO;
+				List<PurOrderProduct> purOrderProductList = purOrderProductMapper.selectByMainId(id);
+
+				for(PurOrderProduct listProduct : purOrderProductList){
+
+					String sourceId = listProduct.getSourceId() == null || listProduct.getSourceId()=="" ? "否":listProduct.getSourceId();
+
+					//取香港采购订单的数量 和香港采购订单的单价 组成新的香港销售订单
+					BigDecimal quantity = listProduct.getQuantity();
+					BigDecimal taxPrice = listProduct.getTaxPrice();
+
+					BigDecimal taxAmount = quantity.multiply(taxPrice);
+					//生成上海销售
+					SaleOrderProduct saleOrderProduct;
+					if(saleOrderProductsListMap.containsKey(sourceId)){
+
+						saleOrderProduct = saleOrderProductsListMap.get(sourceId);
+
+//						BigDecimal discount = saleOrderProduct.getDiscount() == null ? BigDecimal.ZERO:saleOrderProduct.getDiscount();
+//						BigDecimal discountUs = (new BigDecimal(100).subtract(discount).divide(new BigDecimal(100)));
+
+						saleOrderProduct.setQuantity(quantity);
+						saleOrderProduct.setTaxPrice(taxPrice);
+
+						saleOrderProduct.setDeliveryQuantity(BigDecimal.ZERO);
+						saleOrderProduct.setPurchaseQuantity(BigDecimal.ZERO);
+
+						saleOrderProduct.setDiscountedPrice(taxPrice);//折后单价
+						saleOrderProduct.setDiscountedAmount(taxAmount);//折后金额
+						saleOrderProduct.setTaxAmount(taxAmount);//含税金额
+
+					}else{
+
+						saleOrderProduct = new SaleOrderProduct();
+
+						BeanUtils.copyProperties(listProduct, saleOrderProduct);
+
+						saleOrderProduct.setDeliveryQuantity(BigDecimal.ZERO);
+						saleOrderProduct.setPurchaseQuantity(BigDecimal.ZERO);
+
+						saleOrderProduct.setDiscountedPrice(taxPrice);//折后单价
+						saleOrderProduct.setDiscountedAmount(taxAmount);//折后金额
+
+					}
+					saleOrderProduct.setSourceId(listProduct.getId());
+					newSaleOrderProductsList.add(saleOrderProduct);
+					headAmount = headAmount.add(taxAmount);
+
+
+				}
+
+				saleOrder.setSourceCode(o.getBillCode());
+				saleOrder.setOrganize("香港");
+				saleOrder.setId(UUID.randomUUID().toString());
+				saleOrder.setOrderMoney(headAmount);
+				saleOrder.setCreateBy(null);
+				saleOrder.setCreateTime(null);
+				saleOrder.setConfirmBy(null);
+				saleOrder.setConfirmTime(null);
+
+				saleOrder.setCustomer("上海哥宝海事管理有限公司");
+				saleOrder.setCustomerName("上海哥宝海事管理有限公司");
+
+				Result<String> result = serialPatternService.getNextSerial("sale_order", "bill_code");
+				if (!result.isSuccess()) {
+					throw new RuntimeException("编码获取失败");
+				}
+				saleOrder.setBillCode(result.getMessage());
+
+				saleOrder.setB2b(1);
+				saleOrder.setDelFlag(1);
+				saleOrderMapper.insert(saleOrder);
+				for(SaleOrderProduct a:newSaleOrderProductsList){
+					a.setId(null);
+					a.setCreateBy(null);
+					a.setCreateTime(null);
+					a.setHeadId(saleOrder.getId());
+					saleOrderProductMapper.insert(a);
+				}
+
+//					香港采购
+
+				o.setSourceCode(o.getId());
+				o.setOrganize("上海");
+				o.setId(UUID.randomUUID().toString());
+				o.setCreateBy(null);
+				o.setCreateTime(null);
+				o.setConfirmBy(null);
+				o.setConfirmTime(null);
+				o.setSupplier("上海哥宝海事管理有限公司");
+				o.setSupplierName("上海哥宝海事管理有限公司");
+
+				o.setB2b(1);
+				o.setDelFlag(1);
+
+				purOrderMapper.insert(o);
+
+				for(PurOrderProduct listProduct : purOrderProductList){
+					listProduct.setHeadId(o.getId());
+					listProduct.setSourceId(listProduct.getId());
+					listProduct.setId(null);
+					listProduct.setCreateBy(null);
+					listProduct.setCreateTime(null);
+					purOrderProductMapper.insert(listProduct);
+				}
+
+
+
+
+			}
+
+
+
+
+		}
+
+	}
+
+	public static void main(String[] args) {
+		BigDecimal discount = new BigDecimal("1");
+		BigDecimal discountUs = (new BigDecimal(100).subtract(discount).divide(new BigDecimal(100)));
+		System.out.println(discountUs);
+	}
+
+
+	/**
+	 * 取消提交时执行B2B操作
+	 * @param list
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void returnSubmitBatch(List<PurOrder> list){
+
+
+	}
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void delMain(String id) {

+ 3 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurInquiryFormAlert.java

@@ -211,4 +211,7 @@ public class PurInquiryFormAlert {
     @Excel(name = "备注", width = 15)
     @ApiModelProperty(value = "备注")
     private String notes;
+
+    @ApiModelProperty(value = "来源id(销售询价单-产品id)")
+    private String sourceId2;
 }

+ 1 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderAlert.java

@@ -278,7 +278,7 @@ public class PurOrderAlert implements Serializable {
     /**数量*/
     @Excel(name = "数量", width = 15)
     @ApiModelProperty(value = "数量")
-    private Double quantity;
+    private java.math.BigDecimal quantity;
     /**含税单价(tax price)*/
     @Excel(name = "含税单价(tax price)", width = 15)
     @ApiModelProperty(value = "含税单价(tax price)")

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderHisPage.java

@@ -28,6 +28,10 @@ import io.swagger.annotations.ApiModelProperty;
 @ApiModel(value="pur_order_hisPage对象", description="采购订单(历史)")
 public class PurOrderHisPage {
 
+	/**
+	 * b2b 1是 0否 -1是且已删除
+	 */
+	private Integer b2b;
 	//订单总金额
 	private BigDecimal totalAmount;
 	//订单总金额(已被付款申请参照金额)

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderPage.java

@@ -28,6 +28,10 @@ import io.swagger.annotations.ApiModelProperty;
 @ApiModel(value="pur_orderPage对象", description="采购订单")
 public class PurOrderPage {
 
+	/**
+	 * b2b 1是 0否 -1是且已删除
+	 */
+	private Integer b2b;
 	//订单总金额
 	private BigDecimal totalAmount;
 	//订单总金额(已被付款申请参照金额)