中扬CRM客户关系管理系统
LSH
2024-04-07 9691ea372af8ff0ac7f01885f0658840d8459cfd
#周计划
5个文件已修改
100 ■■■■■ 已修改文件
src/main/java/com/zy/crm/manager/controller/WeeklyController.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/entity/WeeklyDailyPlan.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/entity/WeeklyDailyReality.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WeeklyDailyPlanMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WeeklyDailyRealityMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/controller/WeeklyController.java
@@ -45,6 +45,8 @@
    private WeeklyFollService weeklyFollService;
    @Autowired
    private SmsCodeService smsCodeService;
    @Autowired
    private CstmrService cstmrService;
    String PZH = " ————————————————— ";
    Integer PBN = 3;
@@ -497,8 +499,6 @@
                throw new CoolException("参数为空:WeeklyDailyPlanList");
            } else if (Cools.isEmpty(param.getWeeklyId())){
                throw new CoolException("参数为空:WeeklyId");
            } else if (Cools.isEmpty(param.getWeeklyType())){
                throw new CoolException("参数为空:WeeklyDailyPlanList");
            } else if (Cools.isEmpty(param.getType())){
                throw new CoolException("参数为空:Type");
            } else if (Cools.isEmpty(param.getWeeklyType())){
@@ -595,8 +595,6 @@
                throw new CoolException("参数为空:WeeklyDailyRealityList");
            } else if (Cools.isEmpty(param.getWeeklyId())){
                throw new CoolException("参数为空:WeeklyId");
            } else if (Cools.isEmpty(param.getWeeklyType())){
                throw new CoolException("参数为空:WeeklyDailyPlanList");
            } else if (Cools.isEmpty(param.getType())){
                throw new CoolException("参数为空:Type");
            } else if (Cools.isEmpty(param.getWeeklyType())){
@@ -800,4 +798,82 @@
        }
        return R.ok("回退成功");
    }
    @RequestMapping(value = "/weekly/from/add/phone/auth")
    @ManagerAuth(memo = "周计划/日计划/日实际")
    @Transactional
    public R formAddModifyPhone(@RequestBody WeeklyDomainParam param){
        try{
            if (Cools.isEmpty(param)){
                throw new CoolException("参数为空:WeeklyDomainParam");
            } else if (Cools.isEmpty(param.getWeeklyDailyRealityList()) || param.getWeeklyDailyRealityList().size()==0){
                throw new CoolException("参数为空:WeeklyDailyRealityList");
            } else if (Cools.isEmpty(param.getWeeklyId())){
                throw new CoolException("参数为空:WeeklyId");
//            } else if (Cools.isEmpty(param.getType())){
//                throw new CoolException("参数为空:Type");
            } else if (Cools.isEmpty(param.getWeeklyType())){
                throw new CoolException("参数为空:Weekly");
            }
            Date now = new Date();
            Weekly weekly = weeklyService.selectById(param.getWeeklyId());
            weekly.setUpdateBy(getUserId());
            weekly.setUpdateTime(now);
            List<Date> dateList = new ArrayList<>();//获取周一与周日日期
            dateList = TimeCalculatorUtils.WeeklyMondayAndSundayNow(weekly.getStartTime());
            List<Date> dates = TimeCalculatorUtils.WeeklyListDays(dateList);//获取周一到周日日期
            try{
                weeklyService.updateById(weekly);
            } catch (Exception e) {
                log.error("更新周计划主表失败,异常信息:"+e);
                throw new CoolException("更新周计划主表失败");
            }
            List<CstmrUtilsParam> cstmrUtilsParamList = new ArrayList<>();
            for (WeeklyDailyReality  weeklyDailyReality: param.getWeeklyDailyRealityList()){
                Cstmr cstmr = null;
                if (!Cools.isEmpty(weeklyDailyReality.getCstmrName())){
                    cstmr = cstmrService.selectByName(getHostId(), weeklyDailyReality.getCstmrName());
                    if(Cools.isEmpty(cstmr)){
                        throw new CoolException("未查询到甲方单位!");
                    }else {
                        weeklyDailyReality.setCstmrId(cstmr.getId());
                    }
                }
                weeklyDailyReality.setHostId(getHostId());
                weeklyDailyReality.setDeptId(getDeptId());               // 所属部门
                weeklyDailyReality.setUserId(getUserId());               // 所属人员
                weeklyDailyReality.setDirector(getUserId());               // 所属人员
                weeklyDailyReality.setCreateBy(getUserId());
                weeklyDailyReality.setCreateTime(now);
                weeklyDailyReality.setUpdateBy(getUserId());
                weeklyDailyReality.setUpdateTime(now);
                weeklyDailyReality.setStatus(weekly.getStatus());
                weeklyDailyReality.setDailyTime(dates.get(weeklyDailyReality.getWeeklyDay()-1));
                weeklyDailyReality.setWeeklyId(weekly.getId());
                try{
                    weeklyDailyRealityService.insert(weeklyDailyReality);
                } catch (Exception e){
                    log.error("新增日计划失败"+e);
                    throw new CoolException("新增日计划失败");
                }
            }
        } catch (Exception e){
            log.error("更新周计划异常,异常信息:"+e);
            throw new CoolException("更新周计划失败==>"+e);
        }
        return R.ok("更新成功");
    }
}
src/main/java/com/zy/crm/manager/entity/WeeklyDailyPlan.java
@@ -226,6 +226,13 @@
    private String town;
    /**
     * 甲方单位ID
     */
    @ApiModelProperty(value= "甲方单位ID")
    @TableField("cstmr_name")
    private String cstmrName;
    /**
     * 详细地址
     */
    @ApiModelProperty(value= "详细地址")
src/main/java/com/zy/crm/manager/entity/WeeklyDailyReality.java
@@ -218,6 +218,13 @@
    private Long cstmrId;
    /**
     * 甲方单位ID
     */
    @ApiModelProperty(value= "甲方单位ID")
    @TableField("cstmr_name")
    private String cstmrName;
    /**
     * 星期
     */
    @ApiModelProperty(value= "星期")
src/main/resources/mapper/WeeklyDailyPlanMapper.xml
@@ -32,6 +32,7 @@
        <result column="district" property="district" />
        <result column="town" property="town" />
        <result column="addr" property="addr" />
        <result column="cstmr_name" property="cstmrName" />
    </resultMap>
src/main/resources/mapper/WeeklyDailyRealityMapper.xml
@@ -32,6 +32,7 @@
        <result column="district" property="district" />
        <result column="town" property="town" />
        <result column="addr" property="addr" />
        <result column="cstmr_name" property="cstmrName" />
    </resultMap>