联调问题

This commit is contained in:
马三炮 2025-12-26 15:38:11 +08:00
parent 89045e34dc
commit 44c4bc3032
7 changed files with 36 additions and 10 deletions

View File

@ -48,9 +48,9 @@ public class DayPlanController extends BaseController {
//新增日计划
@PreAuthorize("@ss.hasPermi('day:plan:add')")
@PostMapping("/addDayPlan")
public AjaxResult addMonthlyPlan(@RequestBody DayPlanVo dayPlanVo) {
public AjaxResult addMonthlyPlan(@RequestBody List<DayPlanVo> dayPlanVoList) {
try {
int res = dayPlanService.addMonthlyPlan(dayPlanVo);
int res = dayPlanService.addMonthlyPlan(dayPlanVoList);
if (res > 0) {
return AjaxResult.success();
} else {

View File

@ -51,9 +51,12 @@ public class InspectionStationController extends BaseController {
{
try {
int res = inspectionStationService.addInspectionStation(inspectionStationVo);
if (res > 0) {
if (res == 1) {
return AjaxResult.success();
}else {
} else if (res == 2) {
return AjaxResult.error("名称已经存在");
}
else {
return AjaxResult.error("新增失败");
}
}catch (Exception e) {
@ -89,8 +92,10 @@ public class InspectionStationController extends BaseController {
{
try {
int res = inspectionStationService.updateInspectionStation(inspectionStationVo);
if (res > 0) {
if (res == 1) {
return AjaxResult.success();
} else if (res == 2) {
return AjaxResult.error("名称已经存在");
}else {
return AjaxResult.error("修改失败");
}

View File

@ -26,4 +26,6 @@ public interface InspectionStationMapper {
int updateInspectionStation(InspectionStationVo inspectionStationVo);
InspectionStationVo getInspectionStationDetail(InspectionStationVo inspectionStationVo);
InspectionStationVo getInspectionStation(InspectionStationVo inspectionStationVo);
}

View File

@ -13,7 +13,7 @@ import java.util.List;
*/
public interface DayPlanService {
int addMonthlyPlan(DayPlanVo dayPlanVo);
int addMonthlyPlan(List<DayPlanVo> dayPlanVo);
int delDayPlan(DayPlanVo dayPlanVo);

View File

@ -7,6 +7,7 @@ import com.bonus.digital.dao.WorkloadSummaryExcelVo;
import com.bonus.digital.mapper.DayPlanMapper;
import com.bonus.digital.service.DayPlanService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
@ -21,11 +22,16 @@ import java.util.List;
public class DayPlanServiceImpl implements DayPlanService {
@Resource
private DayPlanMapper dayPlanMapper;
@Override
public int addMonthlyPlan(DayPlanVo dayPlanVo) {
dayPlanVo.setCreateUser(SecurityUtils.getUserId().toString());
dayPlanVo.setCreateTime(new Date());
return dayPlanMapper.addMonthlyPlan(dayPlanVo);
@Transactional
public int addMonthlyPlan(List<DayPlanVo> dayPlanVo) {
for (DayPlanVo dayPlanVo1 : dayPlanVo) {
dayPlanVo1.setCreateUser(SecurityUtils.getUserId().toString());
dayPlanVo1.setCreateTime(new Date());
dayPlanMapper.addMonthlyPlan(dayPlanVo1);
}
return 1;
}
@Override

View File

@ -40,6 +40,10 @@ public class InspectionStationServiceImpl implements InspectionStationService {
Long userId = SecurityUtils.getUserId();
inspectionStationVo.setCreateUser(userId.toString());
inspectionStationVo.setCreateTime(new Date());
InspectionStationVo res = inspectionStationMapper.getInspectionStation(inspectionStationVo);
if (res != null) {
return 2;
}
return inspectionStationMapper.addInspectionStation(inspectionStationVo);
}
@ -59,6 +63,10 @@ public class InspectionStationServiceImpl implements InspectionStationService {
Long userId = SecurityUtils.getUserId();
inspectionStationVo.setUpdateUser(userId.toString());
inspectionStationVo.setUpdateTime(new Date());
InspectionStationVo res = inspectionStationMapper.getInspectionStation(inspectionStationVo);
if (res != null && inspectionStationVo.getInspectionStationId()!=res.getInspectionStationId()) {
return 2;
}
return inspectionStationMapper.updateInspectionStation(inspectionStationVo);
}
}

View File

@ -40,4 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select inspection_station_id,inspection_station_name,remark,category
from tb_inspection_station where inspection_station_name = #{inspectionStationName} and is_active = '1'
</select>
<select id="getInspectionStation" resultType="com.bonus.digital.dao.InspectionStationVo">
select inspection_station_id,inspection_station_name,remark,category
from tb_inspection_station where category = #{category} and is_active = '1' and
inspection_station_name = #{inspectionStationName}
</select>
</mapper>