|
@@ -0,0 +1,67 @@
|
|
|
|
+package com.jeeplus.test.proofread.service;
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
|
+import com.jeeplus.sys.utils.UserUtils;
|
|
|
|
+import com.jeeplus.test.proofread.domain.ProofreadIssued;
|
|
|
|
+import com.jeeplus.test.proofread.mapper.ProofreadIssuedMapper;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.UUID;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class ProofreadIssuedService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ProofreadIssuedMapper mapper;
|
|
|
|
+
|
|
|
|
+ public String save(ProofreadIssued issued){
|
|
|
|
+ ProofreadIssued byId = findById(issued.getProjectId());
|
|
|
|
+ if (byId != null) {
|
|
|
|
+ update(issued);
|
|
|
|
+ return byId.getId();
|
|
|
|
+ } else {
|
|
|
|
+ return add(issued);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String add(ProofreadIssued issued) {
|
|
|
|
+ //获取当前登录人信息
|
|
|
|
+ UserDTO userDTO = UserUtils.getCurrentUserDTO();
|
|
|
|
+ String id = issued.getProjectId();
|
|
|
|
+ issued.setId(id);
|
|
|
|
+ issued.setCreateBy(userDTO.getId());
|
|
|
|
+ issued.setCreateDate(new Date());
|
|
|
|
+ issued.setUpdateBy(userDTO.getId());
|
|
|
|
+ issued.setUpdateDate(new Date());
|
|
|
|
+ issued.setDelFlag(0);
|
|
|
|
+ mapper.insert(issued);
|
|
|
|
+ return id;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void update(ProofreadIssued issued) {
|
|
|
|
+ //获取当前登录人信息
|
|
|
|
+ UserDTO userDTO = UserUtils.getCurrentUserDTO();
|
|
|
|
+ issued.setUpdateBy(userDTO.getId());
|
|
|
|
+ issued.setUpdateDate(new Date());
|
|
|
|
+ LambdaQueryWrapper<ProofreadIssued> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(ProofreadIssued::getProjectId, issued.getProjectId());
|
|
|
|
+ mapper.update(issued, wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public ProofreadIssued findById(String id) {
|
|
|
|
+ ProofreadIssued issued = mapper.findById(id);
|
|
|
|
+ return issued;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public ProofreadIssued findProjectInfoById(String id) {
|
|
|
|
+ ProofreadIssued issued = mapper.findProjectInfoById(id);
|
|
|
|
+ return issued;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void updateStatusById(ProofreadIssued issued) {
|
|
|
|
+ mapper.updateStatusById(issued.getId(), issued.getStatus());
|
|
|
|
+ }
|
|
|
|
+}
|