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

接口优化

parent 14495775
......@@ -94,7 +94,7 @@ public class EntityEnclosureController {
fileName = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf("."));
extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
} else {
return BaseResponse.errorMsg("登录信息失效");
return BaseResponse.noLogin("登录信息失效");
}
if (extName.contains(FileExt.EXCL.getName()) || extName.contains(FileExt.EXCLX.getName())) {
String pdfPath = FastDFSUtils.conventAndUploadExcel(file.getInputStream(), fileName);
......@@ -138,7 +138,7 @@ public class EntityEnclosureController {
fileName = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf("."));
extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
} else {
return BaseResponse.errorMsg("登录信息失效");
return BaseResponse.noLogin("登录信息失效");
}
String picUrl = filePath;
map.put("fileUrl", picUrl);
......@@ -195,7 +195,7 @@ public class EntityEnclosureController {
return BaseResponse.errorMsg("没有文件");
}
} else {
return BaseResponse.errorMsg("登录信息失效");
return BaseResponse.noLogin("登录信息失效");
}
return BaseResponse.okData(map);
} catch (Exception e) {
......@@ -222,7 +222,7 @@ public class EntityEnclosureController {
// String data = encoder.encode(by);
// return BaseResponse.okMsg(data);
} else {
return BaseResponse.errorMsg("登录信息失效");
return BaseResponse.noLogin("登录信息失效");
}
return BaseResponse.okMsg("成功");
} catch (Exception e) {
......@@ -270,7 +270,7 @@ public class EntityEnclosureController {
}
}
} else {
return BaseResponse.errorMsg("登录信息失效");
return BaseResponse.noLogin("登录信息失效");
}
return BaseResponse.okMsg("成功");
......
......@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
/**
* <p>
......@@ -160,8 +161,33 @@ public class TeamController {
}
@ApiOperation(value = "获取检测项所需列表(检测组,检测依据,处理项)")
@GetMapping("/getSummaryList")
public BaseResponse getSummaryList() {
try {
System.out.println("start:******************"+ System.currentTimeMillis());
BaseResponse b = teamService.getSummaryList();
System.out.println("end:******************"+System.currentTimeMillis());
return b;
} catch (Exception e) {
log.debug("获取检测项所需列表(检测组,检测依据,处理项){}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "不使用-获取检测项所需列表(检测组,检测依据,处理项)")
@GetMapping("/getSummaryListNew")
public BaseResponse getSummaryListNew() {
try {
System.out.println("start:******************"+ System.currentTimeMillis());
BaseResponse b = teamService.getSummaryListNew();
System.out.println("end:******************"+System.currentTimeMillis());
return b;
} catch (Exception e) {
log.debug("不使用-获取检测项所需列表(检测组,检测依据,处理项){}", e);
}
return BaseResponse.errorMsg("失败!");
}
}
......@@ -36,7 +36,13 @@ public enum BusinessExceptionEnum implements BusinessExceptionAssert {
/**
* 业务异常
*/
BUSINESS_ERROR(400, "Business not pass.");
BUSINESS_ERROR(400, "Business not pass."),
/**
* 用户未登录
*/
NO_LOGIN(401, "Please login.");
BusinessExceptionEnum(int code, String message) {
this.code = code;
......
......@@ -3,12 +3,14 @@ package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.Handle;
import cn.wise.sc.cement.business.model.vo.ClientVo;
import cn.wise.sc.cement.business.model.vo.HandleVo;
import cn.wise.sc.cement.business.model.vo.SummaryVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
......@@ -29,6 +31,8 @@ public interface HandleMapper extends BaseMapper<Handle> {
@Select("select count(*) from team t where t.handle_id = #{id}")
Integer countTeamByhandleId(@Param("id") Integer id);
@Select("select id, name from handle")
List<SummaryVo> fetchList();
......
package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.Method;
import cn.wise.sc.cement.business.model.vo.SummaryVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
......@@ -18,4 +20,7 @@ import java.util.Map;
public interface MethodMapper extends BaseMapper<Method> {
List<Map<String, Object>> exportList(@Param("params") Map<String, Object> params);
@Select("select id, name from method")
List<SummaryVo> fetchList();
}
package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.TeamGroup;
import cn.wise.sc.cement.business.model.vo.SummaryVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
......@@ -13,4 +17,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface TeamGroupMapper extends BaseMapper<TeamGroup> {
@Select("select id, name from team_group")
List<SummaryVo> fetchList();
}
package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.Team;
import cn.wise.sc.cement.business.model.vo.SummaryListVo;
import cn.wise.sc.cement.business.model.vo.SummaryVo;
import cn.wise.sc.cement.business.model.vo.TeamListVo;
import cn.wise.sc.cement.business.model.vo.TeamVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -33,6 +35,14 @@ public interface TeamMapper extends BaseMapper<Team> {
List<Map<String,String>> getListByGroup(Integer groupId);
List<Integer> getSortByGroup(Integer groupId);
List<SummaryVo> getSummaryList();
SummaryListVo getSummaryList2();
......
......@@ -92,4 +92,41 @@
WHERE t.group_id = #{groupId} and t.status = 1
</select>
<select id="getSortByGroup" resultType="java.lang.Integer">
SELECT t.sort_no
FROM team t
WHERE t.group_id = #{groupId} and t.sort_no is not null
order by t.sort_no asc
</select>
<select id="getSummaryList" resultType="cn.wise.sc.cement.business.model.vo.SummaryVo">
select g.id as id, g.name as name,1 as flag from team_group g
UNION
select h.id as id, h.name as name,2 as flag from handle h
UNION
select m.id as id, m.name as name,3 as flag from method m
</select>
<!--MyBatis中的collection使用方法-->
<resultMap id="BaseResultMap" type="cn.wise.sc.cement.business.model.vo.SummaryListVo" >
<collection property="teamGroupList" javaType="java.util.ArrayList" ofType="cn.wise.sc.cement.business.entity.TeamGroup"
select="cn.wise.sc.cement.business.mapper.TeamGroupMapper.fetchList" column="{id=id ,name=name}" />
<collection property="handleList" javaType="java.util.ArrayList" ofType="cn.wise.sc.cement.business.entity.Handle"
select="cn.wise.sc.cement.business.mapper.HandleMapper.fetchList" column="{id=id ,name=name}" />
<collection property="methodList" javaType="java.util.ArrayList" ofType="cn.wise.sc.cement.business.entity.Method"
select="cn.wise.sc.cement.business.mapper.MethodMapper.fetchList" column="{id=id ,name=name}" />
</resultMap>
<select id="getSummaryList2" resultMap="BaseResultMap">
select 0 as id, '0' as name from dual;
</select>
</mapper>
......@@ -92,4 +92,18 @@ public class BaseResponse<T> {
return baseResponse;
}
/**
* 401,用户未登录
*
* @param msg 提示信息
* @param <T> 响应数据类型
* @return BaseResponse
*/
public static <T> BaseResponse<T> noLogin(String msg) {
BaseResponse<T> baseResponse = new BaseResponse<>();
baseResponse.setMsg(msg);
baseResponse.setCode(BusinessExceptionEnum.NO_LOGIN.getCode());
baseResponse.setData(null);
return baseResponse;
}
}
package cn.wise.sc.cement.business.model.vo;
import cn.wise.sc.cement.business.entity.Handle;
import cn.wise.sc.cement.business.entity.Method;
import cn.wise.sc.cement.business.entity.TeamGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import sun.security.util.ManifestEntryVerifier;
import java.util.List;
/**
* @description:
* @author: ztw
* @create: 2020-08-07 15:09
**/
@Data
@ApiModel("检测项所需列表Vo")
public class SummaryListVo {
@ApiModelProperty("检测组集合")
private List<TeamGroup> teamGroupList;
@ApiModelProperty("处理项集合")
private List<Handle> handleList;
@ApiModelProperty("检测依据集合")
private List<Method> methodList;
}
package cn.wise.sc.cement.business.model.vo;
import cn.wise.sc.cement.business.entity.Handle;
import cn.wise.sc.cement.business.entity.Method;
import cn.wise.sc.cement.business.entity.TeamGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @description:
* @author: ztw
* @create: 2020-08-07 15:09
**/
@Data
@ApiModel("检测项所需Vo")
public class SummaryVo {
private Integer id;
private String name;
private Integer flag;
}
......@@ -4,6 +4,7 @@ import cn.wise.sc.cement.business.entity.Team;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.TeamQuery;
import cn.wise.sc.cement.business.model.vo.SummaryListVo;
import cn.wise.sc.cement.business.model.vo.TeamListVo;
import cn.wise.sc.cement.business.model.vo.TeamVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -40,4 +41,8 @@ public interface ITeamService extends IService<Team> {
BaseResponse<List<String>> getByGroup(Integer id);
BaseResponse<List<Integer>> getSortByGroup(Integer groupId);
BaseResponse<Map<String, Object>> getSummaryList();
BaseResponse<SummaryListVo> getSummaryListNew();
}
......@@ -147,7 +147,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String clientName, String projectName, String projectCode, Integer isUrgent) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("entrustCode", entrustCode);
......@@ -256,7 +256,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<Entrust> create(EntrustQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query.getClientId() == null) {
return BaseResponse.errorMsg("请选择委托单位");
......@@ -409,7 +409,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<Entrust> update(EntrustUpdateQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query.getId() == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -617,7 +617,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> deleteSample(Integer sampleId) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
List<Integer> approvalIdList = sysApprovalMapper.getApprovalId("委托评审");
if (approvalIdList == null) {
......@@ -811,7 +811,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
userMessageService.checkMessage(loginUser.getId(), id, SysUserMessage.MessageType.ENTRUST);
return BaseResponse.okData(entrustVo);
......@@ -828,7 +828,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<EntrustVo> getBaseDtail(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (id == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -953,7 +953,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<EntrustVo> getBaseDtailClient(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (id == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -1033,7 +1033,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<List<SampleHandleVo>> getSampleHandleDtail(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (id == null) {
......@@ -1064,7 +1064,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<List<SampleVo>> getSampleCheckDetail(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (id == null) {
......@@ -1137,7 +1137,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<List<SampleVo>> getSampleCheckDtail(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (id == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -1268,7 +1268,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
List<Integer> approvalIdList = sysApprovalMapper.getApprovalId("委托评审");
if (approvalIdList == null) {
......@@ -1458,7 +1458,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
EntrustVo entrustVo = entrustMapper.getDetail(query.getId());
if (entrustVo == null) {
......@@ -1783,7 +1783,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
Integer handleStatus) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("entrustCode", entrustCode);
......@@ -1903,7 +1903,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> acceptHandle(Integer[] ids) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (ids == null || ids.length <= 0) {
return BaseResponse.errorMsg("参数错误");
......@@ -1962,7 +1962,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> finishHandle(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (id == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -2049,7 +2049,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> returnHandle(ReturnQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query == null || query.getId() == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -2132,7 +2132,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String clientName, String projectName, String projectCode, Integer isUrgent) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("entrustCode", entrustCode);
......@@ -2155,7 +2155,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> handleAgain(HandleAgainQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
List<Integer> approvalIdList = sysApprovalMapper.getApprovalId("委托评审");
if (approvalIdList == null) {
......@@ -2227,7 +2227,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> distribution(DistributionQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query.getId() == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -2409,7 +2409,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
Integer isUrgent, Integer distributionStatus) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("entrustCode", entrustCode);
......@@ -2488,7 +2488,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<Map<String, Object>> getSampleDistributionList(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> map = new HashMap<>();
Entrust entrust = entrustMapper.selectById(id);
......@@ -2619,7 +2619,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> acceptDistribution(Integer[] ids) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (ids == null || ids.length <= 0) {
return BaseResponse.errorMsg("参数错误");
......@@ -2661,7 +2661,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> finishDistribution(FinishCheckGroupQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query == null || query.getFinishCheckQueryList().size()<= 0) {
return BaseResponse.errorMsg("参数错误");
......@@ -2793,7 +2793,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> returnDistribution(ReturnDistributionQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query == null || query.getSampleId() == null || query.getTeamGroupId() == null ||
query.getDistributionid().size() <=0) {
......@@ -2878,7 +2878,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String clientName, String projectName, String projectCode, Integer isUrgent) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("entrustCode", entrustCode);
......@@ -2901,7 +2901,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> distributioAgain(HandleAgainQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
List<Integer> approvalIdList = sysApprovalMapper.getApprovalId("委托评审");
if (approvalIdList == null) {
......@@ -2982,7 +2982,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String startDate, String endDate, Integer isUrgent) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> params = new HashMap<>();
......@@ -3051,7 +3051,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<CheckVo> getCheckList(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Entrust entrust = entrustMapper.selectById(id);
if (entrust == null) {
......@@ -3185,7 +3185,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<CheckUserResultVo> getCheckResult(Integer entrustId, Integer userId) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Entrust entrust = entrustMapper.selectById(entrustId);
if (entrust == null) {
......@@ -3449,7 +3449,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录用户");
return BaseResponse.noLogin("请登录用户");
}
if(query.getUserId() == null){
return BaseResponse.errorMsg("检测人信息错误");
......@@ -3483,7 +3483,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<String> checkCountNew(CheckCountNewQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录用户");
return BaseResponse.noLogin("请登录用户");
}
if (query == null || query.getEntrustId() == null || query.getUserId() == null ||
query.getSmapleId() == null) {
......@@ -3721,7 +3721,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
Integer isUrgent, Integer distributionStatus) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("entrustCode", entrustCode);
......@@ -3801,7 +3801,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<List<SampleCheckVo>> getCheckDetail(String cementCode) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (StringUtils.isEmpty(cementCode)) {
return BaseResponse.errorMsg("参数错误");
......@@ -3928,7 +3928,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<List<SampleHandleEnclosureVo>> getSampleHandleEnclosureList(Integer sampleHandleId) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (sampleHandleId == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -3949,7 +3949,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<List<SampleDistributionEnclosureVo>> getSampleDistributionEnclosureList(Integer sampleDistributionId) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("sampleDistributionId", sampleDistributionId);
......@@ -3968,7 +3968,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<List<SampleDistributionEnclosureVo>> getClientEnclosureList(Integer sampleDistributionId) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if(sampleDistributionId == null){
return BaseResponse.errorMsg("参数错误");
......@@ -4021,7 +4021,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<SampleHandleEnclosure> uploadEnclosureCL(SampleHandleEnclosureQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query == null || query.getId() == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -4057,7 +4057,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
public BaseResponse<SampleDistributionEnclosure> uploadEnclosurePF(SampleHandleEnclosureQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query == null || query.getId() == null) {
return BaseResponse.errorMsg("参数错误");
......@@ -4193,7 +4193,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
entrust.setStatus(7); //校核中状态
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录用户");
return BaseResponse.noLogin("请登录用户");
}
if (query.getCementCode() == null) {
......
......@@ -80,7 +80,7 @@ public class NonStandardApplyServiceImpl extends ServiceImpl<NonStandardApplyMap
public BaseResponse<NonStandardApply> create(NonStandardApplyQuery query) {
LoginUser loginUser = userService.getLoginUser();
if(loginUser==null){
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if(StringUtils.isBlank(query.getWorkType())){
return BaseResponse.errorMsg("工作类型不能为空");
......
......@@ -122,7 +122,7 @@ public class PlanConsumablesPurchaseServiceImpl extends ServiceImpl<PlanConsumab
public BaseResponse<PlanConsumablesPurchase> create(PlanConsumablesPurchaseQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录用户");
return BaseResponse.noLogin("请登录用户");
}
if (StringUtils.isEmpty(query.getName())) {
return BaseResponse.errorMsg("产品名称不能为空!");
......
......@@ -121,7 +121,7 @@ public class PlanEquipmentMaintainServiceImpl extends ServiceImpl<PlanEquipmentM
public BaseResponse<PlanEquipmentMaintain> create(PlanEquipmentMaintainQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录用户");
return BaseResponse.noLogin("请登录用户");
}
if (StringUtils.isEmpty(query.getName())) {
return BaseResponse.errorMsg("产品名称不能为空!");
......
......@@ -133,7 +133,7 @@ public class PlanEquipmentPurchaseServiceImpl extends ServiceImpl<PlanEquipmentP
public BaseResponse<PlanEquipmentPurchase> create(PlanEquipmentPurchaseQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录用户");
return BaseResponse.noLogin("请登录用户");
}
if (StringUtils.isEmpty(query.getName())) {
return BaseResponse.errorMsg("产品名称不能为空!");
......
......@@ -121,7 +121,7 @@ public class PlanEquipmentRepairServiceImpl extends ServiceImpl<PlanEquipmentRep
public BaseResponse<PlanEquipmentRepair> create(PlanEquipmentRepairQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录用户");
return BaseResponse.noLogin("请登录用户");
}
if (StringUtils.isEmpty(query.getName())) {
return BaseResponse.errorMsg("产品名称不能为空!");
......
......@@ -101,7 +101,7 @@ public class PlanPeopleServiceImpl extends ServiceImpl<PlanPeopleMapper, PlanPeo
public BaseResponse<PlanPeople> uploadPlanPF(PlanPeopleQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query == null || query.getId() == null) {
return BaseResponse.errorMsg("参数错误");
......
......@@ -124,7 +124,7 @@ public class PlanStandardPurchaseServiceImpl extends ServiceImpl<PlanStandardPur
public BaseResponse<PlanStandardPurchase> create(PlanStandardPurchaseQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录用户");
return BaseResponse.noLogin("请登录用户");
}
if (StringUtils.isEmpty(query.getName())) {
return BaseResponse.errorMsg("产品名称不能为空!");
......
......@@ -100,7 +100,7 @@ public class PlanTrainingServiceImpl extends ServiceImpl<PlanTrainingMapper, Pla
public BaseResponse<PlanTraining> create(PlanTrainingQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null){
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
PlanTraining cama = new PlanTraining();
BeanUtils.copyProperties(query, cama);
......@@ -376,7 +376,7 @@ public class PlanTrainingServiceImpl extends ServiceImpl<PlanTrainingMapper, Pla
// public BaseResponse<PlanTraining> uploadPlanTrainListPT(PlanTrainingFJ query) {
// LoginUser loginUser = userService.getLoginUser();
// if (loginUser == null) {
// return BaseResponse.errorMsg("请登录账号");
// return BaseResponse.noLogin("请登录账号");
// }
// if (query == null || query.getId() == null) {
// return BaseResponse.errorMsg("参数错误");
......
......@@ -224,7 +224,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
public BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end, String name, Integer groupId) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
//只有管理员角色的用户可以查看所有人的产值,其他人只能查看自己的产值
Integer userobjId = null;
......
......@@ -168,7 +168,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
}
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
QueryWrapper<Standard> qw = new QueryWrapper<>();
......
......@@ -120,7 +120,7 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
public BaseResponse<String> upload(SupplierEnclosureQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query == null || query.getSupplierId() == null) {
return BaseResponse.errorMsg("参数错误");
......
......@@ -141,7 +141,7 @@ public class SysUserMessageServiceImpl extends ServiceImpl<SysUserMessageMapper,
public BaseResponse<List<SysUserMessage>> getMessages() {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
List<SysUserMessage> list = this.userMessageMapper.getNoDeal(loginUser.getId(), null, null);
return BaseResponse.okData(list);
......
......@@ -8,13 +8,15 @@ import cn.wise.sc.cement.business.entity.TeamGroup;
import cn.wise.sc.cement.business.exception.BusinessExceptionEnum;
import cn.wise.sc.cement.business.mapper.HandleMapper;
import cn.wise.sc.cement.business.mapper.MethodMapper;
import cn.wise.sc.cement.business.mapper.TeamGroupMapper;
import cn.wise.sc.cement.business.mapper.TeamMapper;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.TeamQuery;
import cn.wise.sc.cement.business.model.vo.ClientVo;
import cn.wise.sc.cement.business.model.vo.TeamListVo;
import cn.wise.sc.cement.business.model.vo.TeamVo;
import cn.wise.sc.cement.business.model.vo.*;
import cn.wise.sc.cement.business.service.IHandleService;
import cn.wise.sc.cement.business.service.IMethodService;
import cn.wise.sc.cement.business.service.ITeamGroupService;
import cn.wise.sc.cement.business.service.ITeamService;
import cn.wise.sc.cement.business.util.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -23,6 +25,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
......@@ -57,6 +60,13 @@ public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team> implements IT
private MethodMapper methodMapper;
@Resource
private HandleMapper handleMapper;
@Autowired
private ITeamGroupService teamGroupService;
@Autowired
private IMethodService methodService;
@Autowired
private IHandleService handleService;
/**
* 分页查询
......@@ -375,24 +385,53 @@ public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team> implements IT
return BaseResponse.okData(map);
}
@Override
public BaseResponse<List<Integer>> getSortByGroup(Integer groupId) {
List<Integer> listResult = new ArrayList<>();
QueryWrapper<Team> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("group_id", groupId);
queryWrapper.orderByAsc("sort_no");
List<Team> list = teamMapper.selectList(queryWrapper);
for(Team team: list){
if(team.getSortNo() != null){
listResult.add(team.getSortNo());
}
}
List<Integer> listResult = teamMapper.getSortByGroup(groupId);
return BaseResponse.okData(listResult);
}
/**
* 获取检测项所需列表(检测组,检测依据,处理项)
* @return
*/
@Override
public BaseResponse<Map<String, Object>> getSummaryList() {
List<SummaryVo> list = teamMapper.getSummaryList();
List<SummaryVo> teamGroupList = new ArrayList<>();
List<SummaryVo> handleList = new ArrayList<>();
List<SummaryVo> methodList = new ArrayList<>();
if(list != null && list.size()>0){
for(SummaryVo summaryVo : list){
if(summaryVo.getFlag() == 1){
teamGroupList.add(summaryVo);
}else if(summaryVo.getFlag() == 2){
handleList.add(summaryVo);
}else if(summaryVo.getFlag() == 3){
methodList.add(summaryVo);
}else{
break;
}
}
}
Map<String, Object> map = new HashMap<>();
map.put("teamGroupList", teamGroupList);
map.put("handleList", handleList);
map.put("methodList", methodList);
return BaseResponse.okData(map);
}
/**
* 优化获取检测项所需列表(检测组,检测依据,处理项)
* @return
*/
@Override
public BaseResponse<SummaryListVo> getSummaryListNew() {
SummaryListVo summaryListVo = teamMapper.getSummaryList2();
return BaseResponse.okData(summaryListVo);
}
......
......@@ -243,7 +243,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
public BaseResponse<String> uploadPeoplePF(SysUserEnclosureQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null){
return BaseResponse.errorMsg("请登录账号");
return BaseResponse.noLogin("请登录账号");
}
if (query == null || query.getUserId() == null){
return BaseResponse.errorMsg("参数错误");
......
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