|
@@ -9,14 +9,12 @@ import com.caimei.modules.common.entity.City;
|
|
import com.caimei.modules.common.entity.Province;
|
|
import com.caimei.modules.common.entity.Province;
|
|
import com.caimei.modules.common.entity.Town;
|
|
import com.caimei.modules.common.entity.Town;
|
|
import com.caimei.modules.weisha.dao.CmOrganizeStoreDao;
|
|
import com.caimei.modules.weisha.dao.CmOrganizeStoreDao;
|
|
-import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
import com.thinkgem.jeesite.common.config.Global;
|
|
import com.thinkgem.jeesite.common.config.Global;
|
|
@@ -26,11 +24,11 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
|
|
import com.caimei.modules.weisha.entity.CmOrganizeStore;
|
|
import com.caimei.modules.weisha.entity.CmOrganizeStore;
|
|
import com.caimei.modules.weisha.service.CmOrganizeStoreService;
|
|
import com.caimei.modules.weisha.service.CmOrganizeStoreService;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 采美组织门店Controller
|
|
* 采美组织门店Controller
|
|
|
|
+ *
|
|
* @author Aslee
|
|
* @author Aslee
|
|
* @version 2021-06-29
|
|
* @version 2021-06-29
|
|
*/
|
|
*/
|
|
@@ -38,151 +36,110 @@ import java.util.List;
|
|
@RequestMapping(value = "${adminPath}/weisha/cmOrganizeStore")
|
|
@RequestMapping(value = "${adminPath}/weisha/cmOrganizeStore")
|
|
public class CmOrganizeStoreController extends BaseController {
|
|
public class CmOrganizeStoreController extends BaseController {
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private CmOrganizeStoreService cmOrganizeStoreService;
|
|
|
|
-
|
|
|
|
- @Resource
|
|
|
|
- private CmOrganizeStoreDao cmOrganizeStoreDao;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private AreaDao areaDao;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @ModelAttribute
|
|
|
|
- public CmOrganizeStore get(@RequestParam(required=false) String id) {
|
|
|
|
- CmOrganizeStore entity = null;
|
|
|
|
- if (StringUtils.isNotBlank(id)){
|
|
|
|
- entity = cmOrganizeStoreService.get(id);
|
|
|
|
- }
|
|
|
|
- if (entity == null){
|
|
|
|
- entity = new CmOrganizeStore();
|
|
|
|
- }
|
|
|
|
- return entity;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping(value = {"list", ""})
|
|
|
|
- public String list(CmOrganizeStore cmOrganizeStore, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
|
- if (null != cmOrganizeStore.getStartTime() && !"".equals(cmOrganizeStore.getStartTime()) && !cmOrganizeStore.getStartTime().endsWith("00:00:00")) {
|
|
|
|
- model.addAttribute("startTime", cmOrganizeStore.getStartTime());
|
|
|
|
- cmOrganizeStore.setStartTime(cmOrganizeStore.getStartTime().trim() + " 00:00:00");
|
|
|
|
- }
|
|
|
|
- if (null != cmOrganizeStore.getEndTime() && !"".equals(cmOrganizeStore.getEndTime()) && !cmOrganizeStore.getEndTime().endsWith("23:59:59")) {
|
|
|
|
- model.addAttribute("endTime", cmOrganizeStore.getEndTime());
|
|
|
|
- cmOrganizeStore.setEndTime(cmOrganizeStore.getEndTime().trim() + " 23:59:59");
|
|
|
|
- }
|
|
|
|
- Page<CmOrganizeStore> page = cmOrganizeStoreService.findPage(new Page<CmOrganizeStore>(request, response), cmOrganizeStore);
|
|
|
|
- List<Integer> organizeUser = cmOrganizeStoreDao.getOrganizeUser(cmOrganizeStore.getOrganizeId());
|
|
|
|
- page.getList().forEach(p -> {
|
|
|
|
- if (organizeUser.contains(p.getUserId())) {
|
|
|
|
- p.setIsWx(1);
|
|
|
|
- } else {
|
|
|
|
- p.setIsWx(0);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- model.addAttribute("page", page);
|
|
|
|
- String organizeName = cmOrganizeStoreDao.findOrganizeNameById(cmOrganizeStore.getOrganizeId());
|
|
|
|
- model.addAttribute("organizeName", organizeName);
|
|
|
|
- return "modules/weisha/cmOrganizeStoreList";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping(value = "form")
|
|
|
|
- public String form(CmOrganizeStore cmOrganizeStore, Model model) {
|
|
|
|
- model.addAttribute("cmOrganizeStore", cmOrganizeStore);
|
|
|
|
- Integer provinceId = cmOrganizeStore.getProvinceId();
|
|
|
|
- Integer townId = cmOrganizeStore.getTownId();
|
|
|
|
- Integer cityId = cmOrganizeStore.getCityId();
|
|
|
|
- //控制编辑异常时候的会显地址下拉框
|
|
|
|
- if (null != provinceId && provinceId > 0) {
|
|
|
|
- Province province = areaDao.loadProvinceById(provinceId);
|
|
|
|
- cmOrganizeStore.setProvinceName(province.getName());
|
|
|
|
- }
|
|
|
|
- if (null != cityId && cityId > 0) {
|
|
|
|
- City city = areaDao.loadCityById(cityId);
|
|
|
|
- cmOrganizeStore.setCityName(city.getName());
|
|
|
|
- }
|
|
|
|
- if (null != townId && townId > 0) {
|
|
|
|
- Town town = areaDao.loadTownByID(townId);
|
|
|
|
- cmOrganizeStore.setTownName(town.getName());
|
|
|
|
- }
|
|
|
|
- return "modules/weisha/cmOrganizeStoreForm";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping(value = "formGet")
|
|
|
|
- public String formGet(CmOrganizeStore cmOrganizeStore, Model model) {
|
|
|
|
-// model.addAttribute("cmOrganizeStore", cmOrganizeStore);
|
|
|
|
- CmOrganizeStore clubInfo = cmOrganizeStoreService.gtClubInfo(cmOrganizeStore);
|
|
|
|
-
|
|
|
|
- model.addAttribute("clubInfo", clubInfo);
|
|
|
|
- /*Integer provinceId = cmOrganizeStore.getProvinceId();
|
|
|
|
- Integer townId = cmOrganizeStore.getTownId();
|
|
|
|
- Integer cityId = cmOrganizeStore.getCityId();
|
|
|
|
- //控制编辑异常时候的会显地址下拉框
|
|
|
|
- if (null != provinceId && provinceId > 0) {
|
|
|
|
- Province province = areaDao.loadProvinceById(provinceId);
|
|
|
|
- cmOrganizeStore.setProvinceName(province.getName());
|
|
|
|
- }
|
|
|
|
- if (null != cityId && cityId > 0) {
|
|
|
|
- City city = areaDao.loadCityById(cityId);
|
|
|
|
- cmOrganizeStore.setCityName(city.getName());
|
|
|
|
- }
|
|
|
|
- if (null != townId && townId > 0) {
|
|
|
|
- Town town = areaDao.loadTownByID(townId);
|
|
|
|
- cmOrganizeStore.setTownName(town.getName());
|
|
|
|
- }*/
|
|
|
|
- return "modules/weisha/cmOrganizeStoreFormGet";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping(value = "/cleanWx")
|
|
|
|
- public String cleanWx(CmOrganizeStore cmOrganizeStore) {
|
|
|
|
- // 解绑微信 设置删除
|
|
|
|
- cmOrganizeStoreDao.cleanWx(cmOrganizeStore.getUserId());
|
|
|
|
-// return "redirect:" + Global.getAdminPath() + "/weisha/cmOrganizeStorelist";
|
|
|
|
- return "redirect:" + Global.getAdminPath() + "/weisha/cmOrganizeStore/?repage&organizeId=" + cmOrganizeStore.getOrganizeId();
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- @RequestMapping(value = "status")
|
|
|
|
- public String status(CmOrganizeStore cmOrganizeStore) {
|
|
|
|
- // 机构 上线、下线
|
|
|
|
- cmOrganizeStoreDao.clubStatus(cmOrganizeStore.getUserId(),cmOrganizeStore.getStatus());
|
|
|
|
- cmOrganizeStoreDao.userStatus(cmOrganizeStore.getUserId(),cmOrganizeStore.getStatus());
|
|
|
|
- return "redirect:" + Global.getAdminPath() + "/weisha/cmOrganizeStore/?repage&organizeId=" + cmOrganizeStore.getOrganizeId();
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping(value = "save")
|
|
|
|
- public String save(CmOrganizeStore cmOrganizeStore, Model model, RedirectAttributes redirectAttributes) {
|
|
|
|
- if (!beanValidator(model, cmOrganizeStore)){
|
|
|
|
- return form(cmOrganizeStore, model);
|
|
|
|
- }
|
|
|
|
- // 判断手机号是否存在
|
|
|
|
- List<CmOrganizeStore> storeList = cmOrganizeStoreDao.findListByMobile(cmOrganizeStore);
|
|
|
|
- if (null != storeList && storeList.size() > 0) {
|
|
|
|
- addMessage(model, "手机号重复,请更换手机号");
|
|
|
|
- return form(cmOrganizeStore, model);
|
|
|
|
- }
|
|
|
|
- if (null == cmOrganizeStore.getOrganizeId()) {
|
|
|
|
- addMessage(model, "组织id不能为空");
|
|
|
|
- return form(cmOrganizeStore, model);
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isEmpty(cmOrganizeStore.getId())) {
|
|
|
|
- cmOrganizeStore.setAddTime(new Date());
|
|
|
|
- cmOrganizeStore.setStatus(1);
|
|
|
|
- }
|
|
|
|
- cmOrganizeStoreService.save(cmOrganizeStore);
|
|
|
|
- return "redirect:" + Global.getAdminPath() + "/weisha/cmOrganizeStore/?repage&organizeId=" + cmOrganizeStore.getOrganizeId();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping(value = "delete")
|
|
|
|
- public String delete(CmOrganizeStore cmOrganizeStore, RedirectAttributes redirectAttributes) {
|
|
|
|
- cmOrganizeStoreService.delete(cmOrganizeStore);
|
|
|
|
- addMessage(redirectAttributes, "删除门店成功");
|
|
|
|
- return "redirect:"+Global.getAdminPath()+"/weisha/cmOrganizeStore/?repage";
|
|
|
|
- }
|
|
|
|
- @RequestMapping(value = "update")
|
|
|
|
- public String update(CmOrganizeStore cmOrganizeStore, RedirectAttributes redirectAttributes) {
|
|
|
|
- cmOrganizeStoreService.delete(cmOrganizeStore);
|
|
|
|
- addMessage(redirectAttributes, "删除门店成功");
|
|
|
|
- return "redirect:"+Global.getAdminPath()+"/weisha/cmOrganizeStore/?repage";
|
|
|
|
- }
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private CmOrganizeStoreService cmOrganizeStoreService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private CmOrganizeStoreDao cmOrganizeStoreDao;
|
|
|
|
+
|
|
|
|
+ @Resource(name = "areaMapper")
|
|
|
|
+ private AreaDao areaDao;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ModelAttribute
|
|
|
|
+ public CmOrganizeStore get(@RequestParam(required = false) String id) {
|
|
|
|
+ CmOrganizeStore entity = null;
|
|
|
|
+ if (StringUtils.isNotBlank(id)) {
|
|
|
|
+ entity = cmOrganizeStoreService.get(id);
|
|
|
|
+ }
|
|
|
|
+ if (entity == null) {
|
|
|
|
+ entity = new CmOrganizeStore();
|
|
|
|
+ }
|
|
|
|
+ return entity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = {"list", ""})
|
|
|
|
+ public String list(CmOrganizeStore cmOrganizeStore, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
|
+ if (null != cmOrganizeStore.getStartTime() && !"".equals(cmOrganizeStore.getStartTime()) && !cmOrganizeStore.getStartTime().endsWith("00:00:00")) {
|
|
|
|
+ model.addAttribute("startTime", cmOrganizeStore.getStartTime());
|
|
|
|
+ cmOrganizeStore.setStartTime(cmOrganizeStore.getStartTime().trim() + " 00:00:00");
|
|
|
|
+ }
|
|
|
|
+ if (null != cmOrganizeStore.getEndTime() && !"".equals(cmOrganizeStore.getEndTime()) && !cmOrganizeStore.getEndTime().endsWith("23:59:59")) {
|
|
|
|
+ model.addAttribute("endTime", cmOrganizeStore.getEndTime());
|
|
|
|
+ cmOrganizeStore.setEndTime(cmOrganizeStore.getEndTime().trim() + " 23:59:59");
|
|
|
|
+ }
|
|
|
|
+ Page<CmOrganizeStore> page = cmOrganizeStoreService.findPage(new Page<CmOrganizeStore>(request, response), cmOrganizeStore);
|
|
|
|
+ List<Integer> organizeUser = cmOrganizeStoreDao.getOrganizeUser(cmOrganizeStore.getOrganizeId());
|
|
|
|
+ page.getList().forEach(p -> {
|
|
|
|
+ if (organizeUser.contains(p.getUserId())) {
|
|
|
|
+ p.setIsWx(1);
|
|
|
|
+ } else {
|
|
|
|
+ p.setIsWx(0);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ model.addAttribute("page", page);
|
|
|
|
+ String organizeName = cmOrganizeStoreDao.findOrganizeNameById(cmOrganizeStore.getOrganizeId());
|
|
|
|
+ model.addAttribute("organizeName", organizeName);
|
|
|
|
+ return "modules/weisha/cmOrganizeStoreList";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "form")
|
|
|
|
+ public String form(CmOrganizeStore cmOrganizeStore, Model model) {
|
|
|
|
+ model.addAttribute("cmOrganizeStore", cmOrganizeStore);
|
|
|
|
+ Integer provinceId = cmOrganizeStore.getProvinceId();
|
|
|
|
+ Integer townId = cmOrganizeStore.getTownId();
|
|
|
|
+ Integer cityId = cmOrganizeStore.getCityId();
|
|
|
|
+ //控制编辑异常时候的会显地址下拉框
|
|
|
|
+ if (null != provinceId && provinceId > 0) {
|
|
|
|
+ Province province = areaDao.loadProvinceById(provinceId);
|
|
|
|
+ cmOrganizeStore.setProvinceName(province.getName());
|
|
|
|
+ }
|
|
|
|
+ if (null != cityId && cityId > 0) {
|
|
|
|
+ City city = areaDao.loadCityById(cityId);
|
|
|
|
+ cmOrganizeStore.setCityName(city.getName());
|
|
|
|
+ }
|
|
|
|
+ if (null != townId && townId > 0) {
|
|
|
|
+ Town town = areaDao.loadTownByID(townId);
|
|
|
|
+ cmOrganizeStore.setTownName(town.getName());
|
|
|
|
+ }
|
|
|
|
+ return "modules/weisha/cmOrganizeStoreForm";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "formGet")
|
|
|
|
+ public String formGet(CmOrganizeStore cmOrganizeStore, Model model) {
|
|
|
|
+ CmOrganizeStore clubInfo = cmOrganizeStoreService.gtClubInfo(cmOrganizeStore);
|
|
|
|
+ model.addAttribute("clubInfo", clubInfo);
|
|
|
|
+ return "modules/weisha/cmOrganizeStoreFormGet";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/cleanWx")
|
|
|
|
+ public String cleanWx(CmOrganizeStore cmOrganizeStore) {
|
|
|
|
+ // 解绑微信 设置删除
|
|
|
|
+ cmOrganizeStoreDao.cleanWx(cmOrganizeStore.getUserId());
|
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/weisha/cmOrganizeStore/?repage&organizeId=" + cmOrganizeStore.getOrganizeId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "status")
|
|
|
|
+ public String status(CmOrganizeStore cmOrganizeStore) {
|
|
|
|
+ // 机构 上线、下线
|
|
|
|
+ cmOrganizeStoreDao.clubStatus(cmOrganizeStore.getUserId(), cmOrganizeStore.getStatus());
|
|
|
|
+ cmOrganizeStoreDao.userStatus(cmOrganizeStore.getUserId(), cmOrganizeStore.getStatus());
|
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/weisha/cmOrganizeStore/?repage&organizeId=" + cmOrganizeStore.getOrganizeId();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "delete")
|
|
|
|
+ public String delete(CmOrganizeStore cmOrganizeStore, RedirectAttributes redirectAttributes) {
|
|
|
|
+ cmOrganizeStoreService.delete(cmOrganizeStore);
|
|
|
|
+ addMessage(redirectAttributes, "删除门店成功");
|
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/weisha/cmOrganizeStore/?repage";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "update")
|
|
|
|
+ public String update(CmOrganizeStore cmOrganizeStore, RedirectAttributes redirectAttributes) {
|
|
|
|
+ cmOrganizeStoreService.delete(cmOrganizeStore);
|
|
|
|
+ addMessage(redirectAttributes, "删除门店成功");
|
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/weisha/cmOrganizeStore/?repage";
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|