|
@@ -4,6 +4,7 @@ import com.ssj.bean.common.framework.core.domain.Response;
|
|
|
import com.ssj.bean.sys.organization.domain.Organization;
|
|
|
import com.ssj.bean.sys.role.domain.Admin;
|
|
|
import com.ssj.bean.sys.role.domain.AdminOrg;
|
|
|
+import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
|
|
|
import com.ssj.bean.weixin.sales.domain.LibStaffing;
|
|
|
import com.ssj.framework.basic.common.bean.SplitPage;
|
|
|
import com.ssj.framework.core.common.controller.BaseController;
|
|
@@ -11,6 +12,7 @@ import com.ssj.service.sys.organization.service.OrganizationService;
|
|
|
import com.ssj.service.sys.role.service.AdminOrgService;
|
|
|
import com.ssj.service.sys.role.service.AdminService;
|
|
|
import com.ssj.service.sys.sort.service.SortService;
|
|
|
+import com.ssj.service.weixin.library.service.ILibJoinService;
|
|
|
import com.ssj.service.weixin.sales.service.LibStaffingService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.formula.functions.Now;
|
|
@@ -49,6 +51,9 @@ public class OrganizationController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private AdminService adminService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ILibJoinService joinService;
|
|
|
|
|
|
/**
|
|
|
* 栏目主页面
|
|
@@ -60,7 +65,7 @@ public class OrganizationController extends BaseController {
|
|
|
}
|
|
|
/**
|
|
|
* 栏目树
|
|
|
- * @param pid
|
|
|
+ * @param
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
@@ -92,7 +97,7 @@ public class OrganizationController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 查询列表
|
|
|
- * @param request
|
|
|
+ * @param
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
@@ -136,10 +141,16 @@ public class OrganizationController extends BaseController {
|
|
|
model.addAttribute("org", org);
|
|
|
return "sys/org/edit";
|
|
|
}
|
|
|
+ @RequestMapping(value = "/batchEdit")
|
|
|
+ public String batchEdit(HttpServletRequest request, Model model, String id,String pId) throws Exception {
|
|
|
+ Organization org = organizationService.getById(pId);
|
|
|
+ model.addAttribute("org", org);
|
|
|
+ return "sys/org/batchEdit";
|
|
|
+ }
|
|
|
|
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public Response updateSortNo(Organization org){
|
|
|
+ public Response save(Organization org){
|
|
|
Response response = new Response();
|
|
|
Boolean isAdd = StringUtils.isEmpty(org.getId())?true:false;
|
|
|
org.setCreateTime(new Date());
|
|
@@ -147,28 +158,74 @@ public class OrganizationController extends BaseController {
|
|
|
org=organizationService.save(org);
|
|
|
organizationService.changeSubCount(org.getpId(), true);
|
|
|
if(isAdd){
|
|
|
- //给当前账号插入权限
|
|
|
- //String adminId = adminId();
|
|
|
- List<String> list = new ArrayList<>();
|
|
|
- list.add("admin");
|
|
|
- list.add("sishujia");
|
|
|
- list.add("xsxb");
|
|
|
- for(String str:list){
|
|
|
- Admin admin = adminService.getByLoginName(str);
|
|
|
- if(admin == null){continue;}
|
|
|
- AdminOrg adminOrg = new AdminOrg();
|
|
|
- adminOrg.setAdminId(admin.getId());
|
|
|
- adminOrg.setCreateTime(new Date());
|
|
|
- adminOrg.setOrgCode(org.getCode());
|
|
|
- adminOrg.setOrgId(org.getId());
|
|
|
- adminOrgService.save(adminOrg);
|
|
|
- }
|
|
|
+ addAdminOrg(org);
|
|
|
}
|
|
|
|
|
|
response.success(org);
|
|
|
return response;
|
|
|
}
|
|
|
-
|
|
|
+ @RequestMapping(value = "/batchSave", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Response batchSave(String beginIndex,String pId,String totalNum){
|
|
|
+ Response response = new Response();
|
|
|
+ Organization org = organizationService.getById(pId);
|
|
|
+ int addNum = Integer.parseInt(totalNum);
|
|
|
+ int beginNum = Integer.parseInt(beginIndex);
|
|
|
+ for(int i=0;i<addNum;i++){
|
|
|
+ Organization addOrg = new Organization();
|
|
|
+ addOrg.setCreateTime(new Date());
|
|
|
+ addOrg.setpId(pId);
|
|
|
+ addOrg.setStatus(1);
|
|
|
+ addOrg.setArea(org.getName());
|
|
|
+ addOrg.setName(org.getName()+(beginNum+i));
|
|
|
+ addOrg.setCode(org.getCode()+"-"+(beginNum+i));
|
|
|
+ addOrg.setSortNo(beginNum+i);
|
|
|
+ addOrg.setOrgLevel(org.getOrgLevel()+1);
|
|
|
+ addOrg=organizationService.save(addOrg);
|
|
|
+ organizationService.changeSubCount(pId, true);
|
|
|
+ addAdminOrg(addOrg);
|
|
|
+ //创建图书馆
|
|
|
+ addJoin(addOrg);
|
|
|
+ }
|
|
|
+ response.success(org);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addJoin(Organization org ){
|
|
|
+ //给当前账号插入权限
|
|
|
+ //String adminId = adminId();
|
|
|
+ TbLibJoin join = new TbLibJoin();
|
|
|
+ join.setLeagueCode(org.getCode());
|
|
|
+ join.setLeagueName(org.getName());
|
|
|
+ join.setLibtype(2);
|
|
|
+ join.setType(1);
|
|
|
+ join.setOrgCode(org.getCode());
|
|
|
+ join.setCreateTime(new Date());
|
|
|
+ join.setLeagueAddress("乌鲁木齐市新市区新医路393号");
|
|
|
+ join.setLeagueLat("43.83503");
|
|
|
+ join.setLeagueLng("87.58042");
|
|
|
+ join.setLeagueCity(org.getArea());
|
|
|
+ joinService.save(join);
|
|
|
+ }
|
|
|
+ private void addAdminOrg(Organization org ){
|
|
|
+ //给当前账号插入权限
|
|
|
+ //String adminId = adminId();
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ list.add("admin");
|
|
|
+ list.add("sishujia");
|
|
|
+ list.add("xsxb");
|
|
|
+ for(String str:list){
|
|
|
+ Admin admin = adminService.getByLoginName(str);
|
|
|
+ if(admin == null){continue;}
|
|
|
+ AdminOrg adminOrg = new AdminOrg();
|
|
|
+ adminOrg.setAdminId(admin.getId());
|
|
|
+ adminOrg.setCreateTime(new Date());
|
|
|
+ adminOrg.setOrgCode(org.getCode());
|
|
|
+ adminOrg.setOrgId(org.getId());
|
|
|
+ adminOrgService.save(adminOrg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public Response delete(String id,String pId){
|