Commit faefeaf7 authored by 竹天卫's avatar 竹天卫

bug 修改 优化

parent 063439e4
......@@ -7,6 +7,7 @@ import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.service.IChinastdService;
import cn.wise.sc.cement.business.service.IChinastdcodeService;
import cn.wise.sc.cement.business.util.RedisUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -120,25 +121,47 @@ public class ChinastdController {
return BaseResponse.okData(iChinastdcodeService.list());
}
@Autowired
RedisUtil redisUtil;
@PostMapping("/run/sh")
@ApiOperation("手动触发更新")
public void run() throws IOException {
/*final String shUrl = "/usr/bin/python3 /opt/chinastd_spider.py";
Runtime.getRuntime().exec(shUrl);*/
//todo 启用线程 run()
try {
Process pro = Runtime.getRuntime().exec("/opt/chinastd_spider.sh");
Process pro = Runtime.getRuntime().exec("sh /opt/chinastd_spider.sh");
InputStream in = pro.getInputStream();
BufferedReader read = new BufferedReader(new InputStreamReader(in));
String line = null;
while((line = read.readLine())!=null){
System.out.println("#################标准查新"+line);
redisUtil.setString("bzcx", line);
}
pro.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
@GetMapping("/getBZCXResult")
@ApiOperation("获取标准查新的结果值 用于判断是否更新成功")
public BaseResponse getBZCXResult() {
try {
String bzcxResult = redisUtil.getString("bzcx").toString();
return BaseResponse.okMsg("成功");
} catch (Exception e) {
e.printStackTrace();
}
return BaseResponse.errorMsg("失败");
}
}
......@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
......@@ -38,13 +39,43 @@ public class EntityEnclosureController {
private static final Logger logger = LoggerFactory.getLogger("EntityEnclosureController");
@Autowired
@Resource
protected HttpServletResponse response;
@Autowired
protected HttpServletRequest request;
@Autowired
private ISysUserService userService;
/**
* 判断文件大小
*
* @param len
* 文件长度
* @param size
* 限制大小
* @param unit
* 限制单位(B,K,M,G)
* @return
*/
public static boolean checkFileSize(Long len, int size, String unit) {
// long len = file.length();
double fileSize = 0;
if ("B".equals(unit.toUpperCase())) {
fileSize = (double) len;
} else if ("K".equals(unit.toUpperCase())) {
fileSize = (double) len / 1024;
} else if ("M".equals(unit.toUpperCase())) {
fileSize = (double) len / 1048576;
} else if ("G".equals(unit.toUpperCase())) {
fileSize = (double) len / 1073741824;
}
if (fileSize > size) {
return false;
}
return true;
}
@ApiOperation(value = "单个文件上传")
@PostMapping("/fileUpLoad")
public BaseResponse fileUpLoad(MultipartFile file) {
......@@ -53,6 +84,10 @@ public class EntityEnclosureController {
String fileName = null;
String extName = null;
try {
boolean ref = checkFileSize( file.getSize(),30,"M");
if(!ref){
return BaseResponse.errorMsg("文件不能大于30M");
}
LoginUser loginUser = userService.getLoginUser();
if (loginUser != null) {
filePath = FastDFSUtils.uploadPic(file.getBytes(), file.getOriginalFilename(), file.getSize());
......@@ -90,6 +125,10 @@ public class EntityEnclosureController {
String fileName = null;
String extName = null;
try {
boolean ref = checkFileSize( file.getSize(),30,"M");
if(!ref){
return BaseResponse.errorMsg("文件不能大于30M");
}
LoginUser loginUser = userService.getLoginUser();
if (loginUser != null) {
if (!FileTypeUtil.isImageByExtension(file.getOriginalFilename())) {
......@@ -129,6 +168,10 @@ public class EntityEnclosureController {
if (loginUser != null) {
if (files != null && files.size() > 0) {
for (MultipartFile file : files) {
boolean ref = checkFileSize( file.getSize(),30,"M");
if(!ref){
return BaseResponse.errorMsg("文件不能大于30M");
}
Map<String, Object> mapSub = new HashMap<>();
filePath = FastDFSUtils.uploadPic(file.getBytes(), file.getOriginalFilename(), file.getSize());
fileName = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf("."));
......
......@@ -99,4 +99,7 @@ public class Entrust implements Serializable {
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("是否置顶(1置顶,0取消置顶)")
private Integer isTop;
}
......@@ -50,9 +50,12 @@ public class Sample implements Serializable {
@ApiModelProperty("样品照片")
private String samplePhoto;
@ApiModelProperty("样品重量(kg)")
@ApiModelProperty("样品重量")
private BigDecimal weight;
@ApiModelProperty("样品重量计量单位(1微克,2毫克,3克,4千克,5吨)")
private Integer weightType;
@ApiModelProperty("(检测依据编号) 例子:01、23、15")
private String methodNumbers;
......
......@@ -49,9 +49,12 @@ public class SampleTmp implements Serializable {
@ApiModelProperty("样品照片")
private String samplePhoto;
@ApiModelProperty("样品重量(g)")
@ApiModelProperty("样品重量")
private BigDecimal weight;
@ApiModelProperty("样品重量计量单位(1微克,2毫克,3克,4千克,5吨)")
private Integer weightType;
@ApiModelProperty("(检测依据编号) 例子:01、23、15")
private String methodNumbers;
......
......@@ -59,7 +59,7 @@
left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id
<include refid="where"/>
order by e.is_urgent desc, e.update_time desc
order by e.is_urgent desc, e.is_top desc, e.update_time desc
</select>
......@@ -101,7 +101,7 @@
left join sys_user su on su.id = e.user_id
,(select @i:=0)aa
<include refid="where"/>
order by 序号,e.is_urgent desc, e.update_time desc
order by 序号,e.is_urgent desc, e.is_top desc, e.update_time desc
</select>
......@@ -149,7 +149,7 @@
END
) as statusValue,
p.id as projectId, p.name as projectName, p.code as projectCode,
su.name as userName
su.name as userName, e.is_urgent as isUrgent
from sample_handle t
left join sys_user su on su.id = t.user_id
left join sample s on s.id = t.sample_id
......@@ -185,7 +185,7 @@
END
) as statusValue,
p.id as projectId, p.name as projectName, p.code as projectCode,
su.name as userName
su.name as userName, e.is_urgent as isUrgent
from sample_distribution t
left join sys_user su on su.id = t.user_id
left join sample s on s.id = t.sample_id
......
......@@ -33,9 +33,12 @@ public class SampleQuery {
@ApiModelProperty("样品照片")
private String samplePhoto;
@ApiModelProperty("样品重量(kg)")
@ApiModelProperty("样品重量")
private BigDecimal weight;
@ApiModelProperty("样品重量计量单位(1微克,2毫克,3克,4千克,5吨)")
private Integer weightType;
@ApiModelProperty("(检测依据编号) 例子:01、23、15")
private String methodNumbers;
......
......@@ -2,7 +2,9 @@ package cn.wise.sc.cement.business.model.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import sun.java2d.loops.GeneralRenderer;
import java.math.BigDecimal;
import java.time.LocalDate;
......@@ -34,9 +36,12 @@ public class SampleTmpQuery {
@ApiModelProperty("样品照片")
private String samplePhoto;
@ApiModelProperty("样品重量(g)")
@ApiModelProperty("样品重量")
private BigDecimal weight;
@ApiModelProperty("样品重量计量单位(1微克,2毫克,3克,4千克,5吨)")
private Integer weightType;
@ApiModelProperty("(检测依据编号) 例子:01、23、15")
private String methodNumbers;
......
......@@ -36,9 +36,12 @@ public class SampleTmpVo {
@ApiModelProperty("样品照片")
private String samplePhoto;
@ApiModelProperty("样品重量(g)")
@ApiModelProperty("样品重量")
private BigDecimal weight;
@ApiModelProperty("样品重量计量单位(1微克,2毫克,3克,4千克,5吨)")
private Integer weightType;
@ApiModelProperty("(检测依据编号) 例子:01、23、15")
private String methodNumbers;
......
......@@ -39,9 +39,12 @@ public class SampleVo {
@ApiModelProperty("样品照片")
private String samplePhoto;
@ApiModelProperty("样品重量(g)")
@ApiModelProperty("样品重量")
private BigDecimal weight;
@ApiModelProperty("样品重量计量单位(1微克,2毫克,3克,4千克,5吨)")
private Integer weightType;
@ApiModelProperty("(检测依据编号) 例子:01、23、15")
private String methodNumbers;
......
......@@ -302,14 +302,17 @@ public class CommonServiceImpl {
countMap.put(name, CheckCountUtil.checkCount(name, resultMap));
}else if(name.equals("焦渣")){
countMap.put(name, CheckCountUtil.checkCount(name, resultMap));
}else if(name.equals("St,ad")){
countMap.put(name, CheckCountUtil.checkCount(name, resultMap));
}else if(name.equals("易磨性")){
countMap.put(name, CheckCountUtil.countYMXGrade(resultMap));
}else if(name.equals("易磨性校验码")){
countMap.put(name, CheckCountUtil.countYMXCode(resultMap));
}
/*else if(name.equals("St,ad")){
countMap.put(name, CheckCountUtil.checkCount(name, resultMap));
}*/
}
......
......@@ -228,10 +228,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
String msg = "";
if (entrust.getCreateTime().isEqual(entrust.getUpdateTime())) {
entrust.setUpdateTime(LocalDateTime.now());
entrust.setUpdateTime(LocalDateTime.now())
.setIsTop(1);
msg = "置顶成功";
} else {
entrust.setUpdateTime(entrust.getCreateTime());
entrust.setUpdateTime(entrust.getCreateTime())
.setIsTop(0);
msg = "取消置顶成功";
}
entrustMapper.updateById(entrust);
......@@ -266,6 +268,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (query.getSendPhone().length() > 15) {
return BaseResponse.errorMsg("送样人电话过长");
}
if(query.getRemark().length() > 1000){
return BaseResponse.errorMsg("备注信息过长");
}
Entrust entrust = new Entrust();
BeanUtils.copyProperties(query, entrust);
//生成委托编号
......@@ -278,7 +284,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.setIsDistribution(0)
.setCreateTime(LocalDateTime.now())
.setUpdateTime(entrust.getCreateTime())
.setSampleNum(query.getSampleTmpList().size());
.setSampleNum(query.getSampleTmpList().size())
.setIsTop(0);
entrustMapper.insert(entrust);
if (query.getSampleTmpList() != null && query.getSampleTmpList().size() > 0) {
List<SampleTmp> sampleTmpList = new ArrayList<>();
......@@ -1080,7 +1087,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
entrust.setStatus(1).setProjectType(query.getProjectType());
//审批后生成委托编号
String entrustCode = entrust.getProjectCode()+"_"+query.getSampleList().get(0).getCementCode();
String entrustCode = entrust.getProjectCode()+"-"+query.getSampleList().get(0).getCementCode();
entrust.setEntrustCode(entrustCode);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "修改评审状态为“通过”", null);
//*****************************以上为评审接口******************
......@@ -1134,8 +1141,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
queryWrapper.eq("assess_id", handle.getId());
queryWrapper.eq("type", 0);
queryWrapper.eq("status", 1);
NormProduction normProduction = iNormProductionService.getOne(queryWrapper);
if(normProduction == null){
List<NormProduction> normProduction = iNormProductionService.list(queryWrapper);
if(normProduction == null || normProduction.size() != 1){
//评审未通过,删除评审后的样品
sampleMapper.deleteBatchIds(sampleList);
//还原本所编号最大值
......@@ -1342,6 +1349,16 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
LocalDateTime acceptTime = sampleHandleMapper.getNo1AcceptTime(sample.getId());
entrustVo.setAcceptTime(acceptTime);
}
//列表中的样品数量只展示关联到处理人的样品数量
Map<String, Object> paramHander = new HashMap<>();
paramHander.put("id", entrustVo.getId());
paramHander.put("userId", loginUser.getId());
List<SampleHandleVo> sampleHandleList = sampleHandleMapper.getSampleHandleList(paramHander);
if(sampleHandleList != null ){
entrustVo.setSampleNum(sampleHandleList.size());
}else{
entrustVo.setSampleNum(0);
}
entrustVo.setHandleNames(handleNames);
entrustVo.setSampleNames(sampleNames);
}
......@@ -1655,9 +1672,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
queryWrapper.eq("assess_id", distributionTeamQuery.getTeamGroupId());
queryWrapper.eq("type", 1);
queryWrapper.eq("status", 1);
NormProduction normProduction = iNormProductionService.getOne(queryWrapper);
if(normProduction == null){
return BaseResponse.errorMsg("联系管理员.配置产值信息!");
List<NormProduction> normProduction = iNormProductionService.list(queryWrapper);
if(normProduction == null || normProduction.size() != 1){
TeamGroup teamGroup = teamGroupMapper.selectById(distributionTeamQuery.getTeamGroupId());
return BaseResponse.errorMsg("联系管理员.配置检测组名称为"+teamGroup.getName()+"产值信息!");
}
//消息推送
BaseResponse wrapper = userMessageService.sendMessage(distributionTeamQuery.getUserId(), "您有一条样品检测信息等待接受",entrust.getId(), SysUserMessage.MessageType.ENTRUST);
......@@ -1743,6 +1761,28 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
entrustVo.setCheckTeam(checkTeam);
entrustVo.setCheckMethodNumber(sample.getMethodNumbers());
}
//列表中的样品数量只展示关联到检测人的样品数量
List<Sample> sampleCheckList = sampleMapper.getSampleCheckList(entrustVo.getId());
List<SampleVo> sampleVoList = new ArrayList<>();
if (sampleCheckList != null && sampleCheckList.size() > 0) {
for (Sample sample : sampleCheckList) {
SampleVo sampleVo = new SampleVo();
BeanUtils.copyProperties(sample, sampleVo);
List<SampleDistributionTeamVo> sampleDistributionTeamVoList =
distributionMapper.getDistributionTeamList(sample.getId(), loginUser.getId());
if (sampleDistributionTeamVoList != null && sampleDistributionTeamVoList.size() > 0) {
sampleVoList.add(sampleVo);
}
}
}
if(sampleVoList != null ){
entrustVo.setSampleNum(sampleVoList.size());
}else{
entrustVo.setSampleNum(0);
}
entrustVo.setSampleNames(sampleNames);
}
}
......
......@@ -375,12 +375,14 @@ public class CheckCountUtil {
endResult = getBigDecimal(resultMap.get("焦渣特征").trim());
}
}else if(name.equals("St,ad")){
}
/*else if(name.equals("St,ad")){
if( StringUtils.isNotBlank(resultMap.get("显示值"))
){
endResult = getBigDecimal(resultMap.get("显示值").trim());
}
}
}*/
return endResult==null?"":endResult.toString();
}
......
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