Sfoglia il codice sorgente

ERP编码组合申请

yzc 1 anno fa
parent
commit
46e5e24f6b

+ 11 - 2
hx-common/src/main/java/com/fjhx/common/enums/CodingRuleEnum.java

@@ -114,7 +114,7 @@ public enum CodingRuleEnum {
     /**
      * 学历补贴申请
      */
-    EDUCATION_SUBSIDY_FLOW("education_subsidy", "学历补贴申请", Arrays.asList(
+    EDUCATION_SUBSIDY("education_subsidy", "学历补贴申请", Arrays.asList(
             getDefaultRule(RuleTypeEnum.CUSTOMIZE, "ES-"),
             getDefaultRule(RuleTypeEnum.DATE_FORMAT, "yyyyMM-"),
             getDefaultRule(RuleTypeEnum.AUTOINCREMENT, "3")
@@ -123,7 +123,7 @@ public enum CodingRuleEnum {
     /**
      * 医社保申请
      */
-    MEDICAL_INSURANCE("medical_insurance", "学历补贴申请", Arrays.asList(
+    MEDICAL_INSURANCE("medical_insurance", "医社保申请", Arrays.asList(
             getDefaultRule(RuleTypeEnum.CUSTOMIZE, "MI-"),
             getDefaultRule(RuleTypeEnum.DATE_FORMAT, "yyyyMM-"),
             getDefaultRule(RuleTypeEnum.AUTOINCREMENT, "3")
@@ -137,6 +137,15 @@ public enum CodingRuleEnum {
             getDefaultRule(RuleTypeEnum.DATE_FORMAT, "yyyyMM-"),
             getDefaultRule(RuleTypeEnum.AUTOINCREMENT, "3")
     )),
+
+    /**
+     * ERP编码组合申请
+     */
+    ERP_CODING_GROUP("erp_coding_group", "ERP编码组合申请", Arrays.asList(
+            getDefaultRule(RuleTypeEnum.CUSTOMIZE, "ECG-"),
+            getDefaultRule(RuleTypeEnum.DATE_FORMAT, "yyyyMM-"),
+            getDefaultRule(RuleTypeEnum.AUTOINCREMENT, "3")
+    )),
     ;
 
 

+ 71 - 0
hx-oa/src/main/java/com/fjhx/oa/controller/erp/ErpCodingGroupController.java

@@ -0,0 +1,71 @@
+package com.fjhx.oa.controller.erp;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.oa.entity.erp.dto.ErpCodingGroupDto;
+import com.fjhx.oa.entity.erp.dto.ErpCodingGroupSelectDto;
+import com.fjhx.oa.entity.erp.vo.ErpCodingGroupVo;
+import com.fjhx.oa.service.erp.ErpCodingGroupService;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * erp编码组 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-04-09
+ */
+@RestController
+@RequestMapping("/erpCodingGroup")
+public class ErpCodingGroupController {
+
+    @Autowired
+    private ErpCodingGroupService erpCodingGroupService;
+
+    /**
+     * erp编码组分页
+     */
+    @PostMapping("/page")
+    public Page<ErpCodingGroupVo> page(@RequestBody ErpCodingGroupSelectDto dto) {
+        return erpCodingGroupService.getPage(dto);
+    }
+
+    /**
+     * erp编码组明细
+     */
+    @PostMapping("/detail")
+    public ErpCodingGroupVo detail(@RequestBody BaseSelectDto dto) {
+        return erpCodingGroupService.detail(dto.getId());
+    }
+
+    /**
+     * erp编码组新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody ErpCodingGroupDto erpCodingGroupDto) {
+        erpCodingGroupService.addOrEdit(erpCodingGroupDto);
+    }
+
+    /**
+     * erp编码组编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody ErpCodingGroupDto erpCodingGroupDto) {
+        erpCodingGroupService.addOrEdit(erpCodingGroupDto);
+    }
+
+    /**
+     * erp编码组删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        erpCodingGroupService.delete(dto.getId());
+    }
+
+}

+ 25 - 0
hx-oa/src/main/java/com/fjhx/oa/entity/erp/dto/ErpCodingGroupDto.java

@@ -0,0 +1,25 @@
+package com.fjhx.oa.entity.erp.dto;
+
+import com.fjhx.file.entity.ObsFile;
+import com.fjhx.oa.entity.erp.po.ErpCodingGroup;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * erp编码组新增编辑入参实体
+ *
+ * @author
+ * @since 2024-04-09
+ */
+@Getter
+@Setter
+public class ErpCodingGroupDto extends ErpCodingGroup {
+
+    /**
+     * 附件信息
+     */
+    private List<ObsFile> fileList;
+
+}

+ 19 - 0
hx-oa/src/main/java/com/fjhx/oa/entity/erp/dto/ErpCodingGroupSelectDto.java

@@ -0,0 +1,19 @@
+package com.fjhx.oa.entity.erp.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * erp编码组列表查询入参实体
+ *
+ * @author
+ * @since 2024-04-09
+ */
+@Getter
+@Setter
+public class ErpCodingGroupSelectDto extends BaseSelectDto {
+
+    private Integer status;
+
+}

+ 51 - 0
hx-oa/src/main/java/com/fjhx/oa/entity/erp/po/ErpCodingGroup.java

@@ -0,0 +1,51 @@
+package com.fjhx.oa.entity.erp.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * erp编码组
+ * </p>
+ *
+ * @author
+ * @since 2024-04-09
+ */
+@Getter
+@Setter
+@TableName("erp_coding_group")
+public class ErpCodingGroup extends BasePo {
+
+    private String code;
+
+    /**
+     * 申请时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date applyTime;
+
+    /**
+     * 部门id
+     */
+    private Long deptId;
+
+    /**
+     * 公司id
+     */
+    private Long companyId;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    private Integer status;
+
+    private Long flowId;
+
+}

+ 21 - 0
hx-oa/src/main/java/com/fjhx/oa/entity/erp/vo/ErpCodingGroupVo.java

@@ -0,0 +1,21 @@
+package com.fjhx.oa.entity.erp.vo;
+
+import com.fjhx.oa.entity.erp.po.ErpCodingGroup;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * erp编码组列表查询返回值实体
+ *
+ * @author
+ * @since 2024-04-09
+ */
+@Getter
+@Setter
+public class ErpCodingGroupVo extends ErpCodingGroup {
+
+    private String createUserName;
+    private String deptName;
+    private String companyName;
+
+}

+ 1 - 1
hx-oa/src/main/java/com/fjhx/oa/flow/EducationSubsidyFlow.java

@@ -34,7 +34,7 @@ public class EducationSubsidyFlow extends FlowDelegate {
         EducationSubsidyDto dto = submitData.toJavaObject(EducationSubsidyDto.class);
         dto.setFlowId(flowId);
 
-        dto.setCode(codingRuleService.createCode(CodingRuleEnum.EDUCATION_SUBSIDY_FLOW.getKey(), null));
+        dto.setCode(codingRuleService.createCode(CodingRuleEnum.EDUCATION_SUBSIDY.getKey(), null));
         dto.setStatus(FlowStatusEnum1.UNDER_REVIEW.getKey());
 
         educationSubsidyService.addOrEdit(dto);

+ 74 - 0
hx-oa/src/main/java/com/fjhx/oa/flow/ErpCodingGroupFlow.java

@@ -0,0 +1,74 @@
+package com.fjhx.oa.flow;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fjhx.common.enums.CodingRuleEnum;
+import com.fjhx.common.enums.FlowStatusEnum1;
+import com.fjhx.common.service.coding.CodingRuleService;
+import com.fjhx.flow.core.FlowDelegate;
+import com.fjhx.flow.enums.FlowStatusEnum;
+import com.fjhx.oa.entity.erp.dto.ErpCodingGroupDto;
+import com.fjhx.oa.entity.erp.po.ErpCodingGroup;
+import com.fjhx.oa.service.erp.ErpCodingGroupService;
+import com.ruoyi.common.core.domain.BasePo;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class ErpCodingGroupFlow extends FlowDelegate {
+
+    @Autowired
+    private ErpCodingGroupService erpCodingGroupService;
+    @Autowired
+    private CodingRuleService codingRuleService;
+
+    @Override
+    public String getFlowKey() {
+        return "erp_coding_group_flow";
+    }
+
+    @Override
+    public Long start(Long flowId, JSONObject submitData) {
+        ErpCodingGroupDto dto = submitData.toJavaObject(ErpCodingGroupDto.class);
+        dto.setFlowId(flowId);
+
+        dto.setCode(codingRuleService.createCode(CodingRuleEnum.ERP_CODING_GROUP.getKey(), null));
+        dto.setStatus(FlowStatusEnum1.UNDER_REVIEW.getKey());
+
+        erpCodingGroupService.addOrEdit(dto);
+
+        return dto.getId();
+    }
+
+    @Override
+    public void end(Long flowId, Long businessId, JSONObject submitData) {
+        erpCodingGroupService.update(q -> q
+                .eq(ErpCodingGroup::getId, businessId)
+                .set(ErpCodingGroup::getStatus, FlowStatusEnum1.PASS.getKey())
+                .set(BasePo::getUpdateTime, new Date())
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+        );
+    }
+
+    @Override
+    public void relaunch(Long flowId, Long businessId, FlowStatusEnum flowStatus, JSONObject submitData) {
+        start(flowId, submitData);
+    }
+
+    @Override
+    public void reject(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
+        erpCodingGroupService.update(q -> q
+                .eq(ErpCodingGroup::getId, businessId)
+                .set(ErpCodingGroup::getStatus, FlowStatusEnum1.REJECT.getKey())
+                .set(BasePo::getUpdateTime, new Date())
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+        );
+    }
+
+    @Override
+    public void cancellation(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
+        erpCodingGroupService.cancellation(businessId);
+    }
+}

+ 26 - 0
hx-oa/src/main/java/com/fjhx/oa/mapper/erp/ErpCodingGroupMapper.java

@@ -0,0 +1,26 @@
+package com.fjhx.oa.mapper.erp;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.oa.entity.erp.po.ErpCodingGroup;
+import com.fjhx.oa.entity.erp.vo.ErpCodingGroupVo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * erp编码组 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2024-04-09
+ */
+public interface ErpCodingGroupMapper extends BaseMapper<ErpCodingGroup> {
+
+    /**
+     * erp编码组分页
+     */
+    Page<ErpCodingGroupVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<ErpCodingGroup> wrapper);
+
+}

+ 42 - 0
hx-oa/src/main/java/com/fjhx/oa/service/erp/ErpCodingGroupService.java

@@ -0,0 +1,42 @@
+package com.fjhx.oa.service.erp;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.oa.entity.erp.dto.ErpCodingGroupDto;
+import com.fjhx.oa.entity.erp.dto.ErpCodingGroupSelectDto;
+import com.fjhx.oa.entity.erp.po.ErpCodingGroup;
+import com.fjhx.oa.entity.erp.vo.ErpCodingGroupVo;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * erp编码组 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-04-09
+ */
+public interface ErpCodingGroupService extends BaseService<ErpCodingGroup> {
+
+    /**
+     * erp编码组分页
+     */
+    Page<ErpCodingGroupVo> getPage(ErpCodingGroupSelectDto dto);
+
+    /**
+     * erp编码组明细
+     */
+    ErpCodingGroupVo detail(Long id);
+
+    /**
+     * erp编码组新增
+     */
+    void addOrEdit(ErpCodingGroupDto erpCodingGroupDto);
+
+    /**
+     * erp编码组删除
+     */
+    void delete(Long id);
+
+    void cancellation(Long businessId);
+}

+ 116 - 0
hx-oa/src/main/java/com/fjhx/oa/service/erp/impl/ErpCodingGroupServiceImpl.java

@@ -0,0 +1,116 @@
+package com.fjhx.oa.service.erp.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.enums.FlowStatusEnum1;
+import com.fjhx.file.utils.ObsFileUtil;
+import com.fjhx.flow.entity.flow.po.FlowExample;
+import com.fjhx.flow.enums.FlowStatusEnum;
+import com.fjhx.flow.service.flow.FlowExampleService;
+import com.fjhx.oa.entity.erp.dto.ErpCodingGroupDto;
+import com.fjhx.oa.entity.erp.dto.ErpCodingGroupSelectDto;
+import com.fjhx.oa.entity.erp.po.ErpCodingGroup;
+import com.fjhx.oa.entity.erp.vo.ErpCodingGroupVo;
+import com.fjhx.oa.mapper.erp.ErpCodingGroupMapper;
+import com.fjhx.oa.service.erp.ErpCodingGroupService;
+import com.fjhx.tenant.utils.DeptUstil;
+import com.ruoyi.common.core.domain.BasePo;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.common.utils.wrapper.SqlField;
+import com.ruoyi.system.utils.UserUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * <p>
+ * erp编码组 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-04-09
+ */
+@Service
+public class ErpCodingGroupServiceImpl extends ServiceImpl<ErpCodingGroupMapper, ErpCodingGroup> implements ErpCodingGroupService {
+
+    @Autowired
+    private FlowExampleService flowExampleService;
+
+    @Override
+    public Page<ErpCodingGroupVo> getPage(ErpCodingGroupSelectDto dto) {
+        IWrapper<ErpCodingGroup> wrapper = getWrapper();
+
+        wrapper.keyword(dto.getKeyword(),
+                new SqlField("ecg", ErpCodingGroup::getCode),
+                new SqlField("ecg", ErpCodingGroup::getRemark)
+        );
+        wrapper.eq("ecg", ErpCodingGroup::getStatus, dto.getStatus());
+
+        wrapper.orderByDesc("ecg", ErpCodingGroup::getId);
+        Page<ErpCodingGroupVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        List<ErpCodingGroupVo> records = page.getRecords();
+        setInfo(records);
+        return page;
+    }
+
+    @Override
+    public ErpCodingGroupVo detail(Long id) {
+        ErpCodingGroup ErpCodingGroup = this.getById(id);
+        ErpCodingGroupVo result = BeanUtil.toBean(ErpCodingGroup, ErpCodingGroupVo.class);
+
+        setInfo(Arrays.asList(result));
+
+        return result;
+    }
+
+    void setInfo(List<ErpCodingGroupVo> records) {
+        if (ObjectUtil.isEmpty(records)) {
+            return;
+        }
+
+        UserUtil.assignmentNickName(records, ErpCodingGroup::getCreateUser, ErpCodingGroupVo::setCreateUserName);
+        DeptUstil.assignmentNickName(records, ErpCodingGroup::getDeptId, ErpCodingGroupVo::setDeptName);
+        DeptUstil.assignmentNickName(records, ErpCodingGroup::getCompanyId, ErpCodingGroupVo::setCompanyName);
+    }
+
+    @DSTransactional
+    @Override
+    public void addOrEdit(ErpCodingGroupDto erpCodingGroupDto) {
+        this.save(erpCodingGroupDto);
+        ObsFileUtil.editFile(erpCodingGroupDto.getFileList(), erpCodingGroupDto.getId());
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+    @Override
+    public void cancellation(Long businessId) {
+        ErpCodingGroup byId = getById(businessId);
+        this.update(q -> q
+                .eq(ErpCodingGroup::getId, businessId)
+                .set(ErpCodingGroup::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
+                .set(BasePo::getUpdateTime, new Date())
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+        );
+
+        //销毁审批中的流程
+        flowExampleService.update(q -> q
+                .eq(FlowExample::getId, byId.getFlowId())
+                .in(FlowExample::getStatus, FlowStatusEnum.READY_START.getKey(), FlowStatusEnum.IN_PROGRESS.getKey())
+                .set(FlowExample::getStatus, FlowStatusEnum.CANCELLATION.getKey())
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+                .set(BasePo::getUpdateTime, new Date())
+        );
+    }
+
+}

+ 21 - 0
hx-oa/src/main/resources/mapper/erp/ErpCodingGroupMapper.xml

@@ -0,0 +1,21 @@
+<?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="com.fjhx.oa.mapper.erp.ErpCodingGroupMapper">
+    <select id="getPage" resultType="com.fjhx.oa.entity.erp.vo.ErpCodingGroupVo">
+        select ecg.id,
+               ecg.code,
+               ecg.apply_time,
+               ecg.dept_id,
+               ecg.company_id,
+               ecg.remark,
+               ecg.status,
+               ecg.flow_id,
+               ecg.create_user,
+               ecg.create_time,
+               ecg.update_user,
+               ecg.update_time
+        from erp_coding_group ecg
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>