Commit 28dae16e by wangweidong

土工平台修改

parent 4b063362
...@@ -495,6 +495,14 @@ public class SoilSampleController extends ServiceController { ...@@ -495,6 +495,14 @@ public class SoilSampleController extends ServiceController {
} }
@ApiOperation(value = "样品调出", notes = "样品调出")
@PostMapping("/sample_bring_out")
public RestResult<Boolean> sampleBringOut(@RequestParam("ids")Long [] ids) {
return success(soilSampleService.sampleBringOut(ids,getAccount()));
}
/** /**
* 原始记录数据绑定 * 原始记录数据绑定
*/ */
......
...@@ -63,6 +63,8 @@ public interface ISoilSampleService extends IBaseService<SoilSample> { ...@@ -63,6 +63,8 @@ public interface ISoilSampleService extends IBaseService<SoilSample> {
boolean sampleRetain(Long[] ids,Long locationId,String location, Account account); boolean sampleRetain(Long[] ids,Long locationId,String location, Account account);
boolean sampleBringOut(Long[] ids,Account account);
boolean retainSampleTest(Long[] ids, Account account); boolean retainSampleTest(Long[] ids, Account account);
boolean importSample(MultipartFile file, Long entrustId, Account account); boolean importSample(MultipartFile file, Long entrustId, Account account);
......
...@@ -751,7 +751,7 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S ...@@ -751,7 +751,7 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S
} }
if (itemIndexMap.size()>0){ if (itemIndexMap.size()>0){
if (StringHandleUtils.isNumeric(cellValue0)|| !StringStaticDataUtils.importEntrustTitle.contains(cellValue0.trim())){ if (StringHandleUtils.isNumeric(cellValue0)|| !StringStaticDataUtils.importEntrustTitle.contains(cellValue0.trim())){
sampleInfoMap.put(cellValue0, Maps.newHashMap()); sampleInfoMap.put(cellValue0, Maps.newLinkedHashMap());
Map<String,String> mapInfo = sampleInfoMap.get(cellValue0); Map<String,String> mapInfo = sampleInfoMap.get(cellValue0);
for (int j = 0; j < lastCellNum; j++) { for (int j = 0; j < lastCellNum; j++) {
...@@ -1184,14 +1184,14 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S ...@@ -1184,14 +1184,14 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S
if (itemIndexMap.size()==0){ if (itemIndexMap.size()==0){
for (int j = 0; j < lastCellNum; j++) { for (int j = 0; j < lastCellNum; j++) {
XSSFCell cell= row.getCell(j); XSSFCell cell= row.getCell(j);
String cellValue = HSSFWorkbookUtil.getJavaValue(cell).toString().replace("\n","").replace(" ","").trim(); String cellValue = HSSFWorkbookUtil.getJavaValue(cell).toString().replace("\n","").replace("(","(").replace(")",")").replace(" ","").trim();
itemIndexMap.put(j,cellValue); itemIndexMap.put(j,cellValue);
} }
} }
} }
if (itemIndexMap.size()>0){ if (itemIndexMap.size()>0){
if (StringHandleUtils.isNumeric(cellValue0)|| !StringStaticDataUtils.importEntrustTitle.contains(cellValue0.trim())){ if (StringHandleUtils.isNumeric(cellValue0)|| !StringStaticDataUtils.importEntrustTitle.contains(cellValue0.trim())){
sampleInfoMap.put(cellValue0, Maps.newHashMap()); sampleInfoMap.put(cellValue0, Maps.newLinkedHashMap());
Map<String,String> mapInfo = sampleInfoMap.get(cellValue0); Map<String,String> mapInfo = sampleInfoMap.get(cellValue0);
for (int j = 0; j < lastCellNum; j++) { for (int j = 0; j < lastCellNum; j++) {
...@@ -1244,14 +1244,15 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S ...@@ -1244,14 +1244,15 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S
Map<String,String> itemMap=e.getValue(); Map<String,String> itemMap=e.getValue();
SoilSampleDTO sampleDTO = new SoilSampleDTO(); SoilSampleDTO sampleDTO = new SoilSampleDTO();
sampleDTO.setSiteNo("S-"+e.getKey()); sampleDTO.setSiteNo("S-"+e.getKey());
sampleDTO.setSampleDepth(itemMap.get("深度(m)")); sampleDTO.setSampleDepth(itemMap.get("深度(m)"));
sampleDTO.setSamplePack(itemMap.get("样品包装类型")); sampleDTO.setSamplePack(itemMap.get("样品包装类型"));
sampleDTO.setSampleDescribe(itemMap.get("土质描述")); sampleDTO.setSampleDescribe(itemMap.get("土质描述"));
List<SoilExperiment> experimentList = new ArrayList<>(); List<SoilExperiment> experimentList = new LinkedList<>();
int sn=1;
for (Map.Entry<String,String> s: itemMap.entrySet()) { for (Map.Entry<String,String> s: itemMap.entrySet()) {
String key = s.getKey(); String key = s.getKey();
String value = s.getValue(); String value = s.getValue();
if ("深度(m)".equals(key)){ if ("深度(m)".equals(key)){
continue; continue;
}else if ("样品包装类型".equals(key)){ }else if ("样品包装类型".equals(key)){
continue; continue;
...@@ -1276,9 +1277,12 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S ...@@ -1276,9 +1277,12 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S
experiment.setElName(soilAptitudeExp.getElName()); experiment.setElName(soilAptitudeExp.getElName());
experiment.setMainType(soilAptitudeExp.getMainType()); experiment.setMainType(soilAptitudeExp.getMainType());
experiment.setSmallType(soilAptitudeExp.getSmallType()); experiment.setSmallType(soilAptitudeExp.getSmallType());
} }
experiment.setOrderBy(sn);
experiment.setStatus(SoilExpStatusEnum.DRAFT); experiment.setStatus(SoilExpStatusEnum.DRAFT);
experiment.setProgress(SoilExpStatusEnum.DRAFT); experiment.setProgress(SoilExpStatusEnum.DRAFT);
sn++;
experimentList.add(experiment); experimentList.add(experiment);
} }
} }
......
...@@ -289,7 +289,7 @@ public class SoilSampleServiceImpl extends BaseServiceImpl<SoilSampleMapper, Soi ...@@ -289,7 +289,7 @@ public class SoilSampleServiceImpl extends BaseServiceImpl<SoilSampleMapper, Soi
List<Long> sampleIds = sampleVOList.stream().map(s->{ List<Long> sampleIds = sampleVOList.stream().map(s->{
return s.getId(); return s.getId();
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<SoilExperiment> experimentList = soilExperimentService.list(Condition.create().setSqlSelect("sample_id","name","short_name").in("sample_id",sampleIds)); List<SoilExperiment> experimentList = soilExperimentService.list(Condition.create().setSqlSelect("sample_id","name","short_name").in("sample_id",sampleIds).orderBy("sample_id").orderBy("order_by"));
if (CollectionUtils.isEmpty(experimentList)){ if (CollectionUtils.isEmpty(experimentList)){
return sampleVOList; return sampleVOList;
} }
...@@ -297,7 +297,7 @@ public class SoilSampleServiceImpl extends BaseServiceImpl<SoilSampleMapper, Soi ...@@ -297,7 +297,7 @@ public class SoilSampleServiceImpl extends BaseServiceImpl<SoilSampleMapper, Soi
Map<Long, Set<String>> shortNameMap = new HashMap<>(); Map<Long, Set<String>> shortNameMap = new HashMap<>();
for (SoilExperiment experiment:experimentList) { for (SoilExperiment experiment:experimentList) {
if (!nameMap.containsKey(experiment.getSampleId())){ if (!nameMap.containsKey(experiment.getSampleId())){
Set<String> set = new TreeSet<>(); Set<String> set = new LinkedHashSet<>();
set.add(experiment.getName()); set.add(experiment.getName());
nameMap.put(experiment.getSampleId(),set); nameMap.put(experiment.getSampleId(),set);
}else{ }else{
...@@ -305,8 +305,6 @@ public class SoilSampleServiceImpl extends BaseServiceImpl<SoilSampleMapper, Soi ...@@ -305,8 +305,6 @@ public class SoilSampleServiceImpl extends BaseServiceImpl<SoilSampleMapper, Soi
set.add(experiment.getName()); set.add(experiment.getName());
nameMap.put(experiment.getSampleId(),set); nameMap.put(experiment.getSampleId(),set);
} }
if (StringUtils.isBlank(experiment.getShortName())){ if (StringUtils.isBlank(experiment.getShortName())){
continue; continue;
} }
...@@ -702,6 +700,19 @@ public class SoilSampleServiceImpl extends BaseServiceImpl<SoilSampleMapper, Soi ...@@ -702,6 +700,19 @@ public class SoilSampleServiceImpl extends BaseServiceImpl<SoilSampleMapper, Soi
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean sampleBringOut(Long[] ids, Account account) {
RestAssert.fail(ArrayUtils.isEmpty(ids),"请选择试样");
SoilSample sample = new SoilSample();
sample.setStatus(SoilSampleStatusEnum.RECEIVE);
sample.setProgress(SoilSampleStatusEnum.RECEIVE);
soilSampleRecordService.record(SoilSampleStatusEnum.RETAIN,SoilSampleStatusEnum.RECEIVE,ids,0,account,"样品留存样调出");
return super.update(sample,Condition.create().in("id",ids));
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean retainSampleTest(Long[] ids, Account account) { public boolean retainSampleTest(Long[] ids, Account account) {
RestAssert.fail(ArrayUtils.isEmpty(ids),"请选择要接收的样品"); RestAssert.fail(ArrayUtils.isEmpty(ids),"请选择要接收的样品");
int count = super.count(Condition.create().in("id",ids).ne("status",SoilSampleStatusEnum.RETAIN)); int count = super.count(Condition.create().in("id",ids).ne("status",SoilSampleStatusEnum.RETAIN));
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
WHERE e.deleted = 0 WHERE e.deleted = 0
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
ORDER BY e.entrust_code DESC
</select> </select>
<select id="selectVOList" resultType="com.patzn.cloud.service.soil.vo.SoilEntrustVO"> <select id="selectVOList" resultType="com.patzn.cloud.service.soil.vo.SoilEntrustVO">
......
...@@ -61,6 +61,12 @@ ...@@ -61,6 +61,12 @@
</if> </if>
</sql> </sql>
<sql id="eWhere">
<if test="null!=vo.boreholeName">
AND e.borehole_name LIKE CONCAT('%',#{vo.boreholeName},'%')
</if>
</sql>
<select id="selectVOList" resultType="com.patzn.cloud.service.soil.vo.SoilSampleVO"> <select id="selectVOList" resultType="com.patzn.cloud.service.soil.vo.SoilSampleVO">
SELECT <include refid="sColumn"/>,<include refid="eColumn"/>, SELECT <include refid="sColumn"/>,<include refid="eColumn"/>,
o.receive_location,o.receiver,o.receive_time,o.sender,o.send_time,o.make_time,o.maker o.receive_location,o.receiver,o.receive_time,o.sender,o.send_time,o.make_time,o.maker
...@@ -69,6 +75,7 @@ ...@@ -69,6 +75,7 @@
JOIN soil_entrust e ON s.entrust_id = e.id JOIN soil_entrust e ON s.entrust_id = e.id
WHERE s.deleted = 0 AND e.deleted = 0 WHERE s.deleted = 0 AND e.deleted = 0
<include refid="sWhere"/> <include refid="sWhere"/>
<include refid="eWhere"/>
<if test="vo.haveExp!=null"> <if test="vo.haveExp!=null">
<if test="vo.haveExp == 0"> <if test="vo.haveExp == 0">
AND (SELECT COUNT(1) FROM soil_experiment WHERE deleted = 0 AND sample_id = s.id )=0 AND (SELECT COUNT(1) FROM soil_experiment WHERE deleted = 0 AND sample_id = s.id )=0
...@@ -78,6 +85,11 @@ ...@@ -78,6 +85,11 @@
</if> </if>
</if> </if>
<if test="vo.groupId!=null">
AND (SELECT COUNT(1) FROM soil_experiment WHERE deleted = 0 AND sample_id = s.id AND group_id = #{vo.groupId} ) > 0
</if>
<if test="null!=vo.experimentNames"> <if test="null!=vo.experimentNames">
AND ((SELECT COUNT(1) FROM soil_experiment WHERE deleted = 0 AND sample_id = s.id AND name LIKE AND ((SELECT COUNT(1) FROM soil_experiment WHERE deleted = 0 AND sample_id = s.id AND name LIKE
CONCAT('%',#{vo.experimentNames},'%') )>0 CONCAT('%',#{vo.experimentNames},'%') )>0
......
ALTER TABLE "public"."soil_experiment"
ALTER TABLE "public"."soil_experiment"
ADD COLUMN "order_by" int2;
COMMENT ON COLUMN "public"."soil_experiment"."order_by" IS '排序';
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment