diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/flowable/FlowController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/flowable/FlowController.java index e572c71f..c922d510 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/flowable/FlowController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/flowable/FlowController.java @@ -4,8 +4,16 @@ package com.ruoyi.web.controller.flowable; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.sip.dto.ApproveConfigDto; +import com.ruoyi.sip.flowable.domain.BuApproveConfig; +import com.ruoyi.sip.flowable.service.IBuApproveConfigService; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.io.IOUtils; @@ -20,7 +28,9 @@ import org.flowable.engine.repository.Model; import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.repository.ProcessDefinitionQuery; import org.flowable.image.ProcessDiagramGenerator; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.system.domain.Process; @@ -30,7 +40,10 @@ import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import java.util.zip.ZipInputStream; /** @@ -49,11 +62,20 @@ public class FlowController { @Resource RepositoryService repositoryService; + @Autowired + private IBuApproveConfigService approveConfigService; + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysUserService userService; @Resource ProcessEngineConfiguration configuration; private String prefix = "flowable/manage"; + @Autowired + private SysUserMapper sysUserMapper; @GetMapping("") public String processList() @@ -145,14 +167,41 @@ public class FlowController { ServletOutputStream output = response.getOutputStream(); IOUtils.copy(is, output); } - @ApiOperation("查看工作流图片") + @ApiOperation("审批人配置") @RequestMapping(value = "/approveUser", method = RequestMethod.GET) public String approveUser(@RequestParam("pdid") String pdid, - HttpServletResponse response) throws Exception { + HttpServletResponse response, ModelMap modelMap) throws Exception { BpmnModel bpmnModel = repositoryService.getBpmnModel(pdid); + List processesList = bpmnModel.getProcesses(); + List buApproveConfigs = approveConfigService.listByProcess(processesList.get(0)); + modelMap.put("approveConfig",buApproveConfigs); + List sysRoles = roleService.selectRoleAll(); + modelMap.put("roles",sysRoles); // bpmnModel.getProcesses().get(0).findFlowElementsOfType(UserTask.class); return "flowable/manage/approveUser"; } + @GetMapping(value = "/selectPeople") + public String approveUser(@RequestParam(value = "user",required = false)String chooseUser, ModelMap modelMap) { + List sysUsers = Collections.emptyList(); + List userId = Collections.emptyList(); + if (StringUtils.isNotEmpty(chooseUser)) { + SysUser sysUser = new SysUser(); + userId = Arrays.stream(chooseUser.split(",")).map(Long::parseLong).collect(Collectors.toList()); + sysUser.setUserIdList(userId); + sysUsers = sysUserMapper.selectUserList(sysUser); + } + modelMap.put("chooseUserArr",sysUsers); + modelMap.put("chooseUserId",userId); + return "flowable/manage/selectPeople"; + } + @ApiOperation("审批人配置") + @PostMapping(value = "/approveUser") + @ResponseBody + public AjaxResult approveUser(ApproveConfigDto approveConfigDto) { + approveConfigService.saveBatch(approveConfigDto.getApproveConfigList()); + return AjaxResult.success(); + + } @ApiOperation("查看工作流定义") @RequestMapping(value = "/showProcessDefinition", method = RequestMethod.GET) diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 7300cbff..c7bfbbca 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -62,4 +62,10 @@ spring: merge-sql: true wall: config: - multi-statement-allow: true \ No newline at end of file + multi-statement-allow: true +unis: + order: + # 执行单截止时间 + endHour: 96 + mail: + enabled: false \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 756addb8..cf99ae7e 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -113,7 +113,7 @@ shiro: cipherKey: session: # Session超时时间,-1代表永不过期(默认30分钟) - expireTime: 30 + expireTime: 120 # 同步session到数据库的周期(默认1分钟) dbSyncPeriod: 1 # 相隔多久检查一次session的有效性,默认就是10分钟 @@ -154,4 +154,6 @@ process: unis: order: # 执行单截止时间 - endHour: 96 \ No newline at end of file + endHour: 96 + mail: + enabled: true \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/flowable/manage/approveUser.html b/ruoyi-admin/src/main/resources/templates/flowable/manage/approveUser.html index 8683ab3d..aa30f325 100644 --- a/ruoyi-admin/src/main/resources/templates/flowable/manage/approveUser.html +++ b/ruoyi-admin/src/main/resources/templates/flowable/manage/approveUser.html @@ -1,53 +1,99 @@ - + + +
-
-
- -
- + +
+
+
+ + + +
-
- -
- -
-
-
- -
- -
-
-
- -
- +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+ + +
+ + diff --git a/ruoyi-admin/src/main/resources/templates/flowable/manage/processList.html b/ruoyi-admin/src/main/resources/templates/flowable/manage/processList.html index 73cdbaa7..3167b658 100644 --- a/ruoyi-admin/src/main/resources/templates/flowable/manage/processList.html +++ b/ruoyi-admin/src/main/resources/templates/flowable/manage/processList.html @@ -95,7 +95,7 @@ }); } function approveUser(id){ - $.modal.open('上传部署文件', '/flow/manage/approveUser?pdid='+id, '800', '650'); + $.modal.open('审批人配置', '/flow/manage/approveUser?pdid='+id, '800', '650'); } diff --git a/ruoyi-admin/src/main/resources/templates/flowable/manage/selectPeople.html b/ruoyi-admin/src/main/resources/templates/flowable/manage/selectPeople.html new file mode 100644 index 00000000..bb91ac2b --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/flowable/manage/selectPeople.html @@ -0,0 +1,117 @@ + + + + + + + +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/layout/product-list.html b/ruoyi-admin/src/main/resources/templates/layout/product-list.html index e32a8a9e..85558ff3 100644 --- a/ruoyi-admin/src/main/resources/templates/layout/product-list.html +++ b/ruoyi-admin/src/main/resources/templates/layout/product-list.html @@ -105,6 +105,19 @@ + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/vendor/edit.html b/ruoyi-admin/src/main/resources/templates/system/vendor/edit.html new file mode 100644 index 00000000..475d3030 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/vendor/edit.html @@ -0,0 +1,94 @@ + + + + + + +
+
+ +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/vendor/vendor.html b/ruoyi-admin/src/main/resources/templates/system/vendor/vendor.html new file mode 100644 index 00000000..eb958456 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/vendor/vendor.html @@ -0,0 +1,154 @@ + + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/vendor/vendorQuery.html b/ruoyi-admin/src/main/resources/templates/system/vendor/vendorQuery.html new file mode 100644 index 00000000..84790977 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/vendor/vendorQuery.html @@ -0,0 +1,217 @@ + + + + + + + +
+
+
制造商查询
+ +
+
+
+ + +
+ + +
+
查询结果
+
制造商信息
+
+ + + + + + + + + + + + + + +
制造商编码制造商名称生产地址联系人联系邮箱联系电话合作状态
+
+ +
+ + + + + + + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java index c5699ad4..060d5aab 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java @@ -7,6 +7,7 @@ import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; +import org.springframework.core.io.Resource; import org.springframework.stereotype.Component; import com.ruoyi.common.utils.StringUtils; @@ -155,5 +156,13 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC { return applicationContext.getEnvironment().getRequiredProperty(key); } + public static String getProperty(String key, String defaultValue) + { + return applicationContext.getEnvironment().getProperty(key,defaultValue); + } + public static Resource getResource(String path) + { + return applicationContext.getResource(path); + } } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProductInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProductInfoController.java index ccef330d..a54eb0b6 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProductInfoController.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProductInfoController.java @@ -3,6 +3,8 @@ package com.ruoyi.sip.controller; import java.util.List; import com.ruoyi.sip.domain.MaintenanceRecordsDto; +import com.ruoyi.sip.domain.VendorInfo; +import com.ruoyi.sip.service.IVendorInfoService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -36,6 +38,8 @@ public class ProductInfoController extends BaseController @Autowired private IProductInfoService productInfoService; + @Autowired + private IVendorInfoService vendorInfoService; @RequiresPermissions("system:product:view") @GetMapping() public String product() @@ -75,8 +79,9 @@ public class ProductInfoController extends BaseController */ @RequiresPermissions("system:product:add") @GetMapping("/add") - public String add() + public String add(ModelMap modelMap) { + modelMap.put("vendorList", vendorInfoService.selectVendorInfoList(new VendorInfo())); return prefix + "/add"; } @@ -101,6 +106,7 @@ public class ProductInfoController extends BaseController { ProductInfo productInfo = productInfoService.selectProductInfoById(id); mmap.put("productInfo", productInfo); + mmap.put("vendorList", vendorInfoService.selectVendorInfoList(new VendorInfo())); return prefix + "/edit"; } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java index ec84bc65..3ff97b18 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java @@ -1,5 +1,6 @@ package com.ruoyi.sip.controller; +import java.math.BigDecimal; import java.util.Collections; import java.util.List; @@ -11,11 +12,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.sip.domain.ProjectInfo; diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java index 02dac5ee..58838c31 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java @@ -6,7 +6,9 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import cn.hutool.core.collection.CollUtil; import com.ruoyi.common.config.RuoYiConfig; @@ -95,6 +97,20 @@ public class ProjectOrderInfoController extends BaseController mmap.put("todo", todoService.selectTodo(todo)); return prefix + "/approve"; } + @GetMapping("/h5/approve/{id}") + @ResponseBody + public AjaxResult approve(@PathVariable("id") Long id) { + Map result=new HashMap<>(); + ProjectOrderInfo projectOrderInfo = projectOrderInfoService.selectProjectOrderInfoById(id); + result.put("projectOrderInfo", projectOrderInfo); + result.put("user", ShiroUtils.getSysUser()); + Todo todo = new Todo(); + todo.setBusinessKey(projectOrderInfo.getOrderCode()); + result.put("approveLog", todoService.selectTodoCompletedList(todo)); + todo.setApproveUser(ShiroUtils.getUserId().toString()); + result.put("todo", todoService.selectTodo(todo)); + return AjaxResult.success(result); + } @PostMapping("/order/approve") @ResponseBody diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/VendorInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/VendorInfoController.java new file mode 100644 index 00000000..e8bc16fa --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/VendorInfoController.java @@ -0,0 +1,201 @@ +package com.ruoyi.sip.controller; + +import java.io.File; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.List; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.extra.qrcode.QrCodeUtil; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.sip.domain.VendorInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.sip.service.IVendorInfoService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * 制造商信息Controller + * + * @author ruoyi + * @date 2025-07-23 + */ +@Controller +@RequestMapping("/system/vendor") +@Slf4j +public class VendorInfoController extends BaseController +{ + private String prefix = "system/vendor"; + + @Autowired + private IVendorInfoService vendorInfoService; + + @RequiresPermissions("system:vendor:view") + @GetMapping() + public String vendor() + { + return prefix + "/vendor"; + } + @GetMapping("/query") + @Anonymous + public String partnerQuery(@RequestParam(value = "code",required = false)String code, ModelMap modelMap) + { + modelMap.put("code",code); + return prefix + "/vendorQuery"; + } + @GetMapping("/list/query") + @ResponseBody + @Anonymous + public AjaxResult listQuery(VendorInfo vendorInfo) + { + if (StringUtils.isEmpty(vendorInfo.getVendorCode())){ + return AjaxResult.success(Collections.emptyList()); + } + List list = vendorInfoService.selectVendorInfoList(vendorInfo); + for (VendorInfo info : list) { + info.setVendorStatusName(DictUtils.getDictLabel("vendor_status",info.getVendorStatus())); + } + return AjaxResult.success(list); + } + /** + * 查询制造商信息列表 + */ + @RequiresPermissions("system:vendor:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(VendorInfo vendorInfo) + { + startPage(); + List list = vendorInfoService.selectVendorInfoList(vendorInfo); + return getDataTable(list); + } + + /** + * 导出制造商信息列表 + */ + @RequiresPermissions("system:vendor:export") + @Log(title = "制造商信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(VendorInfo vendorInfo) + { + List list = vendorInfoService.selectVendorInfoList(vendorInfo); + ExcelUtil util = new ExcelUtil(VendorInfo.class); + return util.exportExcel(list, "制造商信息数据"); + } + + /** + * 新增制造商信息 + */ + @RequiresPermissions("system:vendor:add") + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存制造商信息 + */ + @RequiresPermissions("system:vendor:add") + @Log(title = "制造商信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(VendorInfo vendorInfo) + { + return toAjax(vendorInfoService.insertVendorInfo(vendorInfo)); + } + + /** + * 修改制造商信息 + */ + @RequiresPermissions("system:vendor:edit") + @GetMapping("/edit/{vendorId}") + public String edit(@PathVariable("vendorId") Long vendorId, ModelMap mmap) + { + VendorInfo vendorInfo = vendorInfoService.selectVendorInfoByVendorId(vendorId); + mmap.put("vendorInfo", vendorInfo); + mmap.put("update", true); + return prefix + "/edit"; + } + /** + * 修改制造商信息 + */ + + @GetMapping("/view/{vendorId}") + public String view(@PathVariable("vendorId") Long vendorId, ModelMap mmap) + { + VendorInfo vendorInfo = vendorInfoService.selectVendorInfoByVendorId(vendorId); + mmap.put("vendorInfo", vendorInfo); + mmap.put("update", false); + return prefix + "/edit"; + } + + /** + * 修改保存制造商信息 + */ + @RequiresPermissions("system:vendor:edit") + @Log(title = "制造商信息", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(VendorInfo vendorInfo) + { + return toAjax(vendorInfoService.updateVendorInfo(vendorInfo)); + } + + /** + * 删除制造商信息 + */ + @RequiresPermissions("system:vendor:remove") + @Log(title = "制造商信息", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(vendorInfoService.deleteVendorInfoByVendorIds(ids)); + } + + + @GetMapping("/qr/code") + public void download(@RequestParam("id") Long id, HttpServletRequest request, HttpServletResponse response) { + try { + VendorInfo + vendorInfo = vendorInfoService.selectVendorInfoByVendorId(id); + String localPath = RuoYiConfig.getProfile(); + String filePath = Paths.get(localPath, "vendor", vendorInfo.getVendorCode() + ".jpg").toString(); + log.info("Generating QR code at: {}", filePath); + File file = new File(filePath); + if (!file.getParentFile().exists()) { + // 自动创建目录结构 + file.getParentFile().mkdirs(); + } + StringBuilder url=new StringBuilder(); + url.append("http://oms.unissense.top") + .append("/system/vendor/query?code=") + .append(vendorInfo.getVendorCode()); + QrCodeUtil.generate(url.toString(), 300, 300, FileUtil.file(filePath)); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, vendorInfo.getVendorCode()+".jpg"); + FileUtils.writeBytes(filePath, response.getOutputStream()); + } catch (Exception e) { + log.error("下载文件失败", e); + } + } +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProductInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProductInfo.java index 8a15fd36..3929ad97 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProductInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProductInfo.java @@ -60,7 +60,8 @@ public class ProductInfo extends BaseEntity /** 删除时间 */ private Date deletedAt; private String serialNumber; - + private String vendorCode; + private String vendorName; @Getter public enum ProductTypeEnum { /** diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectInfo.java index d3f99359..b3f6533f 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectInfo.java @@ -64,6 +64,7 @@ public class ProjectInfo extends BaseEntity /** 客户code */ // @Excel(name = "客户code") private String customerCode; + private String customerAddress; /** 客户名称 */ @Excel(name = "最终客户") private String customerName; diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectOrderInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectOrderInfo.java index a48661e1..32babcb0 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectOrderInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectOrderInfo.java @@ -178,6 +178,10 @@ public class ProjectOrderInfo extends BaseEntity { */ // @Excel(name = "通知人电话") private String notifierPhone; + /** + * 通知人地址 + */ + private String notifierAddress; diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectProductInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectProductInfo.java index 6de55322..34be4334 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectProductInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectProductInfo.java @@ -65,6 +65,7 @@ public class ProjectProductInfo extends BaseEntity /** 总价 */ @Excel(name = "总价") private BigDecimal allPrice; + private BigDecimal allPriceDisCount; /** 指导折扣 */ // @Excel(name = "指导折扣") diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/VendorInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/VendorInfo.java new file mode 100644 index 00000000..b1e9cb50 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/VendorInfo.java @@ -0,0 +1,64 @@ +package com.ruoyi.sip.domain; + +import lombok.Data; +import lombok.Getter; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 制造商信息对象 varchar_info + * + * @author ruoyi + * @date 2025-07-23 + */ +@Data +public class VendorInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** */ + private Long vendorId; + + /** 制造商编码 */ + @Excel(name = "制造商编码") + private String vendorCode; + + /** 制造商名称 */ + @Excel(name = "制造商名称") + private String vendorName; + + /** 生产地址 */ + @Excel(name = "生产地址") + private String vendorAddress; + + /** 联系人 */ + @Excel(name = "联系人") + private String vendorUser; + + /** 联系邮箱 */ + @Excel(name = "联系邮箱") + private String vendorEmail; + + /** 联系电话 */ + @Excel(name = "联系电话") + private String vendorPhone; + + /** 合作状态 */ + @Excel(name = "合作状态") + private String vendorStatus; + private String vendorStatusName; + + @Getter + public enum VendorStatusEnum { + NORMAL("0", "正常合作"), + DISABLE("1", "暂停合作"), + ; + private final String value; + private final String code; + VendorStatusEnum(String value, String code) { + this.value = value; + this.code = code; + } + } + +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApproveConfigDto.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApproveConfigDto.java new file mode 100644 index 00000000..3b4b496c --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApproveConfigDto.java @@ -0,0 +1,25 @@ +package com.ruoyi.sip.dto; + + +import com.ruoyi.sip.flowable.domain.BuApproveConfig; +import lombok.Data; + +import java.util.List; + +/** + * @author : ch + * @version : 1.0 + * @ClassName : ApproveConfigDto + * @Description : + * @DATE : Created in 15:23 2025/7/24 + *
       Copyright: Copyright(c) 2025     
+ *
       Company :   	紫光汇智信息技术有限公司		           
+ * Modification History: + * Date Author Version Discription + * -------------------------------------------------------------------------- + * 2025/07/24 ch 1.0 Why & What is modified: <修改原因描述> * + */ +@Data +public class ApproveConfigDto { + private List approveConfigList; +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/domain/BuApproveConfig.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/domain/BuApproveConfig.java index d95a68f7..83cebc37 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/domain/BuApproveConfig.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/domain/BuApproveConfig.java @@ -1,9 +1,14 @@ package com.ruoyi.sip.flowable.domain; -import lombok.Data; +import com.ruoyi.common.utils.StringUtils; +import lombok.*; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; -import lombok.Getter; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; /** * 审批配置对象 bu_approve_config @@ -28,11 +33,29 @@ public class BuApproveConfig extends BaseEntity /** 审批人 */ @Excel(name = "审批人") private String approveUser; + private String approveUserName; + private List approveUserList; /** 审批角色 */ @Excel(name = "审批角色") private String approveRole; + private List approveRoleList; + + + public List getApproveRoleList() { + if (StringUtils.isEmpty(this.approveRole) ){ + return Collections.emptyList(); + } + return Arrays.stream(this.approveRole.split(",")).collect(Collectors.toList()); + } + + public List getApproveUserList() { + if (StringUtils.isEmpty(this.approveUser) ){ + return Collections.emptyList(); + } + return Arrays.stream(this.approveUser.split(",")).collect(Collectors.toList()); + } @Getter public enum APPROVE_KEY{ diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/listener/ProcessListener.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/listener/ProcessListener.java index 44ac9055..00d6c80f 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/listener/ProcessListener.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/listener/ProcessListener.java @@ -1,15 +1,18 @@ package com.ruoyi.sip.flowable.listener; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Snowflake; import com.alibaba.fastjson.JSON; import com.ruoyi.common.config.flow.Instance; import com.ruoyi.common.config.flow.ProcessConfig; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.sip.flowable.domain.Todo; +import com.ruoyi.sip.flowable.service.IBuApproveConfigService; import com.ruoyi.sip.flowable.service.TodoCommonTemplate; import com.ruoyi.sip.flowable.service.TodoService; import com.ruoyi.system.service.ISysUserService; @@ -19,21 +22,21 @@ import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent; import org.flowable.engine.RuntimeService; import org.flowable.engine.TaskService; import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener; +import org.flowable.engine.delegate.event.FlowableMultiInstanceActivityEvent; import org.flowable.engine.delegate.event.FlowableProcessStartedEvent; import org.flowable.engine.delegate.event.impl.FlowableEntityWithVariablesEventImpl; +import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.task.Comment; import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl; import org.flowable.variable.api.event.FlowableVariableEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -49,21 +52,40 @@ public class ProcessListener extends AbstractFlowableEngineEventListener { */ private static final Logger log = LoggerFactory.getLogger(ProcessListener.class); - private RuntimeService runtimeService; - private TaskService taskService; - private TodoService todoService; - private Snowflake snowflake = new Snowflake(12, 10); - private ISysUserService userService; - private ProcessConfig processConfig; + private final RuntimeService runtimeService; + private final TaskService taskService; + private final TodoService todoService; + private final Snowflake snowflake = new Snowflake(12, 10); + private final ISysUserService userService; + private final ProcessConfig processConfig; + private final IBuApproveConfigService approveConfigService; - public ProcessListener(RuntimeService runtimeService, TodoService todoService, ISysUserService userService, TaskService taskService, ProcessConfig processConfig) { + public ProcessListener(RuntimeService runtimeService, TodoService todoService, ISysUserService userService, TaskService taskService, ProcessConfig processConfig,IBuApproveConfigService approveConfigService) { this.runtimeService = runtimeService; this.todoService = todoService; this.userService = userService; this.taskService = taskService; this.processConfig = processConfig; this.runtimeService.addEventListener(this); + this.approveConfigService=approveConfigService; + } + + @Override + protected void multiInstanceActivityStarted(FlowableMultiInstanceActivityEvent event) { + if ("userTask".equals(event.getActivityType())){ + //用户任务动态设置审批人 + String processInstanceId = event.getProcessInstanceId(); + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); + + List approveUserList = approveConfigService.listByProcessKeyAndTaskName(processInstance.getProcessDefinitionKey(), event.getActivityName()); + if (CollUtil.isEmpty(approveUserList)) { + throw new ServiceException("审批人为空,无法提交审核"); + } + ((ExecutionEntityImpl) processInstance).setVariable("approveUserns",approveUserList); + } + + super.multiInstanceActivityStarted(event); } @Override @@ -95,25 +117,6 @@ public class ProcessListener extends AbstractFlowableEngineEventListener { log.info("全局监听:WorkFlowListener1-任务创建"); } - @Override - protected void variableCreated(FlowableVariableEvent event) { - log.info("全局监听:WorkFlowListener1-创建变量"); - } - - @Override - protected void processCreated(FlowableEngineEntityEvent event) { - log.info("全局监听:WorkFlowListener1-创建流程"); - } - - @Override - protected void processStarted(FlowableProcessStartedEvent event) { - log.info("全局监听:WorkFlowListener1-开始流程"); - } - - @Override - protected void taskAssigned(FlowableEngineEntityEvent event) { - log.info("全局监听:任务分配"); - } @SneakyThrows @Override diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/mapper/BuApproveConfigMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/mapper/BuApproveConfigMapper.java index 711b9494..d5de7eaf 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/mapper/BuApproveConfigMapper.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/mapper/BuApproveConfigMapper.java @@ -61,4 +61,6 @@ public interface BuApproveConfigMapper * @return 结果 */ public int deleteBuApproveConfigByProcessKeys(String[] processKeys); + + void saveBatch(List approveConfigList); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/mapper/TodoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/mapper/TodoMapper.java index 9920ed7b..77f0908f 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/mapper/TodoMapper.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/mapper/TodoMapper.java @@ -3,6 +3,7 @@ package com.ruoyi.sip.flowable.mapper; import com.ruoyi.sip.flowable.domain.Todo; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -76,5 +77,7 @@ public interface TodoMapper void deleteTodoByBusinessKey(String businessKey); + Todo selectLastApproveTodo(@Param("businessKey") String businessKey,@Param("taskName") String taskName); + // List listApprove(WorkOrderStatisticsRequestDto dto); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/IBuApproveConfigService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/IBuApproveConfigService.java index 566e8dbb..a50319d1 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/IBuApproveConfigService.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/IBuApproveConfigService.java @@ -1,6 +1,7 @@ package com.ruoyi.sip.flowable.service; import com.ruoyi.sip.flowable.domain.BuApproveConfig; +import org.flowable.bpmn.model.Process; import java.util.List; @@ -67,4 +68,8 @@ public interface IBuApproveConfigService * @return */ public List listByProcessKeyAndTaskName(String processKey,String taskName); + + List listByProcess(Process process); + + void saveBatch(List approveConfigList); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/TodoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/TodoService.java index cd0b661d..459be67d 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/TodoService.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/TodoService.java @@ -121,6 +121,8 @@ public interface TodoService List selectTodoListByProcessInstanceId(Todo todo); ProcessInstance getProcessInstance(String businessKey); + public List listProcessInstance(String businessKey); void deleteTodoByBusinessKey(String businessKey); + Todo selectLastApproveTodo(String businessKey,String taskName); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/impl/BuApproveConfigServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/impl/BuApproveConfigServiceImpl.java index 5528cfea..7524e137 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/impl/BuApproveConfigServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/impl/BuApproveConfigServiceImpl.java @@ -1,11 +1,10 @@ package com.ruoyi.sip.flowable.service.impl; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; +import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; +import cn.hutool.core.collection.CollUtil; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; @@ -14,6 +13,8 @@ import com.ruoyi.sip.flowable.mapper.BuApproveConfigMapper; import com.ruoyi.sip.flowable.service.IBuApproveConfigService; import com.ruoyi.system.mapper.SysUserMapper; import liquibase.pro.packaged.A; +import org.flowable.bpmn.model.Process; +import org.flowable.bpmn.model.UserTask; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -33,6 +34,9 @@ public class BuApproveConfigServiceImpl implements IBuApproveConfigService @Autowired private SysUserMapper userMapper; + @Autowired + private SysUserMapper sysUserMapper; + /** * 查询审批配置 * @@ -121,4 +125,56 @@ public class BuApproveConfigServiceImpl implements IBuApproveConfigService } return result; } + + @Override + public List listByProcess(Process process) { + BuApproveConfig queryDto = new BuApproveConfig(); + queryDto.setProcessKey(process.getId()); + List buApproveConfigs = buApproveConfigMapper.selectBuApproveConfigList(queryDto); + //设置用户名 + String userIds = buApproveConfigs.stream().filter(item -> StringUtils.isNotEmpty(item.getApproveUser())).map(BuApproveConfig::getApproveUser).collect(Collectors.joining(",")); + SysUser queryUserDto = new SysUser(); + queryUserDto.setUserIdList(Arrays.stream(userIds.split(",")).filter(StringUtils::isNotEmpty).map(Long::parseLong).distinct().collect(Collectors.toList())); + List sysUsers = sysUserMapper.selectUserList(queryUserDto); + Map userNameMap = sysUsers.stream().collect(Collectors.toMap(item->item.getUserId().toString(), SysUser::getUserName)); + for (BuApproveConfig buApproveConfig : buApproveConfigs) { + if (StringUtils.isNotEmpty(buApproveConfig.getApproveUser())){ + String[] split = buApproveConfig.getApproveUser().split(","); + StringJoiner stringJoiner=new StringJoiner(","); + for (String s : split) { + stringJoiner.add(userNameMap.get(s)); + } + buApproveConfig.setApproveUserName(stringJoiner.toString()); + } + } + + + + + Map configMap = buApproveConfigs.stream().collect(Collectors.toMap(BuApproveConfig::getTaskName, Function.identity())); + List flowElementsOfType = process.findFlowElementsOfType(UserTask.class); + List result=new ArrayList<>(); + for (UserTask flowElement : flowElementsOfType) { + if (configMap.containsKey(flowElement.getName())){ + result.add(configMap.get(flowElement.getName())); + }else{ + BuApproveConfig buApproveConfig = new BuApproveConfig(); + buApproveConfig.setProcessKey(process.getId()); + buApproveConfig.setTaskName(flowElement.getName()); + result.add(buApproveConfig); + } + } + + return result; + } + + @Override + public void saveBatch(List approveConfigList) { + if (CollUtil.isEmpty(approveConfigList)){ + return; + } + buApproveConfigMapper.saveBatch(approveConfigList); + + + } } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/impl/TodoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/impl/TodoServiceImpl.java index 54024ac0..bb8b3b29 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/impl/TodoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/flowable/service/impl/TodoServiceImpl.java @@ -285,6 +285,11 @@ public class TodoServiceImpl implements TodoService { ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult(); return processInstance; + } + @Override + public List listProcessInstance(String businessKey) { + return runtimeService.createProcessInstanceQuery().processInstanceBusinessKeyLike("%"+businessKey+"%").list(); + } @Override @@ -292,6 +297,11 @@ public class TodoServiceImpl implements TodoService { todoMapper.deleteTodoByBusinessKey(businessKey); } + @Override + public Todo selectLastApproveTodo(String businessKey, String taskName) { + return todoMapper.selectLastApproveTodo(businessKey,taskName); + } + /** * 流程审批 */ diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProjectOrderInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProjectOrderInfoMapper.java index 33ca70b3..4802901d 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProjectOrderInfoMapper.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProjectOrderInfoMapper.java @@ -29,6 +29,7 @@ public interface ProjectOrderInfoMapper * @return 订单管理集合 */ public List selectProjectOrderInfoList(ProjectOrderInfo projectOrderInfo); + public ProjectOrderInfo selectProjectOrderInfoByCode(String orderCode); /** * 新增订单管理 diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/VendorInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/VendorInfoMapper.java new file mode 100644 index 00000000..d0de9d65 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/VendorInfoMapper.java @@ -0,0 +1,63 @@ +package com.ruoyi.sip.mapper; + +import com.ruoyi.sip.domain.VendorInfo; + +import java.util.List; + + +/** + * 制造商信息Mapper接口 + * + * @author ruoyi + * @date 2025-07-23 + */ +public interface VendorInfoMapper +{ + /** + * 查询制造商信息 + * + * @param vendorId 制造商信息主键 + * @return 制造商信息 + */ + public VendorInfo selectVendorInfoByVendorId(Long vendorId); + + /** + * 查询制造商信息列表 + * + * @param vendorInfo 制造商信息 + * @return 制造商信息集合 + */ + public List selectVendorInfoList(VendorInfo vendorInfo); + + /** + * 新增制造商信息 + * + * @param vendorInfo 制造商信息 + * @return 结果 + */ + public int insertVendorInfo(VendorInfo vendorInfo); + + /** + * 修改制造商信息 + * + * @param vendorInfo 制造商信息 + * @return 结果 + */ + public int updateVendorInfo(VendorInfo vendorInfo); + + /** + * 删除制造商信息 + * + * @param vendorId 制造商信息主键 + * @return 结果 + */ + public int deleteVendorInfoByVendorId(Long vendorId); + + /** + * 批量删除制造商信息 + * + * @param vendorIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteVendorInfoByVendorIds(String[] vendorIds); +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectInfoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectInfoService.java index c5a2a73a..df8e61a8 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectInfoService.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectInfoService.java @@ -1,5 +1,6 @@ package com.ruoyi.sip.service; +import java.math.BigDecimal; import java.util.List; import com.ruoyi.sip.domain.ProjectInfo; import com.ruoyi.sip.dto.HomepageQueryDto; @@ -64,4 +65,6 @@ public interface IProjectInfoService String exportList(ProjectInfo projectInfo); StatisticsDto homePageData(HomepageQueryDto dto); + + } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectProductInfoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectProductInfoService.java index b6959ebe..b64bbf73 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectProductInfoService.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectProductInfoService.java @@ -1,5 +1,6 @@ package com.ruoyi.sip.service; +import java.math.BigDecimal; import java.util.List; import java.util.function.Supplier; @@ -64,4 +65,6 @@ public interface IProjectProductInfoService List selectProjectProductInfoListByProjectId(List projectId); void saveBatch(List addList); + + void calcByDiscountFold(BigDecimal discountFold, Long projectId); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IVendorInfoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IVendorInfoService.java new file mode 100644 index 00000000..1f5f25be --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IVendorInfoService.java @@ -0,0 +1,63 @@ +package com.ruoyi.sip.service; + +import com.ruoyi.sip.domain.VendorInfo; + +import java.util.List; + + +/** + * 制造商信息Service接口 + * + * @author ruoyi + * @date 2025-07-23 + */ +public interface IVendorInfoService +{ + /** + * 查询制造商信息 + * + * @param vendorId 制造商信息主键 + * @return 制造商信息 + */ + public VendorInfo selectVendorInfoByVendorId(Long vendorId); + + /** + * 查询制造商信息列表 + * + * @param vendorInfo 制造商信息 + * @return 制造商信息集合 + */ + public List selectVendorInfoList(VendorInfo vendorInfo); + + /** + * 新增制造商信息 + * + * @param vendorInfo 制造商信息 + * @return 结果 + */ + public int insertVendorInfo(VendorInfo vendorInfo); + + /** + * 修改制造商信息 + * + * @param vendorInfo 制造商信息 + * @return 结果 + */ + public int updateVendorInfo(VendorInfo vendorInfo); + + /** + * 批量删除制造商信息 + * + * @param vendorIds 需要删除的制造商信息主键集合 + * @return 结果 + */ + public int deleteVendorInfoByVendorIds(String vendorIds); + + /** + * 删除制造商信息信息 + * + * @param vendorId 制造商信息主键 + * @return 结果 + */ + public int deleteVendorInfoByVendorId(Long vendorId); +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java index e5937ee1..57008064 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java @@ -32,6 +32,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDate; import java.time.Period; import java.time.ZoneId; @@ -62,6 +63,8 @@ public class ProjectInfoServiceImpl implements IProjectInfoService { private IProjectOperateLogService operateLogService; @Autowired private IProjectPocInfoService pocInfoService; + @Autowired + private ICustomerInfoService customerInfoService; @Autowired private IProjectOrderInfoService orderInfoService; @@ -128,11 +131,22 @@ public class ProjectInfoServiceImpl implements IProjectInfoService { if (CollUtil.isEmpty(projectInfos)){ return projectInfos; } + //处理客户信息地址 + List customerCodeList = projectInfos.stream().map(ProjectInfo::getCustomerCode).filter(StringUtils::isNotEmpty).distinct().collect(Collectors.toList()); + CustomerInfo queryCustomerDto = new CustomerInfo(); + queryCustomerDto.setCustomerCodeList(customerCodeList); + List customerInfoList = customerInfoService.selectCustomerInfoList(queryCustomerDto); + Map customerInfoMap = customerInfoList.stream().collect(Collectors.toMap(CustomerInfo::getCustomerCode, Function.identity(), (v1, v2) -> v1)); + List idList = projectInfos.stream().map(ProjectInfo::getId).collect(Collectors.toList()); List projectOrderInfos = orderInfoService.selectProjectOrderInfoByProjectId(idList); Map orderInfoMap = projectOrderInfos.stream().collect(Collectors.toMap(ProjectOrderInfo::getProjectId, Function.identity(), (v1, v2) -> v1)); LocalDate now = LocalDate.now(); for (ProjectInfo info : projectInfos) { + CustomerInfo customerInfo = customerInfoMap.get(info.getCustomerCode()); + if (customerInfo != null) { + info.setCustomerAddress(customerInfo.getAddress()); + } info.setCanGenerate(orderInfoMap.get(info.getId()) == null); if (info.getLastWorkUpdateTime() != null) { LocalDate localDate = info.getLastWorkUpdateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java index f0aec33e..0b192145 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java @@ -1,6 +1,9 @@ package com.ruoyi.sip.service.impl; +import java.io.IOException; import java.math.BigDecimal; +import java.net.URL; +import java.nio.charset.Charset; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; @@ -9,7 +12,15 @@ import java.util.stream.Collectors; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.lang.Dict; +import cn.hutool.extra.mail.Mail; import cn.hutool.extra.mail.MailUtil; +import cn.hutool.extra.template.Template; +import cn.hutool.extra.template.TemplateConfig; +import cn.hutool.extra.template.TemplateEngine; +import cn.hutool.extra.template.TemplateUtil; +import cn.hutool.extra.template.engine.thymeleaf.ThymeleafEngine; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.metadata.CellData; import com.alibaba.excel.metadata.Head; @@ -25,6 +36,7 @@ import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.sip.domain.*; import com.ruoyi.sip.flowable.domain.BuApproveConfig; import com.ruoyi.sip.flowable.domain.Todo; @@ -37,6 +49,7 @@ import com.ruoyi.sip.service.*; import com.ruoyi.sip.flowable.service.DeleteFlowableProcessInstanceCmd; import com.ruoyi.sip.flowable.service.TodoCommonTemplate; import com.ruoyi.sip.flowable.service.TodoService; +import com.ruoyi.sip.utils.TemplateMailUtil; import com.ruoyi.system.mapper.SysUserMapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; @@ -47,6 +60,7 @@ import org.flowable.engine.runtime.ProcessInstance; import org.flowable.task.api.Task; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import com.ruoyi.sip.mapper.ProjectOrderInfoMapper; import com.ruoyi.common.core.text.Convert; @@ -330,56 +344,56 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To } fileLogService.deleteProjectOrderFileLogByIds(deleteFileId); } - if (StringUtils.isNotEmpty(projectOrderInfo.getProcessType())) { - ProcessInstance processInstance = todoService.getProcessInstance(getFlowBusinessKey(existProjectOrderInfo.getOrderCode(),projectOrderInfo.getProcessTemplate())); -// if (processInstance != null) { -// DeleteFlowableProcessInstanceCmd cmd = new DeleteFlowableProcessInstanceCmd(processInstance.getProcessInstanceId(), "删除流程实例", true); -// managementService.executeCommand(cmd); -// todoService.deleteTodoByBusinessKey(); -// } - if (processInstance == null) { - String orderFlowKey= ProjectOrderInfo.ProcessTypeEnum.ONLINE.getCode().equals(projectOrderInfo.getProcessType())? - orderOnlineFlowKey:orderOfflineFlowKey; - //启动流程 - todoService.startProcess(getFlowBusinessKey(existProjectOrderInfo.getOrderCode(),projectOrderInfo.getProcessTemplate()), new HashMap() {{ - put("processType", projectOrderInfo.getProcessType()); - put("applyUserName", ShiroUtils.getSysUser().getUserName()); - put("applyUser", ShiroUtils.getUserId()); - put("extendField1", projectOrderInfo.getVersionCode()); - // put("approveUserls", userMapper.selectApproveUserls(order.getDepCoding())); - }}, orderFlowKey); + if (ProjectOrderInfo.OrderStatus.WAIT_APPROVE.getCode().equals(projectOrderInfo.getOrderStatus())) { + List processInstanceList = todoService.listProcessInstance(existProjectOrderInfo.getOrderCode()); + if (CollUtil.isNotEmpty(processInstanceList)) { + for (ProcessInstance processInstance : processInstanceList) { + //删除流程实例 不删流程实例可能导致 售前A提交流程被驳回后 售前B无法提交审核 因为流程驳回是驳回后,流程处理人是售前A + DeleteFlowableProcessInstanceCmd cmd = new DeleteFlowableProcessInstanceCmd(processInstance.getProcessInstanceId(), "删除流程实例", true); + managementService.executeCommand(cmd); + } + todoService.deleteTodoByBusinessKey(existProjectOrderInfo.getOrderCode()); } -// todoService.completed(null, null,orderFlowKey+"#"+projectOrderInfo.getProjectCode()); - complete(null, null, getFlowBusinessKey(existProjectOrderInfo.getOrderCode(),projectOrderInfo.getProcessTemplate())); + + String orderFlowKey = ProjectOrderInfo.ProcessTypeEnum.ONLINE.getCode().equals(projectOrderInfo.getProcessType()) ? + orderOnlineFlowKey : orderOfflineFlowKey; + //启动流程 + todoService.startProcess(getFlowBusinessKey(existProjectOrderInfo.getOrderCode(), projectOrderInfo.getProcessType()), new HashMap() {{ + put("processTemplate", projectOrderInfo.getProcessTemplate()); + put("applyUserName", ShiroUtils.getSysUser().getUserName()); + put("applyUser", ShiroUtils.getUserId()); + put("extendField1", projectOrderInfo.getVersionCode()); + }}, orderFlowKey); + complete(null, null, getFlowBusinessKey(existProjectOrderInfo.getOrderCode(), projectOrderInfo.getProcessType())); projectOrderInfo.setOrderStatus(ProjectOrderInfo.OrderStatus.WAIT_APPROVE.getCode()); //根据提交类型判断折上折是 100% 98.8%或者98.5% - if ("0".equals(projectOrderInfo.getProcessTemplate())){ + if ("0".equals(projectOrderInfo.getProcessTemplate())) { //直签 98.8 projectOrderInfo.setDiscountFold(new BigDecimal("0.985")); - }else if("1".equals(projectOrderInfo.getProcessTemplate())){ + } else if ("1".equals(projectOrderInfo.getProcessTemplate())) { //总代 98.5 projectOrderInfo.setDiscountFold(new BigDecimal("0.985")); - }else{ + } else { projectOrderInfo.setDiscountFold(BigDecimal.ONE); } } return projectOrderInfoMapper.updateProjectOrderInfo(projectOrderInfo); } - private String getFlowBusinessKey(String code,String processTemplate) { + private String getFlowBusinessKey(String code, String processType) { if (StringUtils.isEmpty(code)) { throw new ServiceException("流程BusinessKey为空"); } - if (StringUtils.isEmpty(processTemplate)) { + if (StringUtils.isEmpty(processType)) { ProjectOrderInfo projectOrderInfo = new ProjectOrderInfo(); projectOrderInfo.setOrderCode(code); List projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo); if (CollUtil.isEmpty(projectOrderInfos)){ throw new ServiceException("流程对应的订单不存在"); } - processTemplate = projectOrderInfos.get(0).getProcessTemplate(); + processType = projectOrderInfos.get(0).getProcessType(); } - String orderFlowKey= ProjectOrderInfo.ProcessTypeEnum.ONLINE.getCode().equals(processTemplate)? + String orderFlowKey = ProjectOrderInfo.ProcessTypeEnum.ONLINE.getCode().equals(processType) ? orderOnlineFlowKey:orderOfflineFlowKey; if (code.startsWith(orderFlowKey + "#")) { return code; @@ -955,19 +969,11 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To //设置审批人 Task task = taskService.createTaskQuery().processInstanceBusinessKey(businessKey).taskAssignee(String.valueOf(getSysUser().getUserId())).singleResult(); - String name = task.getName(); - List approveUserList = approveConfigService.listByProcessKeyAndTaskName(BuApproveConfig.APPROVE_KEY.ORDER_APPROVE.getKey(), name); - if (CollUtil.isEmpty(approveUserList)) { - throw new ServiceException("审批人为空,无法提交审核"); - } -// variable.put("approveUsern", approveUserList.get(0)); - variable.put("approveUserns", approveUserList); if (StringUtils.isEmpty(taskId)) { taskId = task.getId(); } - if (ObjectUtils.isNotEmpty(variable.get("comment"))) { ProcessInstance processInstance = todoService.getProcessInstance(businessKey); taskService.addComment(taskId, processInstance.getProcessInstanceId(), String.valueOf(variable.get("comment"))); @@ -985,6 +991,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To @Override + public boolean todoApproveCallback(Todo todo) { if (CollUtil.isNotEmpty(todo.getVariables())) { Integer approveBtn = (Integer) todo.getVariables().get("approveBtn"); @@ -999,19 +1006,28 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To projectOrderInfoMapper.updateProjectOrderInfoByCode(projectOrderInfo); } if ("公司领导".equals(todo.getTaskName()) && approveBtn.equals(1)) { + ProjectOrderInfo dbProjectOrderInfo = projectOrderInfoMapper.selectProjectOrderInfoByCode(todo.getBusinessKey()); ProjectOrderInfo projectOrderInfo = new ProjectOrderInfo(); projectOrderInfo.setOrderStatus(ProjectOrderInfo.OrderStatus.APPROVE_COMPLETE.getCode()); + //修改执行单时间 只有直签且有现金折扣的时间才是配置时间 否则默认30天 + int addHour = ProjectOrderInfo.ProcessTemplateEnum.DIRECT_SIGNING.getCode().equals(dbProjectOrderInfo.getProcessTemplate()) + && dbProjectOrderInfo.getDiscountFold() != null && dbProjectOrderInfo.getDiscountFold().compareTo(BigDecimal.ONE) < 0 ? endHour : 30; + projectOrderInfo.setOrderEndTime(DateUtils.addHours(DateUtils.getNowDate(), addHour)); projectOrderInfo.setOrderCode(todo.getBusinessKey()); projectOrderInfoMapper.updateProjectOrderInfoByCode(projectOrderInfo); projectOrderInfoMapper.bakData(projectOrderInfo); - //修改执行单时间 - projectOrderInfo.setOrderEndTime(DateUtils.addHours(DateUtils.getNowDate(),endHour)); - //todo 发送邮件 - List projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo); - if (CollUtil.isNotEmpty(projectOrderInfos)) { - ProjectOrderInfo dbProjectOrderInfo = projectOrderInfos.get(0); -// MailUtil.send(); + //修改产品数据 +// projectInfo + if (dbProjectOrderInfo.getDiscountFold().compareTo(BigDecimal.ONE)!=0){ + + productInfoService.calcByDiscountFold(dbProjectOrderInfo.getDiscountFold(), projectOrderInfo.getProjectId()); } + + //todo 总代 发 代理商 商务 执行单发 商务 制造商 + + + + } } return TodoCommonTemplate.super.todoApproveCallback(todo); @@ -1027,4 +1043,20 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To return null; } + private void sendDeliveryMail(List toEmail,ProjectOrderInfo projectOrderInfo){ + if (CollUtil.isEmpty(toEmail)){ + log.info("发货邮件发送失败,收件人为空"); + return; + } + List projectProductInfos = productInfoService.selectProjectProductInfoListByProjectId(Collections.singletonList(projectOrderInfo.getProjectId())); + if (CollUtil.isEmpty(projectProductInfos)){ + log.info("发货邮件发送失败,产品信息为空"); + return; + } + String templateTile="{}-紫光汇智云桌面-{}-供应商通知发货单"; + String title = StringUtils.format(templateTile, projectOrderInfo.getOrderCode(), projectOrderInfo.getProjectName()); + + TemplateMailUtil.sendTemplateMail(toEmail,title, + TemplateMailUtil.MailTemplate.ORDER_DELIVERY,Dict.create().set("productList", projectProductInfos)); + } } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectProductInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectProductInfoServiceImpl.java index a17de930..f2d03f29 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectProductInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectProductInfoServiceImpl.java @@ -157,4 +157,16 @@ public class ProjectProductInfoServiceImpl implements IProjectProductInfoService } } + + @Override + public void calcByDiscountFold(BigDecimal discountFold, Long projectId) { + List projectProductInfos = projectProductInfoMapper.selectProjectProductInfoListByProjectId(Collections.singletonList(projectId)); + for (ProjectProductInfo info : projectProductInfos) { + BigDecimal price = info.getPrice().multiply(discountFold).setScale(2,RoundingMode.HALF_UP); + info.setPrice(price); + info.setAllPrice(price.multiply(new BigDecimal(info.getQuantity())).setScale(2,RoundingMode.HALF_UP)); + info.setDiscount(price.divide(info.getCataloguePrice(),4,RoundingMode.HALF_UP)); + } + projectProductInfoMapper.updateBatch(projectProductInfos); + } } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/VendorInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/VendorInfoServiceImpl.java new file mode 100644 index 00000000..1d26e1d0 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/VendorInfoServiceImpl.java @@ -0,0 +1,113 @@ +package com.ruoyi.sip.service.impl; + +import java.util.List; + +import cn.hutool.core.collection.CollUtil; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.sip.domain.VendorInfo; +import com.ruoyi.sip.mapper.VendorInfoMapper; +import com.ruoyi.sip.service.IVendorInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.ruoyi.common.core.text.Convert; + +/** + * 制造商信息Service业务层处理 + * + * @author ruoyi + * @date 2025-07-23 + */ +@Service +public class VendorInfoServiceImpl implements IVendorInfoService { + @Autowired + private VendorInfoMapper vendorInfoMapper; + + /** + * 查询制造商信息 + * + * @param vendorId 制造商信息主键 + * @return 制造商信息 + */ + @Override + public VendorInfo selectVendorInfoByVendorId(Long vendorId) { + return vendorInfoMapper.selectVendorInfoByVendorId(vendorId); + } + + /** + * 查询制造商信息列表 + * + * @param vendorInfo 制造商信息 + * @return 制造商信息 + */ + @Override + public List selectVendorInfoList(VendorInfo vendorInfo) { + return vendorInfoMapper.selectVendorInfoList(vendorInfo); + } + + /** + * 新增制造商信息 + * + * @param vendorInfo 制造商信息 + * @return 结果 + */ + @Override + public int insertVendorInfo(VendorInfo vendorInfo) { + checkUnqCode(vendorInfo); + vendorInfo.setVendorStatus(VendorInfo.VendorStatusEnum.NORMAL.getCode()); + vendorInfo.setCreateTime(DateUtils.getNowDate()); + vendorInfo.setCreateBy(ShiroUtils.getUserId().toString()); + return vendorInfoMapper.insertVendorInfo(vendorInfo); + } + + private void checkUnqCode(VendorInfo vendorInfo) { + VendorInfo queryDto = new VendorInfo(); + queryDto.setVendorCode(vendorInfo.getVendorCode()); + List vendorInfos = vendorInfoMapper.selectVendorInfoList(queryDto); + int count = vendorInfos.size(); + if (vendorInfo.getVendorId() != null) { + count = Math.toIntExact(vendorInfos.stream().filter(vendorInfo1 -> !vendorInfo1.getVendorId().equals(vendorInfo.getVendorId())).count()); + } + if (count > 0) { + throw new ServiceException("制造商编码重复,保存失败"); + } + } + + /** + * 修改制造商信息 + * + * @param vendorInfo 制造商信息 + * @return 结果 + */ + @Override + public int updateVendorInfo(VendorInfo vendorInfo) { + checkUnqCode(vendorInfo); + vendorInfo.setUpdateTime(DateUtils.getNowDate()); + vendorInfo.setUpdateBy(ShiroUtils.getUserId().toString()); + return vendorInfoMapper.updateVendorInfo(vendorInfo); + } + + /** + * 批量删除制造商信息 + * + * @param vendorIds 需要删除的制造商信息主键 + * @return 结果 + */ + @Override + public int deleteVendorInfoByVendorIds(String vendorIds) { + return vendorInfoMapper.deleteVendorInfoByVendorIds(Convert.toStrArray(vendorIds)); + } + + /** + * 删除制造商信息信息 + * + * @param vendorId 制造商信息主键 + * @return 结果 + */ + @Override + public int deleteVendorInfoByVendorId(Long vendorId) { + return vendorInfoMapper.deleteVendorInfoByVendorId(vendorId); + } +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/utils/TemplateMailUtil.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/utils/TemplateMailUtil.java new file mode 100644 index 00000000..9f675367 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/utils/TemplateMailUtil.java @@ -0,0 +1,89 @@ +package com.ruoyi.sip.utils; + + +import cn.hutool.core.lang.Dict; +import cn.hutool.extra.mail.Mail; +import cn.hutool.extra.template.Template; +import cn.hutool.extra.template.TemplateConfig; +import cn.hutool.extra.template.TemplateEngine; +import cn.hutool.extra.template.TemplateUtil; +import cn.hutool.extra.template.engine.thymeleaf.ThymeleafEngine; +import com.ruoyi.common.utils.spring.SpringUtils; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; + +import java.util.List; + +/** + * @author : ch + * @version : 1.0 + * @ClassName : TemplateMailUtil + * @Description : + * @DATE : Created in 10:10 2025/7/29 + *
       Copyright: Copyright(c) 2025     
+ *
       Company :   	紫光汇智信息技术有限公司		           
+ * Modification History: + * Date Author Version Discription + * -------------------------------------------------------------------------- + * 2025/07/29 ch 1.0 Why & What is modified: <修改原因描述> * + */ +@Slf4j +public class TemplateMailUtil { + + /** + * 发送发货单邮件 + * @param toEmail 收件人 + * @param title 标题 + * @param path 模板名称枚举 mailTemplate目录下 + * @param dict 参数值 Dict.create().set("productList", projectProductInfos) + * @author ch + * @Date 2025/07/29 09:55 + */ + public static void sendTemplateMail(List toEmail, String title, MailTemplate path, Dict dict) { + String enbaled = SpringUtils.getProperty("unis.mail.enabled", "false"); + if (Boolean.getBoolean(enbaled)) { + log.warn("邮件发送开关未开启"); + return; + } + TemplateConfig config = new TemplateConfig("mailTemplate", TemplateConfig.ResourceMode.CLASSPATH); + config.setCustomEngine(ThymeleafEngine.class); + TemplateEngine engine = TemplateUtil.createEngine(config); + Template template = engine.getTemplate(path.getPath()); + String result = template.render(dict); + + try{ + org.springframework.core.io.Resource resource = SpringUtils.getResource("classpath:static/img/companyLogo.png"); + Mail mail = Mail.create() + .setTos(toEmail.toArray(new String[0])) + .setTitle(title) + .setContent(result) + .setHtml(true); + mail.addImage("signature",resource.getFile()); + mail.send(); + } catch (Exception e) { + log.error("发送邮件失败,错误原因:{},错误详情:{}",e.getMessage(),e.getStackTrace()); + } + } + + + @Getter + public enum MailTemplate { + /** + * 发货单 + */ + ORDER_DELIVERY("mailOrderDeliveryTemplate.html","发货单"), + + ; + + private final String path; + private final String desc; + + MailTemplate(String path,String desc) { + this.path = path; + this.desc = desc; + } + + + } +} diff --git a/ruoyi-sip/src/main/resources/mapper/flow/BuApproveConfigMapper.xml b/ruoyi-sip/src/main/resources/mapper/flow/BuApproveConfigMapper.xml index 522ba42a..a52f6c44 100644 --- a/ruoyi-sip/src/main/resources/mapper/flow/BuApproveConfigMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/flow/BuApproveConfigMapper.xml @@ -43,6 +43,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{approveRole}, + + insert into bu_approve_config (process_key, task_name, approve_user, approve_role) values + + (#{item.processKey}, #{item.taskName}, #{item.approveUser}, #{item.approveRole}) + + on duplicate key update + approve_user=values(approve_user), + approve_role=values(approve_role) + update bu_approve_config diff --git a/ruoyi-sip/src/main/resources/mapper/flow/TodoMapper.xml b/ruoyi-sip/src/main/resources/mapper/flow/TodoMapper.xml index b03f40a5..8275107c 100644 --- a/ruoyi-sip/src/main/resources/mapper/flow/TodoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/flow/TodoMapper.xml @@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select todo_id, business_key, process_key, process_name, task_name, approve_user_name,approve_time,approve_opinion, - approve_status,apply_user_name, apply_time, extend_field1, extend_field2,task_id,process_instance_id,form_key from bu_todo_completed + approve_status,apply_user_name, apply_time, extend_field1, extend_field2,task_id,process_instance_id,form_key,approve_user from bu_todo_completed + \ No newline at end of file diff --git a/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderFileLogMapper.xml b/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderFileLogMapper.xml index 37fd1218..760fa099 100644 --- a/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderFileLogMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderFileLogMapper.xml @@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and file_path = #{filePath} and file_type = #{fileType} + order by t1.id + insert into project_order_info @@ -190,6 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" notifier, notifier_email, notifier_phone, + notifier_address, duty, duty_email, duty_phone, @@ -227,6 +234,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{notifier}, #{notifierEmail}, #{notifierPhone}, + #{notifierAddress}, #{duty}, #{dutyEmail}, #{dutyPhone}, @@ -271,6 +279,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" notifier = #{notifier}, notifier_email = #{notifierEmail}, notifier_phone = #{notifierPhone}, + notifier_address = #{notifierAddress}, duty = #{duty}, duty_email = #{dutyEmail}, duty_phone = #{dutyPhone}, @@ -320,6 +329,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" notifier = #{notifier}, notifier_email = #{notifierEmail}, notifier_phone = #{notifierPhone}, + notifier_address = #{notifierAddress}, duty = #{duty}, duty_email = #{dutyEmail}, duty_phone = #{dutyPhone}, diff --git a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml index fd350736..ff894f0e 100644 --- a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml @@ -1,9 +1,9 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -20,27 +20,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, product_code, product_name, model, description, remark, created_at, updated_at, deleted_at,value,type,hz_code,catalogue_price,guidance_discount from product_info + select t1.id, t1.product_code, t1.product_name, t1.model, t1.description, t1.remark, t1.created_at, t1.updated_at, + t1.deleted_at,t1.value,t1.type,t1.hz_code,t1.catalogue_price,t1.guidance_discount,t1.vendor_code + ,t2.vendor_name + from product_info t1 left join vendor_info t2 on t1.vendor_code = t2.vendor_code - + + + + and vendor_code like concat('%', #{vendorCode}, '%') + and vendor_name like concat('%', #{vendorName}, '%') + and vendor_address like concat('%', #{vendorAddress}, '%') + and vendor_user = #{vendorUser} + and vendor_status = #{vendorStatus} + + + + + + + insert into vendor_info + + vendor_id, + vendor_code, + vendor_name, + vendor_address, + vendor_user, + vendor_email, + vendor_phone, + vendor_status, + create_by, + update_by, + create_time, + update_time, + + + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorAddress}, + #{vendorUser}, + #{vendorEmail}, + #{vendorPhone}, + #{vendorStatus}, + #{createBy}, + #{updateBy}, + #{createTime}, + #{updateTime}, + + + + + update vendor_info + + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_address = #{vendorAddress}, + vendor_user = #{vendorUser}, + vendor_email = #{vendorEmail}, + vendor_phone = #{vendorPhone}, + vendor_status = #{vendorStatus}, + create_by = #{createBy}, + update_by = #{updateBy}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where vendor_id = #{vendorId} + + + + delete from vendor_info where vendor_id = #{vendorId} + + + + delete from vendor_info where vendor_id in + + #{vendorId} + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index e278919d..92132044 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -63,9 +63,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select u.user_id, u.dept_id, u.login_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u left join sys_dept d on u.dept_id = d.dept_id where u.del_flag = '0' + + and u.user_id in + + #{userId} + + AND u.user_id = #{userId} + + AND u.user_name like concat('%', #{userName}, '%') + AND u.login_name like concat('%', #{loginName}, '%')