|
@@ -1,5 +1,6 @@
|
|
|
package com.template.controller;
|
|
package com.template.controller;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.template.annotation.PassToken;
|
|
import com.template.annotation.PassToken;
|
|
@@ -8,6 +9,7 @@ import com.template.api.SystemSettingControllerAPI;
|
|
|
import com.template.common.utils.*;
|
|
import com.template.common.utils.*;
|
|
|
import com.template.config.WxOpenidConfig;
|
|
import com.template.config.WxOpenidConfig;
|
|
|
import com.template.model.pojo.*;
|
|
import com.template.model.pojo.*;
|
|
|
|
|
+import com.template.model.request.InsertOrUpdateSystemSettingRequest;
|
|
|
import com.template.model.request.changePasswordRequest;
|
|
import com.template.model.request.changePasswordRequest;
|
|
|
import com.template.model.request.loginRequest;
|
|
import com.template.model.request.loginRequest;
|
|
|
import com.template.model.request.mobileLoginRequest;
|
|
import com.template.model.request.mobileLoginRequest;
|
|
@@ -36,6 +38,7 @@ import java.util.*;
|
|
|
*/
|
|
*/
|
|
|
@RestController
|
|
@RestController
|
|
|
public class SystemSettingController implements SystemSettingControllerAPI {
|
|
public class SystemSettingController implements SystemSettingControllerAPI {
|
|
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(SystemSettingController.class);
|
|
|
|
|
|
|
|
//宿舍缴费设置 welcome_pay_setting
|
|
//宿舍缴费设置 welcome_pay_setting
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -61,8 +64,8 @@ public class SystemSettingController implements SystemSettingControllerAPI {
|
|
|
|
|
|
|
|
//选宿舍缴费设置
|
|
//选宿舍缴费设置
|
|
|
List<PaySettingVo> psvs = new ArrayList<>();
|
|
List<PaySettingVo> psvs = new ArrayList<>();
|
|
|
- if(wps != null && wps.size() > 0){
|
|
|
|
|
- for (WelcomePaySetting wp:wps) {
|
|
|
|
|
|
|
+ if (wps != null && wps.size() > 0) {
|
|
|
|
|
+ for (WelcomePaySetting wp : wps) {
|
|
|
PaySettingVo psv = new PaySettingVo();
|
|
PaySettingVo psv = new PaySettingVo();
|
|
|
psv.setId(wp.getId());
|
|
psv.setId(wp.getId());
|
|
|
psv.setSchool(wp.getSchool());
|
|
psv.setSchool(wp.getSchool());
|
|
@@ -75,8 +78,8 @@ public class SystemSettingController implements SystemSettingControllerAPI {
|
|
|
|
|
|
|
|
//宿舍开放比例设置
|
|
//宿舍开放比例设置
|
|
|
List<OpenSettingVo> osvs = new ArrayList<>();
|
|
List<OpenSettingVo> osvs = new ArrayList<>();
|
|
|
- if(wos != null && wos.size() > 0){
|
|
|
|
|
- for (WelcomeOpenSetting wo:wos) {
|
|
|
|
|
|
|
+ if (wos != null && wos.size() > 0) {
|
|
|
|
|
+ for (WelcomeOpenSetting wo : wos) {
|
|
|
OpenSettingVo osv = new OpenSettingVo();
|
|
OpenSettingVo osv = new OpenSettingVo();
|
|
|
osv.setId(wo.getId());
|
|
osv.setId(wo.getId());
|
|
|
osv.setSchool(wo.getSchool());
|
|
osv.setSchool(wo.getSchool());
|
|
@@ -89,8 +92,8 @@ public class SystemSettingController implements SystemSettingControllerAPI {
|
|
|
|
|
|
|
|
//到站时间段设置
|
|
//到站时间段设置
|
|
|
List<ArriveSettingVo> asvs = new ArrayList<>();
|
|
List<ArriveSettingVo> asvs = new ArrayList<>();
|
|
|
- if(wass != null && wass.size() > 0){
|
|
|
|
|
- for (WelcomeArriveSetting was:wass){
|
|
|
|
|
|
|
+ if (wass != null && wass.size() > 0) {
|
|
|
|
|
+ for (WelcomeArriveSetting was : wass) {
|
|
|
ArriveSettingVo asv = new ArriveSettingVo();
|
|
ArriveSettingVo asv = new ArriveSettingVo();
|
|
|
asv.setId(was.getId());
|
|
asv.setId(was.getId());
|
|
|
asv.setIsCheck(was.getIsCheck());
|
|
asv.setIsCheck(was.getIsCheck());
|
|
@@ -101,7 +104,7 @@ public class SystemSettingController implements SystemSettingControllerAPI {
|
|
|
}
|
|
}
|
|
|
result.setAsvs(asvs);
|
|
result.setAsvs(asvs);
|
|
|
|
|
|
|
|
- if(ws != null && ws.size() > 0){
|
|
|
|
|
|
|
+ if (ws != null && ws.size() > 0) {
|
|
|
WelcomeSetting wsData = ws.get(0);
|
|
WelcomeSetting wsData = ws.get(0);
|
|
|
result.setCarNum(wsData.getCarNum());
|
|
result.setCarNum(wsData.getCarNum());
|
|
|
result.setPhone(wsData.getPhone());
|
|
result.setPhone(wsData.getPhone());
|
|
@@ -116,4 +119,109 @@ public class SystemSettingController implements SystemSettingControllerAPI {
|
|
|
|
|
|
|
|
return CommonResult.ok(result);
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
|
|
+ public CommonResult insertOrUpdateSettings(InsertOrUpdateSystemSettingRequest iussr, BindingResult bindingResult) throws Exception {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ String st = paramUtils.getParamError(bindingResult);
|
|
|
|
|
+ return CommonResult.fail(st);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ WelcomeSetting result = new WelcomeSetting();
|
|
|
|
|
+
|
|
|
|
|
+ List<WelcomeSetting> ws = welcomeSettingService.list(null);
|
|
|
|
|
+ if (ws != null && ws.size() > 0) {
|
|
|
|
|
+ result = ws.get(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ result.setCarNum(iussr.getCarNum());
|
|
|
|
|
+ result.setPhone(iussr.getPhone());
|
|
|
|
|
+ result.setSafetyNotice(iussr.getSafetyNotice());
|
|
|
|
|
+ result.setBasicVerification(iussr.getBasicVerification());
|
|
|
|
|
+ result.setFamilyInfo(iussr.getFamilyInfo());
|
|
|
|
|
+ result.setArriveSchool(iussr.getArriveSchool());
|
|
|
|
|
+ result.setChooseDormitory(iussr.getChooseDormitory());
|
|
|
|
|
+ result.setCarOrder(iussr.getCarOrder());
|
|
|
|
|
+
|
|
|
|
|
+ //选宿舍缴费设置WelcomePaySetting
|
|
|
|
|
+ List<WelcomePaySetting> wpss = new ArrayList<>();
|
|
|
|
|
+ if (iussr.getPsvs() != null && iussr.getPsvs().size() > 0) {
|
|
|
|
|
+ for (PaySettingVo psv : iussr.getPsvs()) {
|
|
|
|
|
+ WelcomePaySetting wps = new WelcomePaySetting();
|
|
|
|
|
+ wps.setSchool(psv.getSchool());
|
|
|
|
|
+ wps.setMethod(psv.getMethod());
|
|
|
|
|
+ wps.setPayAmount(psv.getPayAmount());
|
|
|
|
|
+ wpss.add(wps);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //宿舍开放比例设置 welcome_open_setting
|
|
|
|
|
+ List<WelcomeOpenSetting> woss = new ArrayList<>();
|
|
|
|
|
+ if (iussr.getOsvs() != null && iussr.getOsvs().size() > 0) {
|
|
|
|
|
+ for (OpenSettingVo osv : iussr.getOsvs()) {
|
|
|
|
|
+ WelcomeOpenSetting wos = new WelcomeOpenSetting();
|
|
|
|
|
+ wos.setSchool(osv.getSchool());
|
|
|
|
|
+ wos.setCollege(osv.getCollege());
|
|
|
|
|
+ wos.setOpenAmount(osv.getOpenAmount());
|
|
|
|
|
+ woss.add(wos);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //到站时间段设置 welcome_arrive_setting
|
|
|
|
|
+ List<WelcomeArriveSetting> wass = new ArrayList<>();
|
|
|
|
|
+ if (iussr.getAsvs() != null && iussr.getAsvs().size() > 0) {
|
|
|
|
|
+ for (ArriveSettingVo asv : iussr.getAsvs()) {
|
|
|
|
|
+ WelcomeArriveSetting was = new WelcomeArriveSetting();
|
|
|
|
|
+ was.setIsCheck(asv.getIsCheck());
|
|
|
|
|
+ was.setStartTime(asv.getStartTime());
|
|
|
|
|
+ was.setEndTime(asv.getEndTime());
|
|
|
|
|
+ wass.add(was);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ boolean iuS = welcomeSettingService.saveOrUpdate(result);
|
|
|
|
|
+ if (!iuS) {
|
|
|
|
|
+ logger.error("设置失败,result参数:" + JSON.toJSON(result));
|
|
|
|
|
+ throw new Exception("添加失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (wpss != null && wpss.size() > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ int deleteAll = welcomePaySettingService.deleteAll();
|
|
|
|
|
+
|
|
|
|
|
+ boolean saveBatch = welcomePaySettingService.saveBatch(wpss);
|
|
|
|
|
+ if(saveBatch){
|
|
|
|
|
+ logger.error("添加缴费设置信息失败,参数:" + JSON.toJSON(wpss));
|
|
|
|
|
+ throw new Exception("添加失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (woss != null && woss.size() > 0) {
|
|
|
|
|
+ int deleteAll = welcomeOpenSettingService.deleteAll();
|
|
|
|
|
+
|
|
|
|
|
+ boolean saveBatch = welcomeOpenSettingService.saveBatch(woss);
|
|
|
|
|
+ if(saveBatch){
|
|
|
|
|
+ logger.error("添加开放比例设置信息失败,参数:" + JSON.toJSON(woss));
|
|
|
|
|
+ throw new Exception("添加失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (wass != null && wass.size() > 0) {
|
|
|
|
|
+ int deleteAll = welcomeArriveSettingService.deleteAll();
|
|
|
|
|
+
|
|
|
|
|
+ boolean saveBatch = welcomeArriveSettingService.saveBatch(wass);
|
|
|
|
|
+ if(saveBatch){
|
|
|
|
|
+ logger.error("添加抵达时间段设置信息失败,参数:" + JSON.toJSON(wass));
|
|
|
|
|
+ throw new Exception("添加失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error(e.getMessage());
|
|
|
|
|
+ throw new Exception("设置失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return CommonResult.ok("设置成功");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|