Commit fa6bc2697ff069fb6d760a962d10d479d6d175b2

Authored by 徐烜
1 parent 9652aed9

Update

src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
... ... @@ -5,7 +5,9 @@ import com.bsth.common.ResponseCode;
5 5 import com.bsth.controller.schedule.BController;
6 6 import com.bsth.entity.schedule.SchedulePlan;
7 7 import com.bsth.entity.sys.CompanyAuthority;
  8 +import com.bsth.entity.sys.SysUser;
8 9 import com.bsth.service.schedule.SchedulePlanService;
  10 +import com.bsth.service.sys.SysUserService;
9 11 import org.springframework.beans.factory.annotation.Autowired;
10 12 import org.springframework.web.bind.annotation.*;
11 13  
... ... @@ -23,11 +25,23 @@ import java.util.Map;
23 25 public class SchedulePlanController extends BController<SchedulePlan, Long> {
24 26 @Autowired
25 27 private SchedulePlanService schedulePlanService;
  28 + @Autowired
  29 + private SysUserService sysUserService;
26 30  
27 31 @Override
28 32 public Map<String, Object> save(@RequestBody SchedulePlan schedulePlan, HttpSession httpSession) {
  33 + // 用户信息
  34 + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME));
  35 + SysUser sysUser = sysUserService.findByUserName(userName);
  36 +
  37 + Date cdate = new Date();
  38 + schedulePlan.setCreateBy(sysUser);
  39 + schedulePlan.setCreateDate(cdate);
  40 + schedulePlan.setUpdateBy(sysUser);
  41 + schedulePlan.setUpdateDate(cdate);
  42 +
  43 + // 如果多个公司,选第一个,以后改成页面控制
29 44 List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) httpSession.getAttribute(Constants.COMPANY_AUTHORITYS);
30   - // TODO:如果多个公司,选第一个,以后改成页面控制
31 45 if (cmyAuths == null || cmyAuths.size() == 0)
32 46 schedulePlanService.save(schedulePlan, new CompanyAuthority());
33 47 else
... ...