白蚁-日志-bug修改
parent
aba8027886
commit
b22aad5ae8
|
|
@ -14,6 +14,8 @@ import com.gunshi.project.hsz.service.ByLogService;
|
|||
import com.gunshi.project.hsz.service.FileAssociationsService;
|
||||
import com.gunshi.project.hsz.validate.markers.Insert;
|
||||
import com.gunshi.project.hsz.validate.markers.Update;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.service.impl.SysUserServiceImpl;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
|
@ -42,21 +44,18 @@ public class ByLogController extends AbstractCommonFileController {
|
|||
@Autowired
|
||||
private FileAssociationsService fileService;
|
||||
|
||||
@Autowired
|
||||
private SysUserServiceImpl sysUserService;
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ByLog> insert(@Validated(Insert.class) @RequestBody ByLog dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
List<ByLogDetail> byLogDetails = dto.getDetails();
|
||||
byLogDetails.forEach(detail -> {
|
||||
detail.setId(IdWorker.getId());
|
||||
detail.setByLogId(dto.getId());
|
||||
});
|
||||
boolean save = byLogService.save(dto);
|
||||
boolean flag2 = byLogDetailService.saveBatch(byLogDetails);
|
||||
if (save && flag2) {
|
||||
|
||||
boolean flag = byLogService.saveData(dto);
|
||||
if (flag) {
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getId().toString());
|
||||
}
|
||||
return R.ok(save && flag2 ? dto : null);
|
||||
return R.ok(flag? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public interface ByLogDetailMapper extends BaseMapper<ByLogDetail> {
|
|||
|
||||
@Select("""
|
||||
<script>
|
||||
select t1.id,t1.by_log_id,t1.pre_place_detail_id as ppdi,t1.pre_person,t1.pre_method,t1.pre_effect,
|
||||
select t1.id,t1.by_log_id,t1.pre_place_detail_id as ppdi,t1.pre_person,t1.pre_method,t1.pre_effect,t1.pre_person_name
|
||||
t2.detail_name as ppdn,t3.id as ppi,t3.pre_name as ppn
|
||||
from by_log_detail t1
|
||||
join pre_place_detail t2
|
||||
|
|
@ -31,7 +31,7 @@ public interface ByLogDetailMapper extends BaseMapper<ByLogDetail> {
|
|||
List<ByLogDetail> selectDetail(@Param("logId") Long id,@Param("dto") ByLogPageSo pageSo);
|
||||
|
||||
@Select("""
|
||||
select t1.id,t1.by_log_id,t1.pre_place_detail_id as ppdi,t1.pre_person,t1.pre_method,t1.pre_effect,
|
||||
select t1.id,t1.by_log_id,t1.pre_place_detail_id as ppdi,t1.pre_person,t1.pre_method,t1.pre_effect,t1.pre_person_name
|
||||
t2.detail_name as ppdn,t3.id as ppi,t3.pre_name as ppn
|
||||
from by_log_detail t1
|
||||
join pre_place_detail t2
|
||||
|
|
|
|||
|
|
@ -54,6 +54,11 @@ public class ByLogDetail {
|
|||
@Schema(description = "防治人员id")
|
||||
private String prePerson;
|
||||
|
||||
|
||||
@TableField(value = "pre_person_name")
|
||||
@Schema(description = "防治人员名称")
|
||||
private String prePersonName;
|
||||
|
||||
@TableField(value = "pre_method")
|
||||
@Schema(description = "防治方法")
|
||||
private String preMethod;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ import com.gunshi.project.hsz.entity.so.ByLogPageSo;
|
|||
import com.gunshi.project.hsz.mapper.ByLogDetailMapper;
|
||||
import com.gunshi.project.hsz.mapper.ByLogMapper;
|
||||
import com.gunshi.project.hsz.model.*;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.executor.BatchResult;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
|
|
@ -37,6 +38,9 @@ public class ByLogService extends ServiceImpl<ByLogMapper, ByLog> {
|
|||
@Autowired
|
||||
private ByLogDetailMapper byLogDetailMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
public boolean update(ByLog dto) {
|
||||
ByLog byId = getById(dto.getId());
|
||||
if(Objects.isNull(byId)){
|
||||
|
|
@ -46,6 +50,13 @@ public class ByLogService extends ServiceImpl<ByLogMapper, ByLog> {
|
|||
List<ByLogDetail> byLogDetails = dto.getDetails();
|
||||
byLogDetails.forEach(detail -> {
|
||||
detail.setId(IdWorker.getId());
|
||||
detail.setByLogId(dto.getId());
|
||||
if(detail.getPrePerson() != null){
|
||||
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(detail.getPrePerson()));
|
||||
if(sysUser != null){
|
||||
detail.setPrePersonName(sysUser.getNickName());
|
||||
}
|
||||
}
|
||||
});
|
||||
LambdaQueryWrapper<ByLogDetail> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
//先删除,再新增
|
||||
|
|
@ -112,6 +123,23 @@ public class ByLogService extends ServiceImpl<ByLogMapper, ByLog> {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean saveData(ByLog dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
List<ByLogDetail> byLogDetails = dto.getDetails();
|
||||
byLogDetails.forEach(detail -> {
|
||||
detail.setId(IdWorker.getId());
|
||||
detail.setByLogId(dto.getId());
|
||||
if(detail.getPrePerson() != null){
|
||||
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(detail.getPrePerson()));
|
||||
if(sysUser != null){
|
||||
detail.setPrePersonName(sysUser.getNickName());
|
||||
}
|
||||
}
|
||||
});
|
||||
boolean save = save(dto);
|
||||
List<BatchResult> insert = byLogDetailMapper.insert(byLogDetails);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private static class StyleGroup {
|
||||
|
|
@ -285,7 +313,7 @@ public class ByLogService extends ServiceImpl<ByLogMapper, ByLog> {
|
|||
private void fillDetailInfo(Row row, ByLogDetail detail, CellStyle style) {
|
||||
createCell(row, 6, detail.getPpdn(), style); // 防治部位
|
||||
createCell(row, 7, detail.getPpn(), style); // 防治点
|
||||
createCell(row, 8, detail.getPrePerson(), style); // 防治人员
|
||||
createCell(row, 8, detail.getPrePersonName(), style); // 防治人员
|
||||
createCell(row, 9, detail.getPreMethod(), style); // 防治方法
|
||||
createCell(row, 10, detail.getPreEffect(), style); // 防治效果
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue