需求计划撤回

This commit is contained in:
cwchen 2025-03-24 09:11:26 +08:00
parent 3a597acbd4
commit c47dff7eb7
7 changed files with 70 additions and 3 deletions

View File

@ -151,4 +151,17 @@ public class CarNeedPlanController {
return service.deleteNeedPlanData(dto.getData());
}
/**
* 需求计划撤回
* @param dto
* @return ServerResponse
* @author cwchen
* @date 2025/3/21 18:17
*/
@PostMapping("withdrawData")
@DecryptAndVerify(decryptedClass = CarNeedPlanVo.class)
public ServerResponse withdrawData(EncryptedReq<CarNeedPlanVo> dto){
return service.withdrawData(dto.getData());
}
}

View File

@ -1,11 +1,17 @@
package com.bonus.gzcar.business.backstage.controller;
import com.bonus.gzcar.manager.common.util.JwtUtils;
import com.bonus.gzcar.manager.webResult.ServerResponse;
import io.jsonwebtoken.Claims;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* @className:HealthController
* @author:cwchen
@ -25,7 +31,15 @@ public class HealthController {
* @date 2024/11/27 16:37
*/
@GetMapping("isHealth")
public ServerResponse getApplyPlanList() {
return ServerResponse.createBySuccessMsg("合法");
public ServerResponse getApplyPlanList(HttpServletRequest request) {
Map<String, Object> map = new HashMap<>();
String authorization = request.getHeader("authorization");
System.err.println(authorization);
Claims claims = JwtUtils.parseToken(authorization);
map.put("username",claims.get("username"));
map.put("id",claims.get("user_id"));
map.put("orgId",claims.get("ORG_ID"));
map.put("companyId",claims.get("COMPANY_ID"));
return ServerResponse.createSuccess("合法",map);
}
}

View File

@ -12,6 +12,9 @@ public class AuditStatusUtil {
* @return
*/
public static String getAuditStatus(int status,int statusType){
if(status == 0 && statusType == 0){
return "已撤回";
}
if(statusType==1){
return "已通过";
}else if(statusType==2){

View File

@ -110,4 +110,13 @@ public interface CarNeedPlanMapper {
* @return
*/
int getPlanCodeNum(CarNeedPlanVo vo);
/**
* 需求计划撤回
* @param dto
* @return void
* @author cwchen
* @date 2025/3/23 16:23
*/
void withdrawData(CarNeedPlanVo dto);
}

View File

@ -68,4 +68,13 @@ public interface CarNeedPlanService{
* @return
*/
ServerResponse getNeedPlanInfo(CarNeedPlanVo data);
/**
* 需求计划撤回
* @param data
* @return ServerResponse
* @author cwchen
* @date 2025/3/23 16:22
*/
ServerResponse withdrawData(CarNeedPlanVo data);
}

View File

@ -13,10 +13,12 @@ import com.bonus.gzcar.manager.advice.ValidatorsUtils;
import com.bonus.gzcar.manager.common.util.DateTimeHelper;
import com.bonus.gzcar.manager.common.util.StringHelper;
import com.bonus.gzcar.manager.common.util.UserUtil;
import com.bonus.gzcar.manager.security.entity.SelfUserEntity;
import com.bonus.gzcar.manager.webResult.ServerResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
@ -350,5 +352,18 @@ public class CarNeedPlanServiceImpl implements CarNeedPlanService{
return year+num;
}
@Override
public ServerResponse withdrawData(CarNeedPlanVo dto) {
try {
// 计划申请 status 0 status_type0 表示撤回
// 审批记录 status 0 status_type-1 表示撤回
mapper.withdrawData(dto);
recordService.addRecord(dto.getId(),"0","-1","4","","0");
return ServerResponse.createBySuccessMsg("撤回成功");
} catch (Exception e) {
log.error(e.toString(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ServerResponse.createErroe("撤回失败");
}
}
}

View File

@ -40,6 +40,10 @@
update car_plan_details set model_id=#{modelId}, need_num=#{needNum}, need_day=#{needDay}, remark=#{remark}
where id=#{id}
</update>
<!--需求计划撤回-->
<update id="withdrawData">
UPDATE car_plan_apply SET status = '0',status_type = '0' WHERE id=#{id}
</update>
<delete id="deleteDetails">
delete from car_plan_details
where id in(