Commit 361fb455 authored by qinhu's avatar qinhu

sample_check字段修改

parent 51e25aea
...@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.PutMapping; ...@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -225,16 +226,16 @@ public class NormProductionController { ...@@ -225,16 +226,16 @@ public class NormProductionController {
@GetMapping("/workload/statistics") @GetMapping("/workload/statistics")
@ApiOperation("工作量统计") @ApiOperation("工作量统计")
public BaseResponse<List<WorkloadStatisticsVo>> workloadStatistics(String start, String end) { public BaseResponse<List<WorkloadStatisticsVo>> workloadStatistics(String start, String end, Integer userId) {
Date startTime = null; Date startTime = null;
Date endTime = DateUtil.date(); Date endTime = DateUtil.date();
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)){ if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start); startTime = DateUtil.parseDate(start);
endTime = DateUtil.parseDate(end); endTime = DateUtil.parseDate(end);
} }
return BaseResponse.okData(iNormProductionService.workloadStatistics(startTime,endTime)); return BaseResponse.okData(iNormProductionService.workloadStatistics(startTime, endTime, userId));
} }
} }
......
...@@ -107,6 +107,7 @@ public class ReportController { ...@@ -107,6 +107,7 @@ public class ReportController {
//六元素导出 //六元素导出
List<SixElementReport> list = iEntrustService.getSampleSixElementCheck(entrustId); List<SixElementReport> list = iEntrustService.getSampleSixElementCheck(entrustId);
list.forEach(this::initMapStr2AlongPro); list.forEach(this::initMapStr2AlongPro);
List<SixElementReport> al2o3AndTio2List = list.stream() List<SixElementReport> al2o3AndTio2List = list.stream()
.filter(arg -> !"-".equals(arg.getAl2o3AndTio2())) .filter(arg -> !"-".equals(arg.getAl2o3AndTio2()))
...@@ -135,7 +136,7 @@ public class ReportController { ...@@ -135,7 +136,7 @@ public class ReportController {
*/ */
private void initMapStr2AlongPro(SixElementReport sixElement) { private void initMapStr2AlongPro(SixElementReport sixElement) {
String countResult = sixElement.getCountResult(); String countResult = sixElement.getCountResults();
HashMap<String, String> countResultMap = JSON.parseObject(countResult, HashMap.class); HashMap<String, String> countResultMap = JSON.parseObject(countResult, HashMap.class);
sixElement.setAl2o3("-"); sixElement.setAl2o3("-");
...@@ -159,7 +160,7 @@ public class ReportController { ...@@ -159,7 +160,7 @@ public class ReportController {
} }
private void initMapStr2AlongPro(IndustrialReport industrialReport){ private void initMapStr2AlongPro(IndustrialReport industrialReport){
String countResult = industrialReport.getCountResult(); String countResult = industrialReport.getCountResults();
HashMap<String, String> countResultMap = JSON.parseObject(countResult, HashMap.class); HashMap<String, String> countResultMap = JSON.parseObject(countResult, HashMap.class);
industrialReport.setAad(countResultMap.getOrDefault(IndustrialElementKey.Aad.getKey(),"0")); industrialReport.setAad(countResultMap.getOrDefault(IndustrialElementKey.Aad.getKey(),"0"));
......
...@@ -2,8 +2,6 @@ package cn.wise.sc.cement.business.controller; ...@@ -2,8 +2,6 @@ package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.service.impl.WeiXinService; import cn.wise.sc.cement.business.service.impl.WeiXinService;
import cn.wise.sc.cement.business.wrapper.WrapMapper;
import cn.wise.sc.cement.business.wrapper.Wrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -12,77 +10,116 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,77 +10,116 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.security.MessageDigest;
import javax.servlet.http.HttpServletRequest; import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Api(tags = "微信接口") @Api(tags = "微信接口")
@RestController @RestController
@RequestMapping("/tcdri/weixin") @RequestMapping("/tcdri/weixin")
public class WeiXinController { public class WeiXinController {
private static final Logger log = LoggerFactory.getLogger("WeiXinController"); private static final Logger log = LoggerFactory.getLogger("WeiXinController");
@Autowired
private WeiXinService weiXinService;
@ApiOperation(value = "获取登录token-小程序端")
@GetMapping("/getToken")
public BaseResponse getToken(String code) {
@Autowired log.debug("============================================");
private WeiXinService weiXinService; log.debug("code: {}", code);
log.debug("=============================================");
try {
return weiXinService.getToken(code, "APP");
} catch (Exception e) {
log.debug("获取登录token{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "获取登录token-小程序端") @ApiOperation(value = "获取登录token-管理端")
@GetMapping("/getToken") @GetMapping("/getPCToken")
public BaseResponse getToken(String code){ public BaseResponse getPCToken(String code) {
try { try {
return weiXinService.getToken(code,"APP"); return weiXinService.getToken(code, "PC");
}catch (Exception e){ } catch (Exception e) {
log.debug("获取登录token{}",e); log.debug("获取登录token{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation(value = "获取登录token-管理端") @ApiOperation(value = "当前登录用户")
@GetMapping("/getPCToken") @GetMapping("/getLoginUser")
public BaseResponse getPCToken(String code){ public BaseResponse getLoginUser() {
try { try {
return weiXinService.getToken(code, "PC");
}catch (Exception e){
log.debug("获取登录token{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "获取accessToken信息-小程序端") return weiXinService.getLoginUser();
@GetMapping("/getAccessToken") } catch (Exception e) {
public BaseResponse getAccessToken(){ log.debug("当前登录用户{}", e);
try { }
String accessToken = weiXinService.getAccessToken(); return BaseResponse.errorMsg("失败!");
return BaseResponse.okData(accessToken); }
}catch (Exception e){
log.debug("获取accessToken信息-小程序端{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "获取accessToken信息-管理端") @GetMapping("/jsapiTicket")
@GetMapping("/getPCAccessToken") @ApiOperation("获取jsapi_ticket")
public BaseResponse getPCAccessToken(){ public BaseResponse<Map> getAccessToken() {
try { String accessToken = weiXinService.getJsapiTicket();
String accessToken = weiXinService.getPCAccessToken(); Map<String, String> rts = new HashMap<>(4);
return BaseResponse.okData(accessToken);
}catch (Exception e){
log.debug("获取accessToken信息-管理端{}",e);
}
return BaseResponse.errorMsg("失败!");
}
rts.put("jsapi_ticket", accessToken);
rts.put("timestamp", (new Date()).getTime() / 1000 + "");
rts.put("noncestr", "Wm3WZYTPz0wzccnW");
rts.put("app_id","ww348f91b2573c1867");
return BaseResponse.okData(rts);
}
@ApiOperation(value = "当前登录用户") @GetMapping("/signature")
@GetMapping("/getLoginUser") @ApiOperation("获取accessToken")
public BaseResponse getLoginUser(){ public BaseResponse<String> signature(String param){
try { MessageDigest md;
return weiXinService.getLoginUser(); String tmpStr = null;
}catch (Exception e){
log.debug("当前登录用户{}",e);
}
return BaseResponse.errorMsg("失败!");
}
try {
md = MessageDigest.getInstance("SHA-1");
// 将三个参数字符串拼接成一个字符串进行sha1加密
byte[] digest = md.digest(param.getBytes());
tmpStr = byteToStr(digest);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return BaseResponse.okData(tmpStr);
}
/**
* 将字节数组转换为十六进制字符串
*
* @param byteArray
* @return
*/
private static String byteToStr(byte[] byteArray) {
String strDigest = "";
for (int i = 0; i < byteArray.length; i++) {
strDigest += byteToHexStr(byteArray[i]);
}
return strDigest;
}
/**
* 将字节转换为十六进制字符串
*
* @param mByte
* @return
*/
private static String byteToHexStr(byte mByte) {
char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
char[] tempArr = new char[2];
tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
tempArr[1] = Digit[mByte & 0X0F];
String s = new String(tempArr);
return s;
}
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<select id="getSampleSixElementCheck" resultType="cn.wise.sc.cement.business.model.SixElementReport"> <select id="getSampleSixElementCheck" resultType="cn.wise.sc.cement.business.model.SixElementReport">
SELECT * FROM (SELECT count_result,entrust_id,team_group_name,sct.sample_id FROM sample_check sc SELECT * FROM (SELECT count_results,entrust_id,team_group_name,sct.sample_id FROM sample_check sc
LEFT JOIN LEFT JOIN
(SELECT check_id,sample_id FROM sample_check_team) sct (SELECT check_id,sample_id FROM sample_check_team) sct
ON sct.check_id = sc.id ON sct.check_id = sc.id
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
(SELECT cement_code,sample_code,sample_form,`name` as sample_name,weight,id (SELECT cement_code,sample_code,sample_form,`name` as sample_name,weight,id
FROM sample) s FROM sample) s
ON s.id = sscct.sample_id AND entrust_id = #{entrustId} ON s.id = sscct.sample_id AND entrust_id = #{entrustId}
WHERE count_result IS NOT NULL; WHERE count_results IS NOT NULL;
</select> </select>
<select id="getSampleIndustrialCheck" resultType="cn.wise.sc.cement.business.model.IndustrialReport"> <select id="getSampleIndustrialCheck" resultType="cn.wise.sc.cement.business.model.IndustrialReport">
SELECT * FROM (SELECT count_result,entrust_id,team_group_name,sct.sample_id FROM sample_check sc SELECT * FROM (SELECT count_results,entrust_id,team_group_name,sct.sample_id FROM sample_check sc
LEFT JOIN LEFT JOIN
(SELECT check_id,sample_id FROM sample_check_team) sct (SELECT check_id,sample_id FROM sample_check_team) sct
ON sct.check_id = sc.id ON sct.check_id = sc.id
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
(SELECT cement_code,sample_code,sample_form,`name` as sample_name,weight,id (SELECT cement_code,sample_code,sample_form,`name` as sample_name,weight,id
FROM sample) s FROM sample) s
ON s.id = sscct.sample_id AND entrust_id = #{entrustId} ON s.id = sscct.sample_id AND entrust_id = #{entrustId}
WHERE count_result IS NOT NULL; WHERE count_results IS NOT NULL;
</select> </select>
</mapper> </mapper>
...@@ -41,7 +41,7 @@ public class IndustrialReport implements Serializable { ...@@ -41,7 +41,7 @@ public class IndustrialReport implements Serializable {
/** /**
* 校核数据 * 校核数据
*/ */
private String countResult; private String countResults;
//下面是工业特性得检测项 //下面是工业特性得检测项
......
...@@ -42,7 +42,7 @@ public class SixElementReport implements Serializable { ...@@ -42,7 +42,7 @@ public class SixElementReport implements Serializable {
/** /**
* 校核数据 * 校核数据
*/ */
private String countResult; private String countResults;
//下面为六元素 //下面为六元素
......
...@@ -121,5 +121,5 @@ public interface INormProductionService extends IService<NormProduction> { ...@@ -121,5 +121,5 @@ public interface INormProductionService extends IService<NormProduction> {
* @param endTime 结束时间 * @param endTime 结束时间
* @return 统计对象 * @return 统计对象
*/ */
List<WorkloadStatisticsVo> workloadStatistics(Date startTime, Date endTime); List<WorkloadStatisticsVo> workloadStatistics(Date startTime, Date endTime,Integer userId);
} }
...@@ -475,7 +475,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -475,7 +475,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String[] teamIdS = teamIds.split("、"); String[] teamIdS = teamIds.split("、");
for (String teamId : teamIdS) { for (String teamId : teamIdS) {
Team team = teamMapper.selectById(Integer.valueOf(teamId)); Team team = teamMapper.selectById(Integer.valueOf(teamId));
if (team != null && "1".equals(team.getQualifications())) { if (team != null && 1 == team.getQualifications()) {
team.getName(); team.getName();
teamName = teamName.equals("") ? team.getName() : (teamName + "、" + team.getName()); teamName = teamName.equals("") ? team.getName() : (teamName + "、" + team.getName());
} }
...@@ -2269,7 +2269,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -2269,7 +2269,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
for (String idStr : teamSplit) { for (String idStr : teamSplit) {
int id = Integer.parseInt(idStr); int id = Integer.parseInt(idStr);
teams.forEach(opt -> { teams.forEach(opt -> {
if (opt.getId() == id && "1".equals(opt.getQualifications())) { if (opt.getId() == id && 1 == opt.getQualifications()) {
if (StrUtil.isBlank(arg.getTeamName())) { if (StrUtil.isBlank(arg.getTeamName())) {
arg.setTeamName(opt.getName()); arg.setTeamName(opt.getName());
} else { } else {
......
...@@ -592,7 +592,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -592,7 +592,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
} }
@Override @Override
public List<WorkloadStatisticsVo> workloadStatistics(Date startTime, Date endTime) { public List<WorkloadStatisticsVo> workloadStatistics(Date startTime, Date endTime, Integer userId) {
long start = getDefaultStart(startTime == null ? 0 : startTime.getTime()); long start = getDefaultStart(startTime == null ? 0 : startTime.getTime());
long end = getDefaultEnd(endTime.getTime()); long end = getDefaultEnd(endTime.getTime());
...@@ -601,18 +601,23 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -601,18 +601,23 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
QueryWrapper<SampleDistribution> qw = new QueryWrapper<>(); QueryWrapper<SampleDistribution> qw = new QueryWrapper<>();
if (startTime != null) { if (startTime != null) {
qw.ge("finish_time", DateUtil.format(DateUtil.date(start),"yyyy-MM-dd")); qw.ge("finish_time", DateUtil.format(DateUtil.date(start), "yyyy-MM-dd"));
} }
qw.le("finish_time", DateUtil.format(DateUtil.date(end),"yyyy-MM-dd")); if (userId != null && userId != 0) {
qw.eq("user_id", userId);
}
qw.le("finish_time", DateUtil.format(DateUtil.date(end), "yyyy-MM-dd"));
qw.eq("status", 2); qw.eq("status", 2);
List<SampleDistribution> sampleDistributions = iSampleDistributionService.list(qw); List<SampleDistribution> sampleDistributions = iSampleDistributionService.list(qw);
//脾气比能力大 蠢货
QueryWrapper<NonStandardApply> qwA = new QueryWrapper<>(); QueryWrapper<NonStandardApply> qwA = new QueryWrapper<>();
if (startTime != null) { if (startTime != null) {
qwA.ge("start_time", DateUtil.format(DateUtil.date(start),"yyyy-MM-dd")); qwA.ge("start_time", DateUtil.format(DateUtil.date(start), "yyyy-MM-dd"));
}
if (userId != null && userId != 0) {
qwA.eq("user_id", userId);
} }
qwA.le("start_time", DateUtil.format(DateUtil.date(end),"yyyy-MM-dd")); qwA.le("start_time", DateUtil.format(DateUtil.date(end), "yyyy-MM-dd"));
qwA.eq("status", 2); qwA.eq("status", 2);
List<NonStandardApply> nonStandardApplies = iNonStandardApplyService.list(qwA); List<NonStandardApply> nonStandardApplies = iNonStandardApplyService.list(qwA);
......
...@@ -77,7 +77,6 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua ...@@ -77,7 +77,6 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua
List<QualityApply> list = this.list(qw); List<QualityApply> list = this.list(qw);
//找到所有项目id归类 //找到所有项目id归类
Set<Integer> projectIds = list.stream().map(QualityApply::getProjectId).collect(Collectors.toSet()); Set<Integer> projectIds = list.stream().map(QualityApply::getProjectId).collect(Collectors.toSet());
String[] headers = null;
List<Object[]> datas = new ArrayList<>(); List<Object[]> datas = new ArrayList<>();
//关联部门名字 //关联部门名字
Set<Integer> userIds = list.stream() Set<Integer> userIds = list.stream()
...@@ -124,8 +123,8 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua ...@@ -124,8 +123,8 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua
&& arg.getProjectId().intValue() == projectId) && arg.getProjectId().intValue() == projectId)
.collect(Collectors.toList()); .collect(Collectors.toList());
//以样品归类 //以样品归类
Set<Integer> sampleIds = samples.stream().map(QualityApply::getTeamGroupId) // Set<Integer> sampleIds = samples.stream().map(QualityApply::getTeamGroupId)
.collect(Collectors.toSet()); // .collect(Collectors.toSet());
//写每个样品的表头 //写每个样品的表头
list.stream() list.stream()
...@@ -181,7 +180,7 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua ...@@ -181,7 +180,7 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua
} }
} }
ExcelUtil.excelExport("qualityApply", headers, datas, response); ExcelUtil.excelExport("qualityApply", null, datas, response);
} }
} }
...@@ -106,6 +106,26 @@ public class WeiXinService { ...@@ -106,6 +106,26 @@ public class WeiXinService {
} }
} }
//获取accessToken信息
public String getJsapiTicket() {
try {
String param = "corpid=%s&corpsecret=%s";
param = String.format(param, corpid, corpsecret);
JSONObject jsonObject = WeixinInterfaceUtil.doGet(Global.ACCESSTOKENURL, param);
String accessToken = jsonObject.getString("access_token");
System.out.println("==================accessToken===================");
System.out.println(accessToken);
String param2 = "access_token=%s&type=jsapi";
param2 = String.format(param2, accessToken);
JSONObject ticketJsonObject = WeixinInterfaceUtil.doGet(Global.ticket, param2);
String rts = ticketJsonObject.getString("ticket");
return rts;
} catch (Exception e) {
return null;
}
}
public String getPCAccessToken() { public String getPCAccessToken() {
try { try {
String param = "corpid=%s&corpsecret=%s"; String param = "corpid=%s&corpsecret=%s";
......
package cn.wise.sc.cement.business.util.dfs; package cn.wise.sc.cement.business.util.dfs;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.csource.common.MyException; import org.csource.common.MyException;
import org.csource.common.NameValuePair; import org.csource.common.NameValuePair;
import org.csource.fastdfs.*; import org.csource.fastdfs.*;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
......
...@@ -30,6 +30,7 @@ public interface Global { ...@@ -30,6 +30,7 @@ public interface Global {
*/ */
public static final String USERURL = "https://qyapi.weixin.qq.com/cgi-bin/user/get"; public static final String USERURL = "https://qyapi.weixin.qq.com/cgi-bin/user/get";
public static final String ticket = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket";
......
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