package com.dsh.guns.modular.system.controller.code;
|
|
|
|
import com.dsh.course.feignClient.account.model.CityManager;
|
import com.dsh.course.feignClient.account.model.TStoreStaff;
|
import com.dsh.course.feignClient.activity.model.QueryBodySideAppointmentVO;
|
import com.dsh.course.feignClient.other.StoreValueConfigClient;
|
import com.dsh.guns.config.UserExt;
|
import com.dsh.guns.modular.system.model.Store;
|
import com.dsh.guns.modular.system.model.StoredValueConfig;
|
import com.dsh.guns.modular.system.util.ResultUtil;
|
import org.json.JSONArray;
|
import org.json.JSONObject;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
/**
|
* 储值规则配置控制器
|
*/
|
|
@Controller
|
@RequestMapping("/storeValueConfig")
|
public class TStoredValueConfigController {
|
private String PREFIX = "/system/storeValueConfig/";
|
@Autowired
|
private StoreValueConfigClient storeValueConfigClient;
|
/**
|
* 跳转储值管理页面
|
*/
|
@RequestMapping("")
|
public String index(Model model) {
|
StoredValueConfig storeValueConfig = storeValueConfigClient.getStoreValueConfig();
|
|
model.addAttribute("description",storeValueConfig.getDescription());
|
// 解析json串 获取时间
|
JSONObject jsonObject = new JSONObject(storeValueConfig.getContent());
|
JSONArray timeRulesArray = jsonObject.getJSONArray("time_rules");
|
model.addAttribute("content",jsonObject.toString());
|
if (timeRulesArray.length() > 0) {
|
JSONObject timeRule = timeRulesArray.getJSONObject(0);
|
String startTime = timeRule.getString("startTime");
|
String endTime = timeRule.getString("endTime");
|
model.addAttribute("time",startTime+" - " + endTime);
|
System.out.println("StartTime: " + startTime);
|
System.out.println("EndTime: " + endTime);
|
}
|
return PREFIX + "StoreValueConfig.html";
|
}
|
/**
|
* 添加储值规则
|
*/
|
@ResponseBody
|
@RequestMapping(value = "/addStoreValueConfig")
|
public ResultUtil addStoreValueConfig(@RequestBody StoredValueConfig storedValueConfig) {
|
storeValueConfigClient.addStoreValueConfig(storedValueConfig);
|
return ResultUtil.success();
|
}
|
}
|