Jelajahi Sumber

Merge branch 'test'

zhaoxian 2 tahun lalu
induk
melakukan
239d29125c

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouVideoGetController.java

@@ -110,6 +110,7 @@ public class KuaiShouVideoGetController {
                                                              String channelType,
                                                              String signatures,
                                                              String orderBy,
+                                                             String photoName,
                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                              HttpServletRequest req) {
@@ -145,6 +146,7 @@ public class KuaiShouVideoGetController {
                     requestMap.put("startDate", startDate);
                     requestMap.put("endDate", endDate);
                 }
+                requestMap.put("photoName", photoName);
                 list = kuaiShouVideoGetService.getVideoList(requestMap);
             } else if ("cost".equals(orderBy)) {
                 if (!Check.isNull(startDate) && !Check.isNull(endDate)) {

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchGroupTemplate.java

@@ -156,6 +156,12 @@ public class KuaiShouBatchGroupTemplate {
     private Integer templateBidType;
 
     /**
+     * 媒体包来源 默认为 0,0-不限,未指定,1-行业优质流量包,2-广告主自定义
+     */
+    @Excel(name = "媒体定向包", width = 15)
+    @ApiModelProperty(value = "媒体定向包")
+    private Integer mediaSourceType;
+    /**
      * 媒体定向包
      */
     @Excel(name = "媒体定向包", width = 15)

+ 18 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchGroupPreview.java

@@ -209,6 +209,12 @@ public class KuaishouBatchGroupPreview {
     private String appStore;
 
     /**
+     * 媒体包来源 默认为 0,0-不限,未指定,1-行业优质流量包,2-广告主自定义
+     */
+    @Excel(name = "媒体定向包", width = 15)
+    @ApiModelProperty(value = "媒体定向包")
+    private Integer mediaSourceType;
+    /**
      * 媒体定向包
      */
     @Excel(name = "媒体定向包", width = 15)
@@ -222,6 +228,18 @@ public class KuaishouBatchGroupPreview {
     @ApiModelProperty(value = "媒体定向排除包")
     private String excludeMedia;
     /**
+     * 试玩 ID集
+     */
+    @Excel(name = "试玩 ID", width = 15)
+    @ApiModelProperty(value = "试玩 ID")
+    private Long playableId;
+    /**
+     * 1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩”
+     */
+    @Excel(name = "1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩", width = 15)
+    @ApiModelProperty(value = "1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩")
+    private String playButton;
+    /**
      * 创建时间
      */
     @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")

+ 5 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml

@@ -48,12 +48,16 @@
         url as 'url',
         cover_url as 'coverUrl',
         signature as 'signature',
-        material_type as 'materialType'
+        material_type as 'materialType',
+        photo_name as 'photoName'
         from ctop_kuaishou_video_get
         where account_id = #{accountId}
         and channel_type = #{channelType}
         and material_type = #{materialType}
         and status = 0
+        <if test="photoName != null and photoName != '' ">
+            and photo_name like CONCAT('%',#{photoName},'%')
+        </if>
         <if test="startDate != null and startDate != '' ">
             and stat_date &gt;= #{startDate}
         </if>

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -576,6 +576,9 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         if (!Check.isNull(templateTarget.getAppInterest())) {
             target.put("app_interest", JSONArray.parseArray(templateTarget.getAppInterest()));
         }
+        if (!Check.isNull(templateTarget.getFilterConvertedLevel())) {
+            target.put("filter_converted_level", templateTarget.getFilterConvertedLevel());
+        }
 
         JSONArray appIds = JSONArray.parseArray(templateTarget.getAppIds());
         if (!Check.isNull(appIds) && !appIds.isEmpty()) {

+ 107 - 32
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java

@@ -246,6 +246,10 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         boolean urlNoNull = isNotNull(urlArr, null, 1);
         boolean schUrlNoNull = isNotNull(schemaUriArr, null, 1);
 
+        //试玩分配方式 1 按账户,2按广告计划,3按广告组
+        Integer playableAllocation = appList.getInteger("playableAllocation");
+        JSONArray playableIds = appList.getJSONArray("playableIds");
+
         //监测链接分配方式 1 按账户,2按广告计划,3按广告组
         Integer linkAllocation = appList.getInteger("linkAllocation");
         JSONArray clickTrackUrlList = appList.getJSONArray("clickUrlList");
@@ -276,6 +280,10 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
             }
         }
 
+        if (playableAllocation == 1 && !Check.isNull(playableIds)) {
+            groupPreview.setPlayableId(playableIds.getLong(0));
+        }
+
         //素材数据
         JSONObject materialArray = data.getJSONObject("materialArray");
         //创意组
@@ -324,6 +332,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                         actionbarClickUrl = actionbarClickUrlList.getString(i);
                     }
                 }
+                if (playableAllocation == 2 && !Check.isNull(playableIds)) {
+                    groupPreview.setPlayableId(getPlayableId(playableIds, i + 1));
+                }
                 if (Check.isNull(campaignId)) {
                     campaignPreview.setId(null);
                     campaignPreview.setCampaignName(getName(campaignPreview.getCampaignNameFormat(), targetIds.getLong(i), null, appId, null) + i);
@@ -352,6 +363,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                             actionbarClickUrl = actionbarClickUrlList.getString(count);
                         }
                     }
+                    if (playableAllocation == 3 && !Check.isNull(playableIds)) {
+                        groupPreview.setPlayableId(getPlayableId(playableIds, j + 1));
+                    }
                     groupPreview.setId(null);
                     groupPreview.setAppId(appId);
                     groupPreview.setPlanId(campaignPreview.getId());
@@ -367,6 +381,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                             groupPreview.setBid(bid);
                         }
                     }
+                    groupPreview.setPlayButton(appList.getString("playButton"));
                     groupPreviewMapper.insert(groupPreview);
                     JSONObject material = materialList.getJSONObject(j);
                     JSONArray photoArr = material.getJSONArray("photoArr");
@@ -468,6 +483,10 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                         actionbarClickUrl = actionbarClickUrlList.getString(i);
                     }
                 }
+                if (playableAllocation == 2 && !Check.isNull(playableIds)) {
+                    groupPreview.setPlayableId(getPlayableId(playableIds, i + 1));
+                }
+
                 campaignPreview.setId(null);
                 campaignPreview.setCampaignName(getName(campaignPreview.getCampaignNameFormat(), null, null, appId, null) + i);
                 campaignPreviewMapper.insert(campaignPreview);
@@ -500,6 +519,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                             actionbarClickUrl = actionbarClickUrlList.getString(count);
                         }
                     }
+                    if (playableAllocation == 3 && !Check.isNull(playableIds)) {
+                        groupPreview.setPlayableId(getPlayableId(playableIds, j + 1));
+                    }
                     groupPreview.setId(null);
                     groupPreview.setAppId(appId);
                     groupPreview.setPlanId(campaignPreview.getId());
@@ -515,30 +537,74 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                             groupPreview.setBid(bid);
                         }
                     }
+                    groupPreview.setPlayButton(appList.getString("playButton"));
                     groupPreviewMapper.insert(groupPreview);
-                    for (int k = 0; k < photoArr.size(); k++) {
-                        creativePreview.setId(null);
-                        creativePreview.setSiteId(siteId);
-                        creativePreview.setClickTrackUrl(clickTrackUrl);
-                        creativePreview.setActionbarClickUrl(actionbarClickUrl);
-                        JSONObject photo = photoArr.getJSONObject(k);
-                        JSONObject image = photo.getJSONObject("image");
-                        creativePreview.setPlanId(campaignPreview.getId());
-                        creativePreview.setGroupId(groupPreview.getId());
-                        creativePreview.setPhotoId(photo.getString("photoId"));
-                        creativePreview.setImageTokens(photo.getString("imageToken"));
-                        creativePreview.setMaterialType(photo.getString("materialType"));
-                        creativePreview.setCreativeName(photo.getString("creativeName") + k);
-                        creativePreview.setImageUrl(image.getString("url"));
-                        creativePreview.setImageSignature(image.getString("signature"));
-                        if (matchingMethod == 1) {
-                            creativePreview.setDescription(photo.getString("description"));
-                        } else if (matchingMethod == 2) {
-                            creativePreview.setDescription(descriptionList.getString(k));
-                        } else if (matchingMethod == 3) {
-                            creativePreview.setDescription(descriptionList.getString(i));
+                    if (groupPreview.getUnitType() == 4) {
+                        for (int k = 0; k < photoArr.size(); k++) {
+                            creativePreview.setId(null);
+                            creativePreview.setSiteId(siteId);
+                            creativePreview.setClickTrackUrl(clickTrackUrl);
+                            creativePreview.setActionbarClickUrl(actionbarClickUrl);
+                            JSONObject photo = photoArr.getJSONObject(k);
+                            JSONObject image = photo.getJSONObject("image");
+                            creativePreview.setPlanId(campaignPreview.getId());
+                            creativePreview.setGroupId(groupPreview.getId());
+                            creativePreview.setPhotoId(photo.getString("photoId"));
+                            creativePreview.setImageTokens(photo.getString("imageToken"));
+                            creativePreview.setMaterialType(photo.getString("materialType"));
+                            creativePreview.setCreativeName(photo.getString("creativeName") + k);
+                            creativePreview.setImageUrl(image.getString("url"));
+                            creativePreview.setImageSignature(image.getString("signature"));
+                            if (matchingMethod == 1) {
+                                creativePreview.setDescription(photo.getString("description"));
+                            } else if (matchingMethod == 2) {
+                                creativePreview.setDescription(descriptionList.getString(k));
+                            } else if (matchingMethod == 3) {
+                                creativePreview.setDescription(descriptionList.getString(i));
+                            }
+                            creativePreviewMapper.insert(creativePreview);
+                        }
+                    } else {
+                        if (photoArr.size() >= 3) {
+                            List<JSONObject> photoIds = JSONArray.parseArray(photoArr.toJSONString(), JSONObject.class);
+                            List<List<JSONObject>> splitPhotoIds = Lists.newArrayList(Lists.partition(photoIds, 10));
+                            for (int k = 0; k < splitPhotoIds.size(); k++) {
+                                //广告语
+                                JSONArray descriptions = materialArray.getJSONArray("descriptionList");
+                                if (descriptions.size() > 3) {
+                                    creativePreview.setDescription(getRandomFromList(descriptions));
+                                } else {
+                                    creativePreview.setDescription(JSONArray.toJSONString(descriptions));
+                                }
+
+                                //photoId集合
+                                List<String> photos = new ArrayList<>();
+                                // 图片集合
+                                List<String> images = new ArrayList<>();
+                                for (JSONObject object : splitPhotoIds.get(k)) {
+                                    if (!Check.isNull(object.getString("photoId"))) {
+                                        photos.add(object.getString("photoId"));
+                                    }
+                                    if (!Check.isNull(object.getString("imageToken"))) {
+                                        images.add(object.getString("imageToken"));
+                                    }
+                                }
+                                creativePreview.setId(null);
+                                creativePreview.setSiteId(siteId);
+                                creativePreview.setClickTrackUrl(clickTrackUrl);
+                                creativePreview.setActionbarClickUrl(actionbarClickUrl);
+                                creativePreview.setPlanId(campaignPreview.getId());
+                                creativePreview.setGroupId(groupPreview.getId());
+                                if (!photos.isEmpty()) {
+                                    creativePreview.setPhotoId(JSONArray.toJSONString(photos));
+                                }
+                                if (!images.isEmpty()) {
+                                    creativePreview.setImageTokens(JSONArray.toJSONString(images));
+                                }
+                                creativePreview.setCreativeName("程序化组-" + k);
+                                creativePreviewMapper.insert(creativePreview);
+                            }
                         }
-                        creativePreviewMapper.insert(creativePreview);
                     }
                 }
             }
@@ -546,6 +612,22 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
 
     }
 
+
+    private Long getPlayableId(JSONArray ids, Integer num) {
+        if (Check.isNull(ids)) {
+            return null;
+        }
+        int size = ids.size();
+        if (size > 0) {
+            if (size >= num) {
+                return ids.getLong(num - 1);
+            } else {
+                return ids.getLong(num % size == 0 ? (size - 1) : ((num % size) - 1));
+            }
+        }
+        return null;
+    }
+
     //从集合里随机获取不重复的3个值
     private String getRandomFromList(JSONArray arr) {
         List<String> ids = JSONArray.parseArray(arr.toJSONString(), String.class);
@@ -562,11 +644,6 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
 
     /**
      * 判断非空
-     *
-     * @param
-     * @return boolean
-     * @throws
-     * @author ZHAOXA
      */
     private boolean isNotNull(JSONArray arr, JSONArray arr2, Integer num) {
         if (num == 2) {
@@ -578,11 +655,6 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
 
     /**
      * 广告语整理
-     *
-     * @param
-     * @return com.alibaba.fastjson.JSONArray
-     * @throws
-     * @author ZHAOXA
      */
     private static JSONArray advertisingSlogan(JSONArray descriptionList, JSONArray materialList) {
         if (materialList.size() <= descriptionList.size()) {
@@ -676,6 +748,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         groupPreview.setAppStore(groupJson.getString("appStore"));
         groupPreview.setBatchId(batchId);
         groupPreview.setUnitType(groupJson.getInteger("unitType"));
+        groupPreview.setMedia(groupJson.getString("media"));
+        groupPreview.setExcludeMedia(groupJson.getString("excludeMedia"));
+        groupPreview.setMediaSourceType(groupJson.getInteger("mediaSourceType"));
         return groupPreview;
     }
 

+ 15 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCreativePreviewServiceImpl.java

@@ -8,7 +8,6 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCampaignPreview;
@@ -291,7 +290,7 @@ public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<Kuaisho
             Integer firstSceneId = valueOf(scene_id.get(0).toString());
             Long templateId = groupPreview.getTemplateId();
             if (!Check.isNull(templateId)) {
-                if (firstSceneId != 5) {
+                if (firstSceneId != 5 && firstSceneId != 1) {
                     unitJson.put("template_id", templateId);
                 } else {
                     JSONObject unionJson = groupTemplateService.getUnionJson(templateId);
@@ -306,10 +305,24 @@ public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<Kuaisho
                         if (!Check.isNull(excludeMedia) && !excludeMedia.isEmpty()) {
                             target.put("exclude_media", excludeMedia);
                         }
+                        if (!Check.isNull(groupPreview.getMediaSourceType())) {
+                            target.put("media_source_type", groupPreview.getMediaSourceType());
+                        }
                         unitJson.put("target", target);
                     }
                 }
             }
+
+            // 试玩 ID
+            Long playableId = groupPreview.getPlayableId();
+            if (!Check.isNull(playableId)) {
+                unitJson.put("playable_id", playableId);
+            }
+            // 试玩按钮文字内容
+            String playButton = groupPreview.getPlayButton();
+            if (!Check.isNull(playButton)) {
+                unitJson.put("play_button", playButton);
+            }
             // 出价
             Integer bid = groupPreview.getBid();
             if (!Check.isNull(bid)) {

+ 22 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseProjectController.java

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
@@ -87,11 +88,28 @@ public class ReimburseProjectController {
                 result.success("修改成功!");
             }
         }
-
         return result;
     }
 
     /**
+     * 集体修改状态
+     */
+    @PostMapping(value = "/editMoreStatus")
+    public Result<Object> editMoreStatus(@RequestBody JSONObject data) {
+        List<Long> ids = JSONArray.parseArray(data.getJSONArray("ids").toJSONString(), Long.class);
+        String status = data.getString("status");
+        List<ReimburseProject> list = new ArrayList<>();
+        for (Long id : ids) {
+            ReimburseProject p = new ReimburseProject();
+            p.setId(id);
+            p.setStatus(status);
+            list.add(p);
+        }
+        reimburseProjectService.updateBatchById(list);
+        return Result.ok("success");
+    }
+
+    /**
      * 通过id删除
      */
     @GetMapping(value = "/delete")
@@ -132,7 +150,9 @@ public class ReimburseProjectController {
         for (ReimburseProject project : list) {
             if (!Check.isNull(project.getFileUrls())) {
                 List<String> fileUrls = JSONArray.parseArray(project.getFileUrls().toString(), String.class);
-                urls.addAll(fileUrls);
+                if (!Check.isNull(fileUrls)) {
+                    urls.addAll(fileUrls);
+                }
             }
         }
         return Result.ok(urls);

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/ReimburseApplyMapper.java

@@ -25,4 +25,8 @@ public interface ReimburseApplyMapper extends BaseMapper<ReimburseApply> {
     void insertRel(@Param("leader") String leader, @Param("applyId") Long applyId);
 
     List<JSONObject> queryLeaderCompanyList();
+
+    String selectFinalLeaders(@Param("userId") String userId,@Param("companyId") String companyId);
+
+    String selectWelfareLeader(@Param("departName")  String departName);
 }

+ 16 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseApplyMapper.xml

@@ -7,10 +7,7 @@
         SELECT * FROM (
         SELECT *, 1 as 'flag' FROM ctop_reimburse_apply
         where 1=1
-        <if test="financialReview == 1">
-            AND leader_id = ''
-        </if>
-        <if test="financialReview == null">
+        <if test="financialReview != 2">
             AND user_id = #{userId}
         </if>
         <if test="companyId != null and companyId != ''">
@@ -34,6 +31,7 @@
         where 1=1
         <if test="financialReview == 1">
             AND leader_id = ''
+            AND final_status = 1
         </if>
         <if test="financialReview == null">
             AND leader_id = #{userId}
@@ -101,6 +99,7 @@
         WHERE 1=1
         <if test="financialReview == 1">
             AND leader_id = ''
+            AND final_status = 1
         </if>
         <if test="financialReview == null">
             AND ( t1.user_id = #{userId}
@@ -174,6 +173,19 @@
         group by company_id
     </select>
 
+    <select id="selectFinalLeaders" resultType="String">
+        SELECT final_id
+        FROM ctop_reimburse_leader
+        where company_id = #{companyId}
+          AND final_id = #{userId} LIMIT 1
+    </select>
+
+    <select id="selectWelfareLeader" resultType="String">
+        SELECT first_id
+        FROM ctop_reimburse_leader
+        where depart_name = #{departName} LIMIT 1
+    </select>
+
     <insert id="insertRel">
         replace
         into ctop_reimburse_apply_leader_rel(apply_id,user_id)VALUE (

+ 80 - 38
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseApplyServiceImpl.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.service.ISysDepartService;
 import cn.com.ctop.common.module.service.ISysUserService;
 import cn.com.ctop.common.module.service.IUserCompanyService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseApply;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseProject;
 import cn.com.ctop.reimburse.mondule.mapper.ReimburseApplyMapper;
@@ -54,6 +55,9 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
     @Autowired
     private ISysUserService sysUserService;
 
+    @Autowired
+    private KuaishouReportDailyAccountMapper dailyAccountMapper;
+
     @Override
     public Result<Object> queryPageList(ReimburseApply reimburseApply, Integer pageNo, Integer pageSize) {
         PageHelper.startPage(pageNo, pageSize);
@@ -83,6 +87,9 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             apply.setType(projects.get(0).getType());
         }
         String leader = getLeader(data.getString("userId"));
+        if (Check.isNull(leader)) {
+            return Result.error("创建失败,userId:" + data.getString("userId") + ",未查询到下一级的审核人员,请联系管理员");
+        }
         apply.setLeaderId(leader);
         SysUser user = sysUserService.getById(apply.getUserId());
         if (!Check.isNull(user)) {
@@ -143,6 +150,9 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
         if (loginId.equals(apply.getUserId())) {
             //获取下次审核人信息
             sender = getLeader(loginId);
+            if (Check.isNull(sender)) {
+                return Result.error("修改失败,userId:" + loginId + ",未查询到下一级的审核人员,请联系管理员");
+            }
             apply.setLeaderId(sender);
             apply.setStatus("1");
             this.updateById(apply);
@@ -153,52 +163,74 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             return Result.ok();
         } else {
             ReimburseApply entity = this.getById(apply.getId());
-            //获取下次审核人信息
-            String leader = getLeader(entity.getLeaderId());
-            //审核人 操作流程:↓↓↓
             //状态 1待审核、2审核通过、3审核拒绝、4审核中、5部分拒绝
             String status = data.getString("status");
-            if ("4".equals(status)) {
-                if ("1".equals(entity.getFinalStatus())) {
-                    //发送 财务审核
-                    isFinancialReview = true;
-                    apply.setLeaderId("");
-                } else if (loginId.equals(leader)) {
-                    //登录人和待审核人一样,则是部门最后审核人
-                    apply.setFinalStatus("1");
-                    //是否是福利费用,是则发送审核 到指定审核人;否则 发送到财务
-                    String welfareUser = checkWelfare(projects);
-                    if (!Check.isNull(welfareUser)) {
-                        apply.setLeaderId(welfareUser);
-                        sender = welfareUser;
+            String leader = null;
+            if ("1".equals(entity.getFinalStatus())) {
+                if ("4".equals(status)) {
+                    //判断是否是 财务人员
+                    String roleCode = dailyAccountMapper.getRoleCodeByUserId(loginId);
+                    if ("financialReview".equals(roleCode)) {
+                        apply.setStatus("2");
                     } else {
                         //发送 财务审核
                         isFinancialReview = true;
                         apply.setLeaderId("");
                     }
-                } else {
-                    sender = leader;
-                    apply.setLeaderId(leader);
+                } else if ("3".equals(status) || "5".equals(status)) {
+                    apply.setLeaderId("");
+                    apply.setFinalStatus("0");
+                    sender = apply.getUserId();
+                }
+            } else {
+                //获取下次审核人信息
+                leader = getLeader(entity.getLeaderId());
+                if (Check.isNull(leader)) {
+                    return Result.error("编辑失败,userId:" + entity.getLeaderId() + ",未查询到下一级的审核人员,请联系管理员");
+                }
+                //审核人 操作流程:↓↓↓
+                if ("4".equals(status)) {
+                    if (loginId.equals(leader)) {
+                        //登录人和待审核人一样,则是部门最后审核人
+                        apply.setFinalStatus("1");
+                        //是否是福利费用,是则发送审核 到指定审核人;否则 发送到财务
+                        String welfareUser = checkWelfare(projects);
+                        if (!Check.isNull(welfareUser)) {
+                            apply.setLeaderId(welfareUser);
+                            sender = welfareUser;
+                        } else {
+                            //发送 财务审核
+                            isFinancialReview = true;
+                            apply.setLeaderId("");
+                        }
+                    } else {
+                        sender = leader;
+                        apply.setLeaderId(leader);
+                    }
+                } else if ("3".equals(status) || "5".equals(status)) {
+                    apply.setLeaderId("");
+                    apply.setFinalStatus("0");
+                    sender = apply.getUserId();
                 }
-            } else if ("3".equals(status) || "5".equals(status)) {
-                apply.setLeaderId("");
-                sender = apply.getUserId();
             }
             this.updateById(apply);
             if (!Check.isNull(sender)) {
                 baseMapper.insertRel(sender, apply.getId());
             }
-        }
-        //流程到财务审核
-        if (isFinancialReview) {
-            //财务审核roleId : 32825ea6b43cb61bffa09bf05ad69cf2
-            List<SysUser> users = sysUserService.getUserListByRoleId("32825ea6b43cb61bffa09bf05ad69cf2");
-            for (SysUser user : users) {
-                sendMsg(user.getId(), type, id, msg);
+            //流程到财务审核
+            if (isFinancialReview) {
+                //财务审核roleId : 32825ea6b43cb61bffa09bf05ad69cf2
+                List<SysUser> users = sysUserService.getUserListByRoleId("32825ea6b43cb61bffa09bf05ad69cf2");
+                for (SysUser user : users) {
+                    sendMsg(user.getId(), type, id, msg);
+                }
+            } else {
+                if (!Check.isNull(sender)) {
+                    sendMsg(sender, type, id, msg);
+                }
             }
-        } else {
-            sendMsg(sender, type, id, msg);
         }
+
         return Result.ok();
     }
 
@@ -247,6 +279,11 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
     // 获取公司审核人ID
     private String getCompanyLeader(String userId, String companyId) {
         String leaderId = "";
+
+        String user = baseMapper.selectFinalLeaders(userId, companyId);
+        if (userId.equals(user)) {
+            return userId;
+        }
         //查询部门
         List<SysDepart> departs = sysDepartService.queryUserDeparts(userId);
         if (!departs.isEmpty()) {
@@ -263,7 +300,9 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                     break;
                 }
             }
-
+            if (leader.isEmpty()) {
+                return null;
+            }
             //第一审核人
             String firstId = leader.getString("first_id");
             //第二审核人
@@ -323,8 +362,11 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                 }
                 text.append("请及时修改报销内容,以免耽误您的报销!");
             }
-            sendMessageService.sendMessage(userId, text.toString());
-            log.info("发送报销提醒,userId:{}  msg:{}", userId, text.toString());
+            //TODO
+//            sendMessageService.sendMessage(userId, text.toString());
+//            log.info("发送报销提醒,userId:{}  msg:{}", userId, text.toString());
+            SysUser user = sysUserService.getById(userId);
+            log.info("发送报销提醒,user:{}  msg:{}", user.getRealname(), text.toString());
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -339,10 +381,10 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
         String type = "KS";
         String typ = "BL,TJ,JH,SY";
         for (ReimburseProject project : projects) {
-            if (type.equals(project.getType())) {
-                return "16eab477cd7a43538c1049d9678753e0";
-            } else if (typ.contains(project.getType())) {
-                return "4afbd7ef38804a558aca1329d4008d37";
+            if (type.equals(project.getProject())) {
+                return baseMapper.selectWelfareLeader("考试福利");
+            } else if (typ.contains(project.getProject())) {
+                return baseMapper.selectWelfareLeader("其他福利");
             }
         }
         return null;