ocr和施工日志bug修复
This commit is contained in:
parent
73370c8af0
commit
b256bf7729
@ -624,8 +624,8 @@ public class QueryGenerator {
|
||||
return true;
|
||||
}
|
||||
Field field = ReflectUtil.getField(searchObj.getClass(), name);
|
||||
Object queryEndTime = AnnotationUtil.getAnnotationValue(field, TableField.class, "exist");
|
||||
return !Objects.equals(queryEndTime, false);
|
||||
Object exist = AnnotationUtil.getAnnotationValue(field, TableField.class, "exist");
|
||||
return !Objects.equals(exist, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -19,10 +19,7 @@ import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.EnvironmentUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.jsqlparser.JSQLParserException;
|
||||
import net.sf.jsqlparser.expression.Alias;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.Parenthesis;
|
||||
import net.sf.jsqlparser.expression.StringValue;
|
||||
import net.sf.jsqlparser.expression.*;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
||||
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
|
||||
@ -63,6 +60,9 @@ public class DataScopeHandler implements DataPermissionHandler {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private UserEnterpriseServiceImpl userEnterpriseService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IOcrBuildLogService ocrBuildLogService;
|
||||
|
||||
@Override
|
||||
public Expression getSqlSegment(Expression where, String mappedStatementId) {
|
||||
@ -136,10 +136,6 @@ public class DataScopeHandler implements DataPermissionHandler {
|
||||
//}
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IOcrBuildLogService ocrBuildLogService;
|
||||
|
||||
private PlainSelect dataScopeFilterByProject(PlainSelect plainSelect, UserInfo user, Object obj) {
|
||||
JSONObject jo = (JSONObject) obj;
|
||||
Object parameter = jo.get("parameter");
|
||||
@ -193,7 +189,27 @@ public class DataScopeHandler implements DataPermissionHandler {
|
||||
List<String> ids = ocrBuildLogService.getIdsIfSubProject().stream().map(Convert::toStr).collect(Collectors.toList());
|
||||
ids.add("0");
|
||||
for (String filterEnterprise : filterOcrBuildLogTables) {
|
||||
//( (xxx.id in ()) OR ( xxx.uploader_id = 123))
|
||||
InExpression inExpr = new InExpression();
|
||||
ItemsList itemsList = new ExpressionList(ids.stream().map(StringValue::new).collect(Collectors.toList()));
|
||||
inExpr.setLeftExpression(new Column(filterEnterprise));
|
||||
inExpr.setRightItemsList(itemsList);
|
||||
inExpression(filterEnterprise, ids, plainSelect);
|
||||
// 假设这是你的inExpression方法返回的表达式
|
||||
|
||||
EqualsTo equalsExpr = new EqualsTo();
|
||||
equalsExpr.setLeftExpression(new Column(StrUtil.subBefore(filterEnterprise, ".", false) + "." + "uploader_id"));
|
||||
equalsExpr.setRightExpression(new LongValue(SecurityUtils.getUser().getUserId()));
|
||||
// 创建OR表达式组合两者
|
||||
OrExpression orExpr = new OrExpression(inExpr, equalsExpr);
|
||||
// 将整个OR表达式添加到WHERE子句中
|
||||
if (plainSelect.getWhere() == null) {
|
||||
plainSelect.setWhere(orExpr);
|
||||
} else {
|
||||
// 如果已有WHERE条件,可能需要用AND连接
|
||||
AndExpression andExpr = new AndExpression(plainSelect.getWhere(), orExpr);
|
||||
plainSelect.setWhere(andExpr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
package com.zhgd.xmgl.modules.ocr.controller;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrBuildLog;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.dto.OcrBuildLogDto;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.vo.OcrBuildLogForMonthVo;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.vo.OcrBuildLogVo;
|
||||
import com.zhgd.xmgl.modules.ocr.service.IOcrBuildLogService;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@ -19,8 +25,8 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@ -35,93 +41,123 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Api(tags = "ocr施工日志相关Api")
|
||||
public class OcrBuildLogController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IOcrBuildLogService ocrBuildLogService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IOcrBuildLogService ocrBuildLogService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "分页查询", operDesc = "分页列表查询ocr施工日志信息")
|
||||
@ApiOperation(value = "分页列表查询ocr施工日志信息", notes = "分页列表查询ocr施工日志信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<OcrBuildLogVo>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(ocrBuildLogService.queryPageList(param));
|
||||
}
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "分页查询", operDesc = "分页列表查询ocr施工日志信息")
|
||||
@ApiOperation(value = "分页列表查询ocr施工日志信息", notes = "分页列表查询ocr施工日志信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "type", value = "类型:1:项目日志;2:个人日志;", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<OcrBuildLogVo>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(ocrBuildLogService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "列表查询", operDesc = "列表查询ocr施工日志信息")
|
||||
@ApiOperation(value = "列表查询ocr施工日志信息", notes = "列表查询ocr施工日志信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OcrBuildLogVo>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(ocrBuildLogService.queryList(param));
|
||||
}
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "列表查询", operDesc = "列表查询ocr施工日志信息")
|
||||
@ApiOperation(value = "列表查询ocr施工日志信息", notes = "列表查询ocr施工日志信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OcrBuildLogVo>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(ocrBuildLogService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ocrBuildLogDto
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "添加", operDesc = "添加ocr施工日志信息")
|
||||
@ApiOperation(value = "添加ocr施工日志信息", notes = "添加ocr施工日志信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<OcrBuildLogVo> add(@RequestBody @Validate OcrBuildLogDto ocrBuildLogDto) {
|
||||
ocrBuildLogService.add(ocrBuildLogDto);
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ocrBuildLogDto
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "添加", operDesc = "添加ocr施工日志信息")
|
||||
@ApiOperation(value = "添加ocr施工日志信息", notes = "添加ocr施工日志信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<OcrBuildLogVo> add(@RequestBody @Validate OcrBuildLogDto ocrBuildLogDto) {
|
||||
ocrBuildLogService.add(ocrBuildLogDto);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ocrBuildLogDto
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "编辑", operDesc = "编辑ocr施工日志信息")
|
||||
@ApiOperation(value = "编辑ocr施工日志信息", notes = "编辑ocr施工日志信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<OcrBuildLog> edit(@RequestBody OcrBuildLogDto ocrBuildLogDto) {
|
||||
ocrBuildLogService.edit(ocrBuildLogDto);
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ocrBuildLogDto
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "编辑", operDesc = "编辑ocr施工日志信息")
|
||||
@ApiOperation(value = "编辑ocr施工日志信息", notes = "编辑ocr施工日志信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<OcrBuildLog> edit(@RequestBody OcrBuildLogDto ocrBuildLogDto) {
|
||||
ocrBuildLogService.edit(ocrBuildLogDto);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "删除", operDesc = "删除ocr施工日志信息")
|
||||
@ApiOperation(value = "删除ocr施工日志信息", notes = "删除ocr施工日志信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "ocr施工日志ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<OcrBuildLog> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
ocrBuildLogService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "删除", operDesc = "删除ocr施工日志信息")
|
||||
@ApiOperation(value = "删除ocr施工日志信息", notes = "删除ocr施工日志信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "ocr施工日志ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<OcrBuildLog> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
ocrBuildLogService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "通过id查询", operDesc = "通过id查询ocr施工日志信息")
|
||||
@ApiOperation(value = "通过id查询ocr施工日志信息", notes = "通过id查询ocr施工日志信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "ocr施工日志ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<OcrBuildLogVo> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(ocrBuildLogService.queryById(id));
|
||||
}
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "通过id查询", operDesc = "通过id查询ocr施工日志信息")
|
||||
@ApiOperation(value = "通过id查询ocr施工日志信息", notes = "通过id查询ocr施工日志信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "ocr施工日志ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<OcrBuildLogVo> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(ocrBuildLogService.queryById(id));
|
||||
}
|
||||
|
||||
@OperLog(operModul = "ocr施工日志管理", operType = "", operDesc = "统计某月每天的ocr施工日志")
|
||||
@ApiOperation(value = "统计某月每天的ocr施工日志", notes = "统计某月每天的ocr施工日志", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "yearMonth", value = "年月,如2022-10", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "type", value = "类型:1:项目日志;2:个人日志;", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/countOcrBuildLogForMonth")
|
||||
public Result<List<OcrBuildLogForMonthVo>> countOcrBuildLogForMonth(@ApiIgnore @RequestBody HashMap<String, Object> param) {
|
||||
List<OcrBuildLogForMonthVo> vos = new ArrayList<>();
|
||||
Integer type = MapUtils.getInteger(param, "type");
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
String yearMonth = MapUtils.getString(param, "yearMonth");
|
||||
Map<Date, List<OcrBuildLog>> dateListMap = ocrBuildLogService.list(new LambdaQueryWrapper<OcrBuildLog>()
|
||||
.eq(OcrBuildLog::getProjectSn, projectSn)
|
||||
.eq(Objects.equals(type, 2), OcrBuildLog::getUploaderId, SecurityUtils.getUser().getUserId())
|
||||
.ge(OcrBuildLog::getDate, yearMonth + "-01")
|
||||
.le(OcrBuildLog::getDate, yearMonth + "-31")
|
||||
).stream().collect(Collectors.groupingBy(OcrBuildLog::getDate));
|
||||
List<DateTime> dateTimes = DateUtil.rangeToList(DateUtil.parseDate(yearMonth + "-01"), DateUtil.endOfMonth(DateUtil.parseDate(yearMonth + "-01")), DateField.DAY_OF_YEAR);
|
||||
for (DateTime dateTime : dateTimes) {
|
||||
OcrBuildLogForMonthVo vo = new OcrBuildLogForMonthVo();
|
||||
vo.setDate(DateUtil.formatDateTime(dateTime));
|
||||
vo.setNum(Optional.ofNullable(dateListMap.get(dateTime)).map(List::size).orElse(0));
|
||||
vos.add(vo);
|
||||
}
|
||||
return Result.success(vos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -29,11 +29,6 @@ public class OcrBuildLog implements Serializable {
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 类型:1:项目日志;2:个人日志;
|
||||
*/
|
||||
@ApiModelProperty(value = "类型:1:项目日志;2:个人日志;")
|
||||
private java.lang.Integer type;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@ -115,4 +110,10 @@ public class OcrBuildLog implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "所属项目SN")
|
||||
private java.lang.String projectSn;
|
||||
/**
|
||||
* 上传人id
|
||||
*/
|
||||
@ApiModelProperty(value = "上传人id")
|
||||
private java.lang.Long uploaderId;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.zhgd.xmgl.modules.ocr.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OcrBuildLogForMonthVo {
|
||||
private String date;
|
||||
private Integer num;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.ocr.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrBuildLog;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -38,5 +39,17 @@ public class OcrBuildLogVo extends OcrBuildLog {
|
||||
*/
|
||||
@ApiModelProperty(value = "监理人员名称s")
|
||||
private java.lang.String supervisionPersonnelNames;
|
||||
/**
|
||||
* 类型:1:项目日志;2:个人日志;
|
||||
*/
|
||||
@ApiModelProperty(value = "类型:1:项目日志;2:个人日志;")
|
||||
@TableField(exist = false)
|
||||
private java.lang.Integer type;
|
||||
|
||||
/**
|
||||
* 上传人名称
|
||||
*/
|
||||
@ApiModelProperty(value = "上传人名称")
|
||||
private java.lang.String uploaderName;
|
||||
|
||||
}
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
package com.zhgd.xmgl.modules.ocr.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrZonePlace;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.vo.OcrZonePlaceVo;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.dto.OcrZonePlaceDto;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrZonePlace;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.vo.OcrZonePlaceVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: ocr识别区域位置
|
||||
|
||||
@ -4,7 +4,9 @@
|
||||
<select id="queryList" resultType="com.zhgd.xmgl.modules.ocr.entity.vo.OcrBuildLogVo">
|
||||
select * from (
|
||||
select t.*
|
||||
,su.real_name as uploader_name
|
||||
from ocr_build_log t
|
||||
left join system_user su on su.user_id=t.uploader_id
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrBuildLog;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrBuildLogEnterprise;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.dto.OcrBuildLogDto;
|
||||
@ -23,19 +24,18 @@ import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.service.IEnterpriseInfoService;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||
import com.zhgd.xmgl.modules.worker.service.impl.UserEnterpriseServiceImpl;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.EntityUtils;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -51,6 +51,9 @@ public class OcrBuildLogServiceImpl extends ServiceImpl<OcrBuildLogMapper, OcrBu
|
||||
IEnterpriseInfoService enterpriseInfoService;
|
||||
@Autowired
|
||||
IOcrBuildLogEnterpriseService ocrBuildLogEnterpriseService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
SystemUserServiceImpl systemUserService;
|
||||
@Autowired
|
||||
private OcrBuildLogMapper ocrBuildLogMapper;
|
||||
@Lazy
|
||||
@ -79,7 +82,11 @@ public class OcrBuildLogServiceImpl extends ServiceImpl<OcrBuildLogMapper, OcrBu
|
||||
}
|
||||
|
||||
private QueryWrapper<OcrBuildLogVo> getQueryWrapper(HashMap<String, Object> param) {
|
||||
QueryWrapper<OcrBuildLogVo> queryWrapper = QueryGenerator.initPageQueryWrapper(OcrBuildLogVo.class, param, true);
|
||||
Integer type = MapUtils.getInteger(param, "type");
|
||||
if (Objects.equals(type, 2)) {
|
||||
param.put("uploaderId", SecurityUtils.getUser().getUserId());
|
||||
}
|
||||
QueryWrapper<OcrBuildLogVo> queryWrapper = QueryGenerator.initPageQueryWrapper(OcrBuildLogVo.class, param, false);
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(OcrBuildLogVo::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
@ -130,6 +137,7 @@ public class OcrBuildLogServiceImpl extends ServiceImpl<OcrBuildLogMapper, OcrBu
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(OcrBuildLogDto ocrBuildLogDto) {
|
||||
ocrBuildLogDto.setId(null);
|
||||
ocrBuildLogDto.setUploaderId(SecurityUtils.getUser().getUserId());
|
||||
baseMapper.insert(ocrBuildLogDto);
|
||||
saveConstructionUnitIds(ocrBuildLogDto);
|
||||
}
|
||||
|
||||
@ -1,25 +1,33 @@
|
||||
package com.zhgd.xmgl.modules.ocr.service.impl;
|
||||
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrZonePlace;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.vo.OcrZonePlaceVo;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.dto.OcrZonePlaceDto;
|
||||
import com.zhgd.xmgl.modules.ocr.mapper.OcrZonePlaceMapper;
|
||||
import com.zhgd.xmgl.modules.ocr.service.IOcrZonePlaceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrConfig;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrModulePlace;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.OcrZonePlace;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.dto.OcrZonePlaceDto;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.vo.OcrConfigVo;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.vo.OcrModulePlaceVo;
|
||||
import com.zhgd.xmgl.modules.ocr.entity.vo.OcrZonePlaceVo;
|
||||
import com.zhgd.xmgl.modules.ocr.mapper.OcrZonePlaceMapper;
|
||||
import com.zhgd.xmgl.modules.ocr.service.IOcrConfigService;
|
||||
import com.zhgd.xmgl.modules.ocr.service.IOcrModulePlaceService;
|
||||
import com.zhgd.xmgl.modules.ocr.service.IOcrZonePlaceService;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: ocr识别区域位置
|
||||
@ -31,6 +39,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
public class OcrZonePlaceServiceImpl extends ServiceImpl<OcrZonePlaceMapper, OcrZonePlace> implements IOcrZonePlaceService {
|
||||
@Autowired
|
||||
private OcrZonePlaceMapper ocrZonePlaceMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IOcrModulePlaceService ocrModulePlaceService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IOcrConfigService ocrConfigService;
|
||||
|
||||
@Override
|
||||
public IPage<OcrZonePlaceVo> queryPageList(HashMap<String, Object> param) {
|
||||
@ -59,16 +73,41 @@ public class OcrZonePlaceServiceImpl extends ServiceImpl<OcrZonePlaceMapper, Ocr
|
||||
|
||||
@Override
|
||||
public void add(OcrZonePlaceDto ocrZonePlaceDto) {
|
||||
checkExist(ocrZonePlaceDto);
|
||||
ocrZonePlaceDto.setId(null);
|
||||
baseMapper.insert(ocrZonePlaceDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否存在区域编码
|
||||
*
|
||||
* @param ocrZonePlaceDto
|
||||
*/
|
||||
private void checkExist(OcrZonePlaceDto ocrZonePlaceDto) {
|
||||
OcrModulePlaceVo placeVo = ocrModulePlaceService.queryById(String.valueOf(ocrZonePlaceDto.getModulePlaceId()));
|
||||
OcrConfigVo ocrConfigVo = ocrConfigService.queryById(String.valueOf(placeVo.getConfigId()));
|
||||
OcrConfig enableConfig = ocrConfigService.getEnableConfig(new MapBuilder<String, Object>()
|
||||
.put("headquartersSn", ocrConfigVo.getHeadquartersSn())
|
||||
.build());
|
||||
List<Long> pids = ocrModulePlaceService.list(new LambdaQueryWrapper<OcrModulePlace>()
|
||||
.eq(OcrModulePlace::getConfigId, enableConfig.getId())).stream().map(OcrModulePlace::getId).collect(Collectors.toList());
|
||||
int count = this.count(new LambdaQueryWrapper<OcrZonePlace>()
|
||||
.ne(ocrZonePlaceDto.getId() != null, OcrZonePlace::getId, ocrZonePlaceDto.getId())
|
||||
.eq(OcrZonePlace::getZoneCode, ocrZonePlaceDto.getZoneCode())
|
||||
.in(OcrZonePlace::getModulePlaceId, pids)
|
||||
);
|
||||
if (count > 0) {
|
||||
throw new OpenAlertException("区域编码已存在");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(OcrZonePlaceDto ocrZonePlaceDto) {
|
||||
OcrZonePlace oldOcrZonePlace = baseMapper.selectById(ocrZonePlaceDto.getId());
|
||||
if (oldOcrZonePlace == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
checkExist(ocrZonePlaceDto);
|
||||
baseMapper.updateById(ocrZonePlaceDto);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user