app接口
This commit is contained in:
parent
24d777675f
commit
4ba1a81a42
|
|
@ -0,0 +1,149 @@
|
|||
package com.bonus.aqgqj.app.controller;
|
||||
|
||||
import com.bonus.aqgqj.annotation.DecryptAndVerify;
|
||||
import com.bonus.aqgqj.annotation.LogAnnotation;
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.app.service.SamplesManageAppService;
|
||||
import com.bonus.aqgqj.system.vo.EncryptedReq;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 收样管理--app
|
||||
* @author hay
|
||||
*/
|
||||
@Api(tags = "收样管理")
|
||||
@RestController
|
||||
@RequestMapping("/app/samples/")
|
||||
public class SamplesManageAppController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("adminLogger");
|
||||
|
||||
@Autowired
|
||||
private SamplesManageAppService samplesManageAppService;
|
||||
|
||||
@PostMapping(value = "getList")
|
||||
@DecryptAndVerify(decryptedClass = SamplesManageAppVo.class)
|
||||
@LogAnnotation(operModul = "app收样管理", operation = "查询列表", operDesc = "业务级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:samples:query')" )
|
||||
public ServerResponse getList(EncryptedReq<SamplesManageAppVo> data) {
|
||||
try {
|
||||
List<SamplesManageAppVo> list = samplesManageAppService.list(data.getData());
|
||||
return ServerResponse.createSuccess(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
@PostMapping(value = "getDetailsList")
|
||||
@DecryptAndVerify(decryptedClass = SamplesManageAppVo.class)
|
||||
@LogAnnotation(operModul = "app收样管理", operation = "收样管理详情", operDesc = "业务级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:samples:query')" )
|
||||
public ServerResponse getDetailsList(EncryptedReq<SamplesManageAppVo> data) {
|
||||
try {
|
||||
List<SamplesManageAppVo> list = samplesManageAppService.getDetailsList(data.getData());
|
||||
return ServerResponse.createSuccess(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
@PostMapping(value = "getSampleLabelData")
|
||||
@DecryptAndVerify(decryptedClass = SamplesManageAppVo.class)
|
||||
@LogAnnotation(operModul = "app收样管理", operation = "收样标签", operDesc = "业务级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:samples:query')" )
|
||||
public ServerResponse getSampleLabelData(EncryptedReq<SamplesManageAppVo> data) {
|
||||
try {
|
||||
SamplesManageAppVo list = samplesManageAppService.getSampleLabelData(data.getData());
|
||||
return ServerResponse.createSuccess(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
@PostMapping(value = "allCustomName")
|
||||
@LogAnnotation(operModul = "收样管理", operation = "查询所有单位", operDesc = "业务级事件",operType="查询")
|
||||
public ServerResponse getAllCustomName() {
|
||||
try {
|
||||
List<SamplesManageAppVo> list = samplesManageAppService.getAllCustomName();
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 新增收样数据
|
||||
*/
|
||||
@PostMapping("addSamples")
|
||||
@DecryptAndVerify(decryptedClass = SamplesManageAppVo.class)
|
||||
@LogAnnotation(operModul = "收样管理", operation = "新增收样数据", operDesc = "业务级事件", operType = "新增")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:samples:add')")
|
||||
public ServerResponse addSamples(EncryptedReq<SamplesManageAppVo> vo) {
|
||||
try {
|
||||
return samplesManageAppService.addSamples(vo.getData());
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 派工
|
||||
*/
|
||||
@PostMapping("dispatchWork")
|
||||
@DecryptAndVerify(decryptedClass = SamplesManageAppVo.class)
|
||||
@LogAnnotation(operModul = "收样管理", operation = "派工", operDesc = "业务级事件", operType = "新增")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:samples:dispatch')")
|
||||
public ServerResponse dispatchWork(EncryptedReq<SamplesManageAppVo> vo) {
|
||||
try {
|
||||
return samplesManageAppService.dispatchWork(vo.getData());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "getDeptSelectedById")
|
||||
@DecryptAndVerify(decryptedClass = SamplesManageAppVo.class)
|
||||
@LogAnnotation(operModul = "收样管理", operation = "根据单位id获取部门", operDesc = "业务级事件",operType="查询")
|
||||
public ServerResponse getDeptSelectedById(EncryptedReq<SamplesManageAppVo> data) {
|
||||
try {
|
||||
List<SamplesManageAppVo> list = samplesManageAppService.getDeptSelectedById(data.getData());
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
@PostMapping(value = "getAuthority")
|
||||
@DecryptAndVerify(decryptedClass = SamplesManageAppVo.class)
|
||||
@LogAnnotation(operModul = "收样管理", operation = "查询是否具有派工/收样权限", operDesc = "业务级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:samples:query')" )
|
||||
public ServerResponse getAuthority(EncryptedReq<SamplesManageAppVo> data) {
|
||||
try {
|
||||
Boolean res = samplesManageAppService.getAuthority(data.getData());
|
||||
return ServerResponse.createSuccess(res);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.bonus.aqgqj.app.controller;
|
||||
|
||||
import com.bonus.aqgqj.annotation.DecryptAndVerify;
|
||||
import com.bonus.aqgqj.annotation.LogAnnotation;
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.app.service.SelectAppService;
|
||||
import com.bonus.aqgqj.base.entity.SelectEntity;
|
||||
import com.bonus.aqgqj.system.service.SelectService;
|
||||
import com.bonus.aqgqj.system.vo.EncryptedReq;
|
||||
import com.bonus.aqgqj.system.vo.dto.SelectDto;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 下拉选控制器
|
||||
* @author hay
|
||||
* @date 2024/8/1 17:13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/select/")
|
||||
@Slf4j
|
||||
public class SelectAppController {
|
||||
|
||||
@Resource(name = "SelectAppService")
|
||||
private SelectAppService service;
|
||||
|
||||
/**
|
||||
* 查询所有工器具
|
||||
*/
|
||||
@PostMapping(value = "getToolsSelect")
|
||||
public ServerResponse getToolsSelect() {
|
||||
try {
|
||||
List<SamplesManageAppVo> list = service.getToolsSelect();
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有试验班组
|
||||
*/
|
||||
@PostMapping(value = "getTestTeamSelected")
|
||||
public ServerResponse getTestTeamSelected() {
|
||||
try {
|
||||
List<SamplesManageAppVo> list = service.getTestTeamSelected();
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.bonus.aqgqj.app.dao;
|
||||
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收样管理
|
||||
* @author: hay
|
||||
*/
|
||||
@Mapper
|
||||
public interface SamplesManageAppDao {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> list(SamplesManageAppVo bean);
|
||||
|
||||
/**
|
||||
* 获取工器具
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getSampleTools(Integer id);
|
||||
|
||||
/**
|
||||
* 获取详情列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> getDetailsList(SamplesManageAppVo data);
|
||||
|
||||
/**
|
||||
* 获取所有单位名称
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> getAllCustomName();
|
||||
|
||||
/**
|
||||
* 新增收样数据 tb_samples
|
||||
* @param SamplesManageAppVo
|
||||
* @return
|
||||
*/
|
||||
int addSamples(SamplesManageAppVo SamplesManageAppVo);
|
||||
|
||||
/**
|
||||
* 新增设备数据 tb_samples_device
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int addSamplesDevice(SamplesManageAppVo dto);
|
||||
|
||||
/**
|
||||
* 设备类型编码
|
||||
* @param sampleToolsId
|
||||
* @return
|
||||
*/
|
||||
String getDevTypeCodeById(Integer sampleToolsId);
|
||||
|
||||
/**
|
||||
* 获取设备编码
|
||||
* @param nowDate
|
||||
* @return
|
||||
*/
|
||||
String selectCustomerCode(String nowDate);
|
||||
|
||||
/**
|
||||
* 修改班组
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int updateTeamId(SamplesManageAppVo dto);
|
||||
|
||||
/**
|
||||
* 获取部门
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> getDeptSelectedById(SamplesManageAppVo data);
|
||||
|
||||
/**
|
||||
* 获取标签数据
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
SamplesManageAppVo getSampleLabelData(SamplesManageAppVo data);
|
||||
|
||||
/**
|
||||
* 获取实验项
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<ConfigItemsVo> getTestItemList(SamplesManageAppVo dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.aqgqj.app.dao;
|
||||
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.base.entity.SelectEntity;
|
||||
import com.bonus.aqgqj.basis.entity.vo.ExperDeviceVo;
|
||||
import com.bonus.aqgqj.system.vo.dto.SelectDto;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description APP下拉框
|
||||
* @author hay
|
||||
* @date 2024/8/1 17:30
|
||||
*/
|
||||
@Repository("SelectAppDao")
|
||||
public interface SelectAppDao {
|
||||
/**
|
||||
* 工器具下拉选
|
||||
* @return List<SamplesManageAppVo>
|
||||
*/
|
||||
List<SamplesManageAppVo> getToolsSelect();
|
||||
|
||||
/**
|
||||
* 获取所有试验班组
|
||||
* @return List<SamplesManageAppVo>
|
||||
*/
|
||||
List<SamplesManageAppVo> getTestTeamSelected();
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
package com.bonus.aqgqj.app.entity;
|
||||
|
||||
import com.bonus.aqgqj.base.entity.PageEntity;
|
||||
import com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工器具个体管理
|
||||
* @author hay
|
||||
*/
|
||||
@Data
|
||||
public class SamplesManageAppVo extends PageEntity {
|
||||
|
||||
private static final long serialVersionUID = -6525908145032868837L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String ids;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 送样单位id
|
||||
*/
|
||||
private Integer customId;
|
||||
|
||||
/**
|
||||
* 送样单位
|
||||
*/
|
||||
private String customName;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
private Integer departmentId;
|
||||
|
||||
/**
|
||||
* 送样部门
|
||||
*/
|
||||
private String sampleDepartment;
|
||||
|
||||
/**
|
||||
* 送样人
|
||||
*/
|
||||
private String sampleUser;
|
||||
|
||||
/**
|
||||
* 送样时间
|
||||
*/
|
||||
private String sampleTime;
|
||||
|
||||
/**
|
||||
* 送样设备id
|
||||
*/
|
||||
private Integer sampleToolsId;
|
||||
|
||||
/**
|
||||
* 送样设备
|
||||
*/
|
||||
private String sampleTools;
|
||||
|
||||
/**
|
||||
* 批次编号
|
||||
*/
|
||||
private String batchCode;
|
||||
|
||||
/**
|
||||
* 收样人
|
||||
*/
|
||||
private String collectSamplesUser;
|
||||
|
||||
/**
|
||||
* 收样时间
|
||||
*/
|
||||
private String collectSamplesTime;
|
||||
|
||||
/**
|
||||
* 班组Id
|
||||
*/
|
||||
private Integer teamId;
|
||||
|
||||
/**
|
||||
* 班组
|
||||
*/
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 派工时间
|
||||
*/
|
||||
private String dispatchTime;
|
||||
|
||||
/**
|
||||
* 设备编号 (手填/扫码)
|
||||
*/
|
||||
private String devCode;
|
||||
|
||||
/**
|
||||
* 设备类型编码
|
||||
*/
|
||||
private String devTypeCode;
|
||||
|
||||
/**
|
||||
* 客户自编号(设备编码--自动生成)
|
||||
*/
|
||||
private String customerCode;
|
||||
|
||||
/**
|
||||
* 生产厂家
|
||||
*/
|
||||
private String factoryName;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
private String manufactureDate;
|
||||
|
||||
/**
|
||||
* 设备规格
|
||||
*/
|
||||
private String devModule;
|
||||
|
||||
/**
|
||||
* 试验日期
|
||||
*/
|
||||
private String experTime;
|
||||
|
||||
/**
|
||||
* 下次试验日期
|
||||
*/
|
||||
private String nextExperTime;
|
||||
|
||||
/**
|
||||
* 试验人员
|
||||
*/
|
||||
private String experUser;
|
||||
|
||||
/**
|
||||
* 试验结论
|
||||
*/
|
||||
private String experConclu;
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
private String paramsList;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Integer createBy;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Integer updateBy;
|
||||
|
||||
/**
|
||||
* 试验项内容数量
|
||||
*/
|
||||
private Integer experItemNum;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
private Integer processStatus;
|
||||
|
||||
/**
|
||||
* 类型,用来区分是已派工还是未派工
|
||||
* 0:未派工 1:已派工
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 是否打印 0:未打印 1:已打印
|
||||
*/
|
||||
private Integer isPrint;
|
||||
|
||||
/**
|
||||
* 试验地址
|
||||
*/
|
||||
private String submitLocation;
|
||||
|
||||
/**
|
||||
* 试验项
|
||||
*/
|
||||
private List<ConfigItemsVo> configItemsVos;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.bonus.aqgqj.app.service;
|
||||
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收样管理
|
||||
* @author hay
|
||||
*/
|
||||
public interface SamplesManageAppService {
|
||||
/**
|
||||
* 查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> list(SamplesManageAppVo bean);
|
||||
|
||||
/**
|
||||
* 详情列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> getDetailsList(SamplesManageAppVo data);
|
||||
|
||||
/**
|
||||
* 单位列表
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> getAllCustomName();
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ServerResponse addSamples(SamplesManageAppVo data);
|
||||
|
||||
/**
|
||||
* 派工
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ServerResponse dispatchWork(SamplesManageAppVo data);
|
||||
|
||||
/**
|
||||
* 根据单位Id获取部门列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> getDeptSelectedById(SamplesManageAppVo data);
|
||||
|
||||
/**
|
||||
* 查询权限
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
Boolean getAuthority(SamplesManageAppVo data);
|
||||
|
||||
/**
|
||||
* 收样标签 信息获取
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
SamplesManageAppVo getSampleLabelData(SamplesManageAppVo data);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.aqgqj.app.service;
|
||||
|
||||
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.base.entity.SelectEntity;
|
||||
import com.bonus.aqgqj.system.vo.dto.SelectDto;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hay
|
||||
* app下拉选
|
||||
*/
|
||||
public interface SelectAppService {
|
||||
|
||||
/**
|
||||
* 获取工器具下拉选
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> getToolsSelect();
|
||||
|
||||
/**
|
||||
* 获取试验班组下拉选
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<SamplesManageAppVo> getTestTeamSelected();
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
package com.bonus.aqgqj.app.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.aqgqj.app.dao.SamplesManageAppDao;
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.app.service.SamplesManageAppService;
|
||||
import com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo;
|
||||
import com.bonus.aqgqj.basis.service.SamplesManageService;
|
||||
import com.bonus.aqgqj.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 收样管理
|
||||
* @author hay
|
||||
* @date 2024/7/20 16:10
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SamplesManageAppServiceImpl implements SamplesManageAppService {
|
||||
|
||||
|
||||
@Resource
|
||||
private SamplesManageAppDao samplesManageAppDao;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SamplesManageAppVo> list(SamplesManageAppVo bean) {
|
||||
List<SamplesManageAppVo> list = samplesManageAppDao.list(bean);
|
||||
for (SamplesManageAppVo dto : list){
|
||||
String sampleTools = samplesManageAppDao.getSampleTools(dto.getId());
|
||||
dto.setSampleTools(sampleTools);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SamplesManageAppVo> getDetailsList(SamplesManageAppVo data) {
|
||||
return samplesManageAppDao.getDetailsList(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有单位列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SamplesManageAppVo> getAllCustomName() {
|
||||
return samplesManageAppDao.getAllCustomName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse addSamples(SamplesManageAppVo data) {
|
||||
JSONArray jsonArray = JSONObject.parseArray(data.getParamsList());
|
||||
List<SamplesManageAppVo> SamplesManageAppVos = jsonArray.toJavaList(SamplesManageAppVo.class);
|
||||
if (SamplesManageAppVos.size() > 0){
|
||||
//先增加基础数据表,并返回Id
|
||||
Integer userId = Integer.parseInt(UserUtil.getLoginUser().getId().toString());
|
||||
SamplesManageAppVos.get(0).setCreateBy(userId);
|
||||
int re= samplesManageAppDao.addSamples(SamplesManageAppVos.get(0));
|
||||
if (re>0){
|
||||
//添加详情数据
|
||||
for (SamplesManageAppVo dto : SamplesManageAppVos){
|
||||
//查询设备类型编码
|
||||
if (dto.getSampleToolsId()!=null){
|
||||
String devTypeCode = samplesManageAppDao.getDevTypeCodeById(dto.getSampleToolsId());
|
||||
dto.setDevTypeCode(devTypeCode);
|
||||
}
|
||||
//生成设备编码
|
||||
String customerCode = customerCodeRule();
|
||||
dto.setCustomerCode(customerCode);
|
||||
dto.setId(SamplesManageAppVos.get(0).getId());
|
||||
dto.setCreateBy(userId);
|
||||
int res= samplesManageAppDao.addSamplesDevice(dto);
|
||||
if (res<=0){
|
||||
throw new RuntimeException("收样设备信息表添加失败");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new RuntimeException("收样单位信息表添加失败");
|
||||
}
|
||||
}else {
|
||||
throw new RuntimeException("未获取到数据");
|
||||
}
|
||||
return ServerResponse.createBySuccessMsg("上传成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单位Id获取部门列表
|
||||
*/
|
||||
@Override
|
||||
public List<SamplesManageAppVo> getDeptSelectedById(SamplesManageAppVo data) {
|
||||
List<SamplesManageAppVo> list = samplesManageAppDao.getDeptSelectedById(data);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getAuthority(SamplesManageAppVo data) {
|
||||
if (StringHelper.isNotEmpty(data.getName())){
|
||||
if ("派工".equals(data.getName())){
|
||||
return SystemUtils.isComprehensiveTeamLeader();
|
||||
}else if ("收样".equals(data.getName())){
|
||||
return (SystemUtils.isComprehensiveTeam() || SystemUtils.isComprehensiveTeamLeader());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收样标签
|
||||
*/
|
||||
@Override
|
||||
public SamplesManageAppVo getSampleLabelData(SamplesManageAppVo data) {
|
||||
//查询详情数据
|
||||
SamplesManageAppVo dto = samplesManageAppDao.getSampleLabelData(data);
|
||||
if (dto!=null){
|
||||
//查询试验项目
|
||||
List<ConfigItemsVo> itemList = samplesManageAppDao.getTestItemList(data);
|
||||
if (itemList.size()>0){
|
||||
dto.setConfigItemsVos(itemList);
|
||||
}
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse dispatchWork(SamplesManageAppVo data) {
|
||||
Integer userId = Integer.parseInt(UserUtil.getLoginUser().getId().toString());
|
||||
if (StringHelper.isNotEmpty(data.getIds())){
|
||||
//拆分用逗号分隔的数据
|
||||
String[] ids = data.getIds().split(",");
|
||||
for (String id : ids){
|
||||
SamplesManageAppVo dto = new SamplesManageAppVo();
|
||||
dto.setId(Integer.parseInt(id));
|
||||
dto.setTeamId(data.getTeamId());
|
||||
dto.setUpdateBy(userId);
|
||||
//更新班组数据
|
||||
int res = samplesManageAppDao.updateTeamId(dto);
|
||||
if (res<=0){
|
||||
throw new RuntimeException("派工失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ServerResponse.createBySuccessMsg("派工成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备编号--自动生成
|
||||
* 格式:SYYYYMMDD-XXX
|
||||
* S:表示收样编号的前缀
|
||||
* YYYY:年份(4位数字)
|
||||
* MM:月份(2位数字)
|
||||
* DD:日期(2位数字)
|
||||
* XXX:当天的收样序号(3位数字,按当天收样顺序递增)
|
||||
* 每天的设备收样编号从 001 开始,按收样顺序递增
|
||||
*/
|
||||
private String customerCodeRule() {
|
||||
String nowDate = DateTimeHelper.getNowYMD();
|
||||
//查询本日收样流水号
|
||||
String customerCode = samplesManageAppDao.selectCustomerCode(nowDate);
|
||||
if (StringHelper.isNotEmpty(customerCode)) {
|
||||
// 将字符串转换为整数
|
||||
int num = Integer.parseInt(customerCode);
|
||||
// 执行加一操作
|
||||
num++;
|
||||
// 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0
|
||||
customerCode = String.format("%03d", num);
|
||||
} else {
|
||||
customerCode = "001";
|
||||
}
|
||||
String code = "S" + nowDate + "-" + customerCode;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.aqgqj.app.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.aqgqj.app.dao.SelectAppDao;
|
||||
import com.bonus.aqgqj.app.entity.SamplesManageAppVo;
|
||||
import com.bonus.aqgqj.app.service.SelectAppService;
|
||||
import com.bonus.aqgqj.base.entity.SelectEntity;
|
||||
import com.bonus.aqgqj.basis.entity.vo.ExperDeviceVo;
|
||||
import com.bonus.aqgqj.system.dao.SelectDao;
|
||||
import com.bonus.aqgqj.system.service.SelectService;
|
||||
import com.bonus.aqgqj.system.vo.dto.SelectDto;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hay
|
||||
* 下拉选
|
||||
*/
|
||||
@Service("SelectAppService")
|
||||
@Slf4j
|
||||
public class SelectServiceAppImpl implements SelectAppService {
|
||||
|
||||
@Resource(name = "SelectAppDao")
|
||||
private SelectAppDao mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 获取工器具下拉选
|
||||
*/
|
||||
@Override
|
||||
public List<SamplesManageAppVo> getToolsSelect() {
|
||||
return mapper.getToolsSelect();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取试验班组下拉选
|
||||
*/
|
||||
@Override
|
||||
public List<SamplesManageAppVo> getTestTeamSelected() {
|
||||
return mapper.getTestTeamSelected();
|
||||
}
|
||||
}
|
||||
|
|
@ -157,9 +157,13 @@ public class SamplesManageServiceImpl implements SamplesManageService {
|
|||
|
||||
/**
|
||||
* 设备编号--自动生成
|
||||
* 生成规则:YYMMDDNNNN
|
||||
* YYMMDD:年月日
|
||||
* NNNN: 当天收样的流水号,采用四位数字,从0001开始,每天重新计数
|
||||
* 格式:SYYYYMMDD-XXX
|
||||
* S:表示收样编号的前缀
|
||||
* YYYY:年份(4位数字)
|
||||
* MM:月份(2位数字)
|
||||
* DD:日期(2位数字)
|
||||
* XXX:当天的收样序号(3位数字,按当天收样顺序递增)
|
||||
* 每天的设备收样编号从 001 开始,按收样顺序递增
|
||||
*/
|
||||
private String customerCodeRule() {
|
||||
String nowDate = DateTimeHelper.getNowYMD();
|
||||
|
|
@ -171,11 +175,11 @@ public class SamplesManageServiceImpl implements SamplesManageService {
|
|||
// 执行加一操作
|
||||
num++;
|
||||
// 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0
|
||||
customerCode = String.format("%04d", num);
|
||||
customerCode = String.format("%03d", num);
|
||||
} else {
|
||||
customerCode = "0001";
|
||||
customerCode = "001";
|
||||
}
|
||||
String code = nowDate + customerCode;
|
||||
String code = "S" + nowDate + "-" + customerCode;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,15 @@ public class DateTimeHelper {
|
|||
return format(new Date(), "MM");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getNowDays() {
|
||||
return format(new Date(), "DD");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前小时
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,182 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.aqgqj.app.dao.SamplesManageAppDao">
|
||||
<insert id="addSamples" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
||||
INSERT INTO tb_sample(custom_id,
|
||||
custom_name,
|
||||
sample_user,
|
||||
sample_time,
|
||||
create_time,
|
||||
create_user,
|
||||
sample_date)
|
||||
VALUES (#{customId},
|
||||
#{customName},
|
||||
#{sampleUser},
|
||||
#{sampleTime},
|
||||
NOW(),
|
||||
#{createBy},
|
||||
#{sampleTime})
|
||||
</insert>
|
||||
<insert id="addSamplesDevice">
|
||||
INSERT INTO tb_sample_device(sample_id,
|
||||
dev_type_name,
|
||||
dev_type_code,
|
||||
dev_module,
|
||||
dev_code,
|
||||
customer_code,
|
||||
department_id,
|
||||
sample_time,
|
||||
create_time,
|
||||
create_user)
|
||||
VALUES (#{id},
|
||||
#{sampleTools},
|
||||
#{devTypeCode},
|
||||
#{devModule},
|
||||
#{devCode},
|
||||
#{customerCode},
|
||||
#{departmentId},
|
||||
#{sampleTime},
|
||||
NOW(),
|
||||
#{createBy})
|
||||
</insert>
|
||||
<update id="updateTeamId">
|
||||
UPDATE tb_sample
|
||||
SET team_id = #{teamId},
|
||||
dispatch_time=NOW(),
|
||||
dispatch_user= #{updateBy},
|
||||
update_time=NOW(),
|
||||
update_user=#{updateBy}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="list" resultType="com.bonus.aqgqj.app.entity.SamplesManageAppVo">
|
||||
select
|
||||
ts.id,
|
||||
tc.custom_name AS customName,
|
||||
ts.sample_time AS sampleTime,
|
||||
ts.batch_code AS batchCode,
|
||||
tt.team_name AS teamName,
|
||||
ts.dispatch_time AS dispatchTime
|
||||
FROM
|
||||
tb_sample ts
|
||||
LEFT JOIN tb_custom tc ON tc.id = ts.custom_id
|
||||
LEFT JOIN tb_sample_device tsd on tsd.sample_id = ts.id
|
||||
LEFT JOIN tb_team tt ON tt.id = ts.team_id
|
||||
WHERE ts.del_flag = '0'
|
||||
<if test='type=="0"'>
|
||||
AND ts.team_id is null
|
||||
</if>
|
||||
<if test='type=="1"'>
|
||||
AND ts.team_id is not null
|
||||
</if>
|
||||
<if test="sampleTools != null and sampleTools != ''">
|
||||
and tsd.dev_type_name like concat('%',#{sampleTools}, '%')
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
tc.custom_name like concat('%', #{keyWord}, '%') OR
|
||||
ts.batch_code like concat('%', #{keyWord}, '%') OR
|
||||
tt.team_name like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY ts.id
|
||||
</select>
|
||||
<select id="getSampleTools" resultType="java.lang.String">
|
||||
SELECT GROUP_CONCAT(aa.dev_type_name SEPARATOR '、') AS sampleTools
|
||||
FROM (SELECT DISTINCT tsd.dev_type_name
|
||||
FROM tb_sample_device tsd
|
||||
LEFT JOIN tb_sample ts ON ts.id = tsd.sample_id
|
||||
WHERE tsd.sample_id = #{id}
|
||||
AND tsd.del_falg = '0') aa
|
||||
</select>
|
||||
<select id="getDetailsList" resultType="com.bonus.aqgqj.app.entity.SamplesManageAppVo">
|
||||
select
|
||||
tsd.id,
|
||||
tsd.dev_type_name as sampleTools,
|
||||
tsd.dev_module as devModule,
|
||||
tsd.sample_time as sampleTime,
|
||||
tc.custom_name as sampleDepartment,
|
||||
tsd.dev_code as devCode,
|
||||
tsd.customer_code as customerCode,
|
||||
tsd.is_print as isPrint
|
||||
from
|
||||
tb_sample_device tsd
|
||||
LEFT JOIN tb_sample ts on tsd.sample_id=ts.id
|
||||
LEFT JOIN tb_custom tc on tsd.department_id=tc.id and tc.del_flag=0
|
||||
where tsd.del_falg = 0
|
||||
and tsd.sample_id = #{id}
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
tsd.dev_type_name like concat('%',#{sampleTools}, '%') OR
|
||||
tsd.dev_code like concat('%', #{keyWord}, '%') OR
|
||||
tsd.customer_code like concat('%', #{keyWord}, '%') OR
|
||||
tsd.dev_module like concat('%', #{keyWord}, '%') OR
|
||||
tc.custom_name like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="getAllCustomName" resultType="com.bonus.aqgqj.app.entity.SamplesManageAppVo">
|
||||
SELECT id,
|
||||
custom_name AS name
|
||||
FROM tb_custom
|
||||
WHERE del_flag = 0
|
||||
and custom_status = 0
|
||||
and dept_id = 0
|
||||
</select>
|
||||
<select id="getDevTypeCodeById" resultType="java.lang.String">
|
||||
select sd.dict_code
|
||||
from sys_distinct sd
|
||||
where sd.p_id = 92
|
||||
and sd.id = #{sampleToolsId}
|
||||
and del_flag = 0
|
||||
</select>
|
||||
<select id="selectCustomerCode" resultType="java.lang.String">
|
||||
SELECT
|
||||
SUBSTRING( customer_code, - 3 ) AS CODE
|
||||
FROM
|
||||
tb_sample_device
|
||||
WHERE
|
||||
SUBSTRING( customer_code, 2, 8 )= #{nowDate}
|
||||
ORDER BY
|
||||
customer_code DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="getDeptSelectedById" resultType="com.bonus.aqgqj.app.entity.SamplesManageAppVo">
|
||||
SELECT id,
|
||||
custom_name as name
|
||||
FROM tb_custom
|
||||
WHERE p_id = #{customId}
|
||||
and del_flag = 0
|
||||
and custom_status = 0
|
||||
and dept_id = 1
|
||||
</select>
|
||||
<select id="getSampleLabelData" resultType="com.bonus.aqgqj.app.entity.SamplesManageAppVo">
|
||||
SELECT
|
||||
te.submit_location as submitLocation,
|
||||
tsd.dev_type_name as sampleTools,
|
||||
tsd.dev_module as devModule,
|
||||
tsd.dev_code as devCode,
|
||||
ts.process_status as processStatus,
|
||||
tc.custom_name as customName
|
||||
FROM
|
||||
tb_sample_device tsd
|
||||
LEFT JOIN tb_sample ts on ts.id=tsd.sample_id and ts.del_flag=0
|
||||
LEFT JOIN tb_custom tc on tc.id=ts.custom_id and tc.del_flag=0
|
||||
LEFT JOIN tb_exper te on te.sample_id=ts.id and te.del_flag=0
|
||||
WHERE
|
||||
tsd.id=#{id}
|
||||
</select>
|
||||
<select id="getTestItemList" resultType="com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo">
|
||||
SELECT
|
||||
tei.id,
|
||||
tei.exper_type_name AS experTypeName,
|
||||
tei.amount
|
||||
FROM
|
||||
tb_exper_items tei
|
||||
LEFT JOIN tb_exper te on te.id=tei.exper_id and te.del_flag=0
|
||||
LEFT JOIN tb_sample ts on ts.id=te.sample_id and ts.del_flag=0
|
||||
LEFT JOIN tb_sample_device tsd on tsd.sample_id=ts.id and tsd.del_falg=0
|
||||
WHERE
|
||||
tsd.id=#{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.aqgqj.app.dao.SelectAppDao">
|
||||
<select id="getToolsSelect" resultType="com.bonus.aqgqj.app.entity.SamplesManageAppVo">
|
||||
select
|
||||
id,
|
||||
dict_name as name
|
||||
from
|
||||
sys_distinct
|
||||
where
|
||||
p_id = 92
|
||||
and del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="getTestTeamSelected" resultType="com.bonus.aqgqj.app.entity.SamplesManageAppVo">
|
||||
SELECT
|
||||
id,
|
||||
team_name AS name
|
||||
FROM
|
||||
tb_team
|
||||
WHERE
|
||||
del_flag = 0
|
||||
AND team_type_code =2
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -141,11 +141,11 @@
|
|||
</select>
|
||||
<select id="selectCustomerCode" resultType="java.lang.String">
|
||||
SELECT
|
||||
SUBSTRING( customer_code, - 4 ) AS CODE
|
||||
SUBSTRING( customer_code, - 3 ) AS CODE
|
||||
FROM
|
||||
tb_sample_device
|
||||
WHERE
|
||||
SUBSTRING( customer_code, 1, 8 )= #{nowDate}
|
||||
SUBSTRING( customer_code, 2, 8 )= #{nowDate}
|
||||
ORDER BY
|
||||
customer_code DESC
|
||||
LIMIT 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue