|
|
@@ -22,6 +22,9 @@ import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.transaction.support.TransactionTemplate;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -66,6 +69,9 @@ public class YztServiceImpl implements IYztService {
|
|
|
private TReportSubMapper tReportSubMapper;
|
|
|
@Autowired
|
|
|
private TReportMapper tReportMapper;
|
|
|
+ @Autowired
|
|
|
+ private TransactionTemplate transactionTemplate;
|
|
|
+
|
|
|
|
|
|
@Value("${decimalPlaces}")
|
|
|
private String decimalPlaces;
|
|
|
@@ -528,6 +534,7 @@ public class YztServiceImpl implements IYztService {
|
|
|
return RequestResult.error("删除失败!", null);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
@Override
|
|
|
public RequestResult modeldetailupdate(tModelDetail modeldetail) {
|
|
|
try {
|
|
|
@@ -545,7 +552,7 @@ public class YztServiceImpl implements IYztService {
|
|
|
//TODO wanger 根据类型生成查询语句
|
|
|
String querywhere = typeDto.getQuerywhere();
|
|
|
if ("tbbhlx".equals(relationship)) {//TODO wanger 处理图斑变化类型过滤
|
|
|
- String where = " " +querywhere + " ";
|
|
|
+ String where = " " + querywhere + " ";
|
|
|
if ("=".equals(relationshipkey)) {
|
|
|
where += " in (";
|
|
|
} else if ("!=".equals(relationshipkey)) {
|
|
|
@@ -578,7 +585,13 @@ public class YztServiceImpl implements IYztService {
|
|
|
} else {
|
|
|
modeldetail.setId(StringUtils.getUUID());
|
|
|
modeldetail.setCjsj(new Date());
|
|
|
- tModelDetailMapper.insert(modeldetail);
|
|
|
+ transactionTemplate.execute(status -> {
|
|
|
+ tModelDetailMapper.insert(modeldetail);
|
|
|
+ // 立即提交
|
|
|
+ status.flush();
|
|
|
+ return null;
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
return RequestResult.success("修改成功!", 1);
|
|
|
} catch (Exception e) {
|
|
|
@@ -1241,7 +1254,7 @@ public class YztServiceImpl implements IYztService {
|
|
|
sqlwhere += ",";
|
|
|
groupwhere += ",";
|
|
|
}
|
|
|
- if(StringUtils.isEmpty(sub)){
|
|
|
+ if (StringUtils.isEmpty(sub)) {
|
|
|
continue;
|
|
|
}
|
|
|
QueryWrapper<tReportSub> subwrapper = new QueryWrapper();
|
|
|
@@ -1266,6 +1279,9 @@ public class YztServiceImpl implements IYztService {
|
|
|
}
|
|
|
String[] calcsub = report.getCalctotal().split(",");
|
|
|
for (String sub : calcsub) {
|
|
|
+ if(StringUtils.isEmpty(sub)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if (StringUtils.isNotEmpty(sqlwhere)) {
|
|
|
sqlwhere += ",";
|
|
|
}
|
|
|
@@ -1495,6 +1511,17 @@ public class YztServiceImpl implements IYztService {
|
|
|
return RequestResult.error("查询失败!", 0);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public RequestResult checkQueryWhere(String tablename, String querywhere) {
|
|
|
+ try {
|
|
|
+ Integer count = yztMapper.checkQueryWhere(tablename, querywhere);
|
|
|
+ return RequestResult.success("成功!", count);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("失败!", 0);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RequestResult getChangeType(String type) {
|
|
|
try {
|