|
@@ -0,0 +1,128 @@
|
|
|
+package com.fjhx.oa.service.seal.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.seal.dto.SealUseDto;
|
|
|
+import com.fjhx.oa.entity.seal.dto.SealUseSelectDto;
|
|
|
+import com.fjhx.oa.entity.seal.po.SealUse;
|
|
|
+import com.fjhx.oa.entity.seal.vo.SealUseVo;
|
|
|
+import com.fjhx.oa.mapper.seal.SealUseMapper;
|
|
|
+import com.fjhx.oa.service.seal.SealUseService;
|
|
|
+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>
|
|
|
+ * 用印申请 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2024-04-09
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class SealUseServiceImpl extends ServiceImpl<SealUseMapper, SealUse> implements SealUseService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FlowExampleService flowExampleService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<SealUseVo> getPage(SealUseSelectDto dto) {
|
|
|
+ IWrapper<SealUse> wrapper = getWrapper();
|
|
|
+
|
|
|
+ wrapper.keyword(dto.getKeyword(),
|
|
|
+ new SqlField("su", SealUse::getCode),
|
|
|
+ new SqlField("c.code")
|
|
|
+ );
|
|
|
+ wrapper.eq("su", SealUse::getStatus, dto.getStatus());
|
|
|
+ wrapper.eq("su", SealUse::getIsReturned, dto.getIsReturned());
|
|
|
+
|
|
|
+ wrapper.orderByDesc("su", SealUse::getId);
|
|
|
+ Page<SealUseVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ List<SealUseVo> records = page.getRecords();
|
|
|
+ setInfo(records);
|
|
|
+
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public SealUseVo detail(Long id) {
|
|
|
+ SealUse SealUse = this.getById(id);
|
|
|
+ SealUseVo result = BeanUtil.toBean(SealUse, SealUseVo.class);
|
|
|
+
|
|
|
+ setInfo(Arrays.asList(result));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ void setInfo(List<SealUseVo> records) {
|
|
|
+ if (ObjectUtil.isEmpty(records)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserUtil.assignmentNickName(records, SealUseVo::getCreateUser, SealUseVo::setCreateUserName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DSTransactional
|
|
|
+ @Override
|
|
|
+ public void addOrEdit(SealUseDto sealUseDto) {
|
|
|
+ this.save(sealUseDto);
|
|
|
+ ObsFileUtil.editFile(sealUseDto.getFileList(), sealUseDto.getId(), 10);
|
|
|
+ ObsFileUtil.editFile(sealUseDto.getCompanyFileList(), sealUseDto.getId(), 20);
|
|
|
+ ObsFileUtil.editFile(sealUseDto.getCustomerFileList(), sealUseDto.getId(), 30);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delete(Long id) {
|
|
|
+ this.removeById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void returned(SealUseDto dto) {
|
|
|
+ this.update(q -> q
|
|
|
+ .eq(SealUse::getId, dto.getId())
|
|
|
+ .set(SealUse::getIsReturned, 1)
|
|
|
+ .set(SealUse::getRealityReturnedTime, dto.getRealityReturnedTime())
|
|
|
+ .set(BasePo::getUpdateTime, new Date())
|
|
|
+ .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void cancellation(Long businessId) {
|
|
|
+ SealUse byId = getById(businessId);
|
|
|
+ this.update(q -> q
|
|
|
+ .eq(SealUse::getId, businessId)
|
|
|
+ .set(SealUse::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())
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+}
|