|
@@ -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())
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|