大屏修改

This commit is contained in:
2022-07-13 17:08:34 +08:00
parent b2146797be
commit 6d88b4aac3
4 changed files with 306 additions and 5 deletions

View File

@@ -14,7 +14,11 @@ public class BigScreenServiceImpl implements BigScreenService {
@Override
public JSONObject getData(JSONObject param) {
String str = "{\"production\":[{\"name_today\":\"5/8弯头\",\"materialprocess_series\":\"1002\",\"num_plan\":\"50000\",\"num_today\":\"38931\"},{\"name_today\":\"7/8弯头\",\"materialprocess_series\":\"1102\",\"num_plan\":\"20000\",\"num_today\":\"15639\"},{\"name_today\":\"15三通\",\"materialprocess_series\":\"1501\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"15弯头\",\"materialprocess_series\":\"1502\",\"num_plan\":\"50000\",\"num_today\":\"38279\"},{\"name_today\":\"15直接\",\"materialprocess_series\":\"1503\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"22三通\",\"materialprocess_series\":\"2201\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"22弯头\",\"materialprocess_series\":\"2202\",\"num_plan\":\"20000\",\"num_today\":\"15199\"},{\"name_today\":\"22直接\",\"materialprocess_series\":\"2203\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"22大小头\",\"materialprocess_series\":\"2204\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"28三通\",\"materialprocess_series\":\"2801\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"28弯头\",\"materialprocess_series\":\"2802\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"28直接\",\"materialprocess_series\":\"2803\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"28大小头\",\"materialprocess_series\":\"2804\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"35大小头\",\"materialprocess_series\":\"3504\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"42大小头\",\"materialprocess_series\":\"4204\",\"num_plan\":\"0\",\"num_today\":\"0\"},{\"name_today\":\"54大小头\",\"materialprocess_series\":\"5404\",\"num_plan\":\"0\",\"num_today\":\"0\"}],\"shopData\":{\"production_today1\":\"108048\",\"production_today2\":\"2.543361\",\"production_plan1\":\"140000\",\"production_plan2\":\"3.295243\",\"person_num\":\"45\",\"device_num\":\"300\",\"route_num\":\"257\",\"materials_num\":\"20.000000\",\"processed_num1\":\"170000\",\"processed_num2\":\"4.000000\",\"product_num1\":\"335000\",\"product_num2\":\"7.000000\",\"today_in1\":\"345146\",\"today_in2\":\"7.412000\",\"today_out1\":\"247700\",\"today_out2\":\"5.320000\",\"yesterday_in1\":\"393231\",\"yesterday_in2\":\"8.926000\",\"yesterday_out1\":\"291125\",\"yesterday_out2\":\"6.450000\",\"b_date\":\"2022-07-12\",\"completion_rate\":\"77.18\"},\"data_bar1\":{\"xDate\":[{\"date\":\"2022-07-12\",\"planinventory_weight\":\"5.000000\",\"need_num\":\"4.500000\",\"enough\":\"5.000000\",\"not_enough\":\"0.000000\"}]},\"data_bar2\":{\"xDate\":[{\"date\":\"2022-06-29\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-06-30\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-01\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-02\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-03\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-04\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-05\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-06\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-07\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-08\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-09\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-10\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-11\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"},{\"date\":\"2022-07-12\",\"storagecapacity_weight\":\"225.000000\",\"repertory\":\"56.000000\",\"enough\":\"225.000000\",\"not_enough\":\"0.000000\"}]}}";
return JSON.parseObject(str);
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("desc", "查询成功!");
returnjo.put("result", JSON.parseObject(str));
return returnjo;
}
@Override
@@ -32,19 +36,19 @@ public class BigScreenServiceImpl implements BigScreenService {
str = "{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间下料看板\",\"arr1\":[{\"workprocedure_name\":\"盘管双斜口下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"5\",\"device_num\":\"5\"},{\"workprocedure_name\":\"直管双斜口下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"1\",\"device_num\":\"1\"},{\"workprocedure_name\":\"盘管无屑下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"1\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"3\",\"device_num\":\"4\"},{\"workprocedure_name\":\"直管无屑下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"1\",\"device_num\":\"1\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"0\",\"sumfinishproduce_qty\":\"0\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"0\"},\"arr4\":[{\"device_name\":\"L28\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:30\"},{\"device_name\":\"1-L22\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:24\"},{\"device_name\":\"L22-2\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:21\"},{\"device_name\":\"L22-1\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:20\"}],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"盘管双斜口\",\"2\",\"2\"],[\"直管双斜口\",\"1\",\"1\"],[\"盘管无屑\",\"1\",\"1\"],[\"直管无屑\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
//2车间旋压看板
if ("1".equals(web_flag)) {
if ("2".equals(web_flag)) {
str="{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间旋压看板\",\"arr1\":[{\"workprocedure_name\":\"旋压下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"12\",\"device_num\":\"12\"},{\"workprocedure_name\":\"滚槽/打点\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"3\",\"device_num\":\"3\"},{\"workprocedure_name\":\"直管有屑下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"3\",\"device_num\":\"3\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"0\",\"sumfinishproduce_qty\":\"0\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"0\"},\"arr4\":[],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"旋压下料\",\"1\",\"0\"],[\"滚槽/打点\",\"0\",\"0\"],[\"直管有屑下料\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
//3车间三通看板
if ("1".equals(web_flag)) {
if ("3".equals(web_flag)) {
str="{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间三通看板\",\"arr1\":[{\"workprocedure_name\":\"三通拉伸\",\"device_runningnum\":\"1\",\"device_errornum\":\"0\",\"device_waitingnum\":\"1\",\"shutdownnum\":\"7\",\"device_num\":\"9\"},{\"workprocedure_name\":\"三通一体机加工\",\"device_runningnum\":\"1\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"8\",\"device_num\":\"9\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"0\",\"sumfinishproduce_qty\":\"0\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"0\"},\"arr4\":[{\"device_name\":\"L22-3\",\"devicestatus_name\":\"专机故障报警\",\"update_date\":\" 00:00:29\"},{\"device_name\":\"L22-1\",\"devicestatus_name\":\"专机故障报警\",\"update_date\":\" 00:00:29\"},{\"device_name\":\"L15-4\",\"devicestatus_name\":\"专机故障报警\",\"update_date\":\" 00:00:29\"},{\"device_name\":\"L15-3\",\"devicestatus_name\":\"专机故障报警\",\"update_date\":\" 00:00:28\"}],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"三通\",\"4\",\"4\"],[\"三通一体机\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
//4车间推弯看板
if ("1".equals(web_flag)) {
if ("4".equals(web_flag)) {
str="{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间推弯看板\",\"arr1\":[{\"workprocedure_name\":\"推弯一体机加工\",\"device_runningnum\":\"3\",\"device_errornum\":\"9\",\"device_waitingnum\":\"3\",\"shutdownnum\":\"16\",\"device_num\":\"31\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"31952\",\"sumfinishproduce_qty\":\"108048\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"140000\"},\"arr4\":[],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"推弯一体机加工\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
//6车间刻字包装看板
if ("1".equals(web_flag)) {
if ("6".equals(web_flag)) {
str="{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间刻字包装看板\",\"arr1\":[{\"workprocedure_name\":\"刻字\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"13\",\"device_num\":\"13\"},{\"workprocedure_name\":\"包装\",\"device_runningnum\":\"2\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"0\",\"device_num\":\"2\"},{\"workprocedure_name\":\"码盘\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"1\",\"shutdownnum\":\"0\",\"device_num\":\"1\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"0\",\"sumfinishproduce_qty\":\"0\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"0\"},\"arr4\":[{\"device_name\":\"激光打标机06\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:35\"}],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"刻字\",\"1\",\"1\"],[\"包装\",\"1\",\"0\"],[\"码盘\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}

View File

@@ -0,0 +1,146 @@
package org.nl.wms.ext.login.rest;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import org.nl.annotation.Log;
import org.nl.config.RsaProperties;
import org.nl.exception.BadRequestException;
import org.nl.modules.security.config.bean.SecurityProperties;
import org.nl.modules.security.security.TokenProvider;
import org.nl.modules.security.service.OnlineUserService;
import org.nl.modules.security.service.dto.JwtUserDto;
import org.nl.modules.system.service.UserService;
import org.nl.modules.system.service.dto.UserDto;
import org.nl.utils.RsaUtils;
import org.nl.utils.SecurityUtils;
import org.nl.wms.ext.login.service.HandLoginService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* @author ldjun
* @date 2021-07-26
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "手持登陆")
@RequestMapping("api/bigScreenScreen")
@Slf4j
public class HandLoginController {
private final HandLoginService handLoginService;
private final SecurityProperties properties;
private final UserService userService;
private final PasswordEncoder passwordEncoder;
private final UserDetailsService userDetailsService;
private final TokenProvider tokenProvider;
private final OnlineUserService onlineUserService;
@PostMapping("/login")
@Log("手持登陆验证")
@ApiOperation("手持登陆验证")
public ResponseEntity<Object> handlogin(@RequestBody Map<String, String> whereJson, HttpServletRequest request) {
JSONObject resultJson = new JSONObject();
MapUtil.getStr(whereJson, "user");
String user = MapUtil.getStr(whereJson, "user");
String password = MapUtil.getStr(whereJson, "password");
String nick_name = "";
if (StrUtil.isEmpty(user)) {
throw new BadRequestException("用户不能为空");
}
if (StrUtil.isEmpty("device_id")) {
resultJson.put("code", "0");
resultJson.put("desc", "设备不能为空");
// return resultJson;
}
if (StrUtil.isEmpty(password)) {
throw new BadRequestException("密码不能为空!");
}
boolean is_match = false;
Long account_id = 0L;
try {
String pwd = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, password);
UserDto userDto = userService.findByName(user);
account_id = userDto.getId();
nick_name =userDto.getNickName();
is_match = passwordEncoder.matches(pwd, userDto.getPassword());
} catch (Exception e) {
e.printStackTrace();
}
if (is_match) {
resultJson.put("code", "1");
resultJson.put("desc", "登陆成功");
} else {
resultJson.put("code", "0");
resultJson.put("desc", "登陆失败!");
}
UserDetails userDetails = userDetailsService.loadUserByUsername(user);
Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(authentication);
String token = tokenProvider.createToken(authentication);
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
// 保存在线信息
onlineUserService.save(jwtUserDto, token, request);
JSONObject jo = new JSONObject();
jo.put("user_name", user);
jo.put("nick_name", nick_name);
jo.put("token", properties.getTokenStartWith() + token);
jo.put("account_id", account_id.toString());
resultJson.put("result", jo);
return new ResponseEntity<>(resultJson, HttpStatus.OK);
}
@PostMapping("/authority")
@Log("手持登陆查询权限")
@ApiOperation("手持登陆查询权限")
public ResponseEntity<Object> queryAuthority(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(handLoginService.queryAuthority(whereJson), HttpStatus.OK);
}
@ApiOperation("修改密码")
@Log("手持修改密码")
@PostMapping(value = "/updatePass")
public ResponseEntity<Object> updatePass(@RequestBody Map<String, String> whereJson) throws Exception {
String RfoldPass = MapUtil.getStr(whereJson, "RfoldPass");
String RfnewPass = MapUtil.getStr(whereJson, "RfnewPass");
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, RfoldPass);
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, RfnewPass);
UserDto user = userService.findByName(SecurityUtils.getCurrentUsername());
if (!passwordEncoder.matches(oldPass, user.getPassword())) {
throw new BadRequestException("修改失败,旧密码错误");
}
if (passwordEncoder.matches(newPass, user.getPassword())) {
throw new BadRequestException("新密码不能与旧密码相同");
}
userService.updatePass(user.getUsername(), passwordEncoder.encode(newPass));
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("desc", "修改密码成功!");
return new ResponseEntity<>(returnjo, HttpStatus.OK);
}
}

View File

@@ -0,0 +1,22 @@
package org.nl.wms.ext.login.service;
import java.util.Map;
public interface HandLoginService {
/**
* 手持登陆
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> handleLogin(Map<String, String> jsonObject);
/**
* 手持登陆查询权限
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> queryAuthority(Map<String, String> jsonObject);
}

View File

@@ -0,0 +1,129 @@
package org.nl.wms.ext.login.service.impl;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.config.RsaProperties;
import org.nl.modules.security.config.bean.SecurityProperties;
import org.nl.modules.security.security.TokenProvider;
import org.nl.modules.security.service.OnlineUserService;
import org.nl.modules.security.service.dto.JwtUserDto;
import org.nl.modules.system.service.UserService;
import org.nl.modules.system.service.dto.UserDto;
import org.nl.utils.RsaUtils;
import org.nl.utils.SecurityUtils;
import org.nl.wms.ext.login.service.HandLoginService;
import org.nl.wql.WQL;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
@RequiredArgsConstructor
@Slf4j
public class HandLoginServiceImpl implements HandLoginService {
private final SecurityProperties properties;
private final UserService userService;
private final PasswordEncoder passwordEncoder;
private final UserDetailsService userDetailsService;
private final TokenProvider tokenProvider;
private final OnlineUserService onlineUserService;
@SneakyThrows
@Override
public Map<String, Object> handleLogin(Map<String, String> jsonObject) {
JSONObject resultJson = new JSONObject();
String user = jsonObject.get("user");
String password = jsonObject.get("password");
String device_id = jsonObject.get("device_id");
if (StrUtil.isEmpty("user")) {
resultJson.put("code", "0");
resultJson.put("desc", "用户不能为空");
return resultJson;
}
if (StrUtil.isEmpty("device_id")) {
resultJson.put("code", "0");
resultJson.put("desc", "设备不能为空");
return resultJson;
}
if (StrUtil.isEmpty("password")) {
resultJson.put("code", "0");
resultJson.put("desc", "密码不能为空!");
return resultJson;
}
boolean is_match = false;
Long account_id = 0L;
try {
String pwd = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, password);
UserDto userDto = userService.findByName(user);
account_id = userDto.getId();
is_match = passwordEncoder.matches(pwd, userDto.getPassword());
} catch (Exception e) {
e.printStackTrace();
}
if (is_match) {
resultJson.put("code", "1");
resultJson.put("desc", "登陆成功");
} else {
resultJson.put("code", "0");
resultJson.put("desc", "登陆失败!");
}
UserDetails userDetails = userDetailsService.loadUserByUsername(user);
Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(authentication);
String token = tokenProvider.createToken(authentication);
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
// 保存在线信息
onlineUserService.save(jwtUserDto, token, null);
JSONObject jo = new JSONObject();
jo.put("user_name", user);
jo.put("token", properties.getTokenStartWith() + token);
jo.put("account_id", account_id.toString());
resultJson.put("result", jo);
return resultJson;
}
@Override
public Map<String, Object> queryAuthority(Map<String, String> jsonObject) {
String accountId = String.valueOf(SecurityUtils.getCurrentUserId());
JSONObject returnjo = new JSONObject();
if (StrUtil.isEmpty(accountId)) {
returnjo.put("code", "0");
returnjo.put("desc", "用户id不能为空");
returnjo.put("result", new JSONArray());
}
//查询一级
JSONObject result = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "4").addParam("accountId", accountId).addParam("component", "0").process().uniqueResult(0);
//查询二级
JSONArray SecondResults = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "4").addParam("accountId", accountId).addParam("component", "1").process().getResultJSONArray(0);
//查询三级
JSONArray roleTree = new JSONArray();
for (int i = 0; i < SecondResults.size(); i++) {
JSONObject row = SecondResults.getJSONObject(i);
String menu_id = row.getString("menu_id");
JSONArray ThirdResults = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "4").addParam("accountId", accountId).addParam("component", "2").addParam("pid", menu_id).process().getResultJSONArray(0);
row.put("sonTree", ThirdResults);
roleTree.add(row);
}
result.put("sonTree", roleTree);
returnjo.put("code", "1");
returnjo.put("desc", "查询成功!");
returnjo.put("result", result);
return returnjo;
}
}