| | |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.model.TDispatch; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | import com.stylefeng.guns.modular.system.service.ITDispatchService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TDispatch; |
| | | import com.stylefeng.guns.modular.system.service.ITDispatchService; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | @Resource |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | /** |
| | | * 跳转到调度管理首页 |
| | |
| | | */ |
| | | @RequestMapping("/tDispatch_add") |
| | | public String tDispatchAdd(Model model) { |
| | | model.addAttribute("roleType", ShiroExtUtil.getUser().getRoleType()); |
| | | model.addAttribute("roleType", shiroExtUtil.getUser().getRoleType()); |
| | | |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2) |
| | | .eq("isCross", 1) |
| | | .last(" and state != 1 and FIND_IN_SET(flag,'1,2')")); |
| | | model.addAttribute("companyList",companyList); |
| | | |
| | | if (2 == ShiroExtUtil.getUser().getRoleType()) { |
| | | if (2 == shiroExtUtil.getUser().getRoleType()) { |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3) |
| | | .eq("superiorId", ShiroExtUtil.getUser().getObjectId())); |
| | | .eq("superiorId", shiroExtUtil.getUser().getObjectId())); |
| | | model.addAttribute("franchiseeList", franchiseeList); |
| | | } else { |
| | | model.addAttribute("franchiseeList", null); |
| | |
| | | model.addAttribute("item",tDispatch); |
| | | LogObjectHolder.me().set(tDispatch); |
| | | |
| | | Integer roleType = ShiroExtUtil.getUser().getRoleType(); |
| | | Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | if (1 == roleType){ |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2) |
| | |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3) |
| | | .eq("superiorId", ShiroExtUtil.getUser().getObjectId()) |
| | | .eq("superiorId", shiroExtUtil.getUser().getObjectId()) |
| | | .eq("isCross", 1) |
| | | .last(" and state != 1 and FIND_IN_SET(flag,'1,2')")); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tDispatchService.getDispatchList(page, ShiroExtUtil.getUser().getRoleType(), ShiroExtUtil.getUser().getObjectId(), beginTime, endTime, name, companyName, franchiseeName, account, state)); |
| | | page.setRecords(tDispatchService.getDispatchList(page, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), beginTime, endTime, name, companyName, franchiseeName, account, state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | |
| | | if (count > 0) { |
| | | return new ErrorTip(500, "账号已存在,请重新输入"); |
| | | } |
| | | Integer roleType = ShiroExtUtil.getUser().getRoleType(); |
| | | Integer objectId = ShiroExtUtil.getUser().getObjectId(); |
| | | Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | if (2 == roleType) { |
| | | tDispatch.setCompanyId(objectId); |
| | | } else if (3 == roleType) { |
| | |
| | | tDispatch.setFranchiseeId(objectId); |
| | | } |
| | | tDispatch.setInsertTime(new Date()); |
| | | tDispatch.setInsertUserId(ShiroExtUtil.getUser().getId()); |
| | | tDispatch.setInsertUserId(shiroExtUtil.getUser().getId()); |
| | | tDispatch.setInsertUserRole(roleType); |
| | | tDispatch.setState(1); |
| | | if(tDispatch.getCompanyId() == null){ |
| | | Integer objectId1 = userService.selectById(ShiroExtUtil.getUser().getId()).getObjectId(); |
| | | Integer objectId1 = userService.selectById(shiroExtUtil.getUser().getId()).getObjectId(); |
| | | tDispatch.setCompanyId(objectId1); |
| | | } |
| | | tDispatch.setPassword(ShiroKit.md5(tDispatch.getPassword(), "WL:x9#")); |
| | |
| | | return new ErrorTip(500, "账号已存在,请重新输入"); |
| | | } |
| | | } |
| | | Integer roleType = ShiroExtUtil.getUser().getRoleType(); |
| | | Integer objectId = ShiroExtUtil.getUser().getObjectId(); |
| | | Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | if (2 == roleType) { |
| | | tDispatch.setCompanyId(objectId); |
| | | } else if (3 == roleType) { |