Bläddra i källkod

提成优化部分

wucl 2 år sedan
förälder
incheckning
8f0f54609a

+ 27 - 0
biz-base/src/main/java/com/dayou/controller/ItemController.java

@@ -24,6 +24,8 @@ import com.dayou.common.PullDownModel;
 import com.dayou.utils.ConvertUtil;
 import com.dayou.utils.HttpKit;
 import com.dayou.exception.ErrorCode;
+
+import java.io.IOException;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
@@ -31,6 +33,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.http.MediaType;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
+
 import static com.dayou.common.Constants.MANAGER_OFFICE;
 import static com.dayou.common.Constants.MARKET_DEPARTMENT;
 import static com.dayou.enums.OperationTypeEnum.ADD;
@@ -59,6 +63,16 @@ public class ItemController extends BaseController {
     }
 
     /**
+     * 项目信息表列表(项目所属部门是自己的部门的项目)导出
+     */
+    @DataPermission(department = true,postChild = false,ignoreDepartment = {MANAGER_OFFICE})
+    @GetMapping("/export")
+    public void exportData(ItemDTO item, HttpServletResponse response) throws IOException {
+        List<ItemVO> list = itemService.xList(item);
+        exportPlus(response,"项目列表",list,ItemVO.class);
+    }
+
+    /**
      * 市场部项目列表 (包含客户经理是自己或客户经理是自己下属的项目)
      */
     @DataPermission
@@ -69,6 +83,16 @@ public class ItemController extends BaseController {
     }
 
     /**
+     * 市场部项目列表 (包含客户经理是自己或客户经理是自己下属的项目) 导出
+     */
+    @DataPermission
+    @GetMapping("/mine/export")
+    public void exportDataMine(ItemDTO item, HttpServletResponse response) throws IOException {
+        List<ItemVO> list = itemService.xMineList(item);
+        exportPlus(response,"项目列表",list,ItemVO.class);
+    }
+
+    /**
      * 市场部我的项目列表 (只包含客户经理是自己的项目)
      */
     @GetMapping("/me")
@@ -141,5 +165,8 @@ public class ItemController extends BaseController {
         ItemStatVO bo = itemService.stat();
         return RestResponse.data(bo);
     }
+
+
+
 }
 

+ 4 - 0
dao/src/main/java/com/dayou/mapper/ItemMapper.java

@@ -37,4 +37,8 @@ public interface ItemMapper extends CustomBaseMapper<Item> {
 
 
     List<ItemBrokerageGeneral> getLastMonthItemsInStatus(@Param("lastMonth23") LocalDate lastMonth23, @Param("userId") Long userId);
+
+    List<ItemVO> xList(@Param("item") ItemDTO item);
+
+    List<ItemVO> xMineList( @Param("item") ItemDTO item);
 }

+ 4 - 1
dao/src/main/java/com/dayou/mapper/MarketLogMapper.java

@@ -22,7 +22,10 @@ import java.util.Set;
 public interface MarketLogMapper extends CustomBaseMapper<MarketLog> {
 
 
-    List<ItemUserLogVO> getList(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate , @Param("userIds")Set<Long> userIds);
+    List<ItemUserLogVO> getList(@Param("startDate") LocalDate startDate,
+                                @Param("endDate") LocalDate endDate ,
+                                @Param("userIds")Set<Long> userIds,
+                                @Param("keyword") String keyword);
 
     Page<MarketLogVO> getPage(Page page,@Param("marketLog") MarketLog marketLog);
 }

+ 91 - 0
dao/src/main/resources/mapper/ItemMapper.xml

@@ -279,4 +279,95 @@
           and ibg.marketer_status in ('TO_PREDICTING','NOT_PAYMENT')
     </select>
 
+    <select id="xList"  resultType="com.dayou.vo.ItemVO">
+        <include refid="Common_query_item"/>
+        <if test="item!=null and item.name!=null and item.name!='' ">
+            and i.name like concat ('%',#{item.name},'%')
+        </if>
+        <if test="item!=null and item.cate!=null and item.cate!='' ">
+            and i.cate =#{item.cate}
+        </if>
+        <if test="item!=null and item.businessNo!=null and item.businessNo!='' ">
+            and i.business_no like concat (#{item.businessNo},'%')
+        </if>
+        <if test="item!=null and item.clientManager!=null and item.clientManager!='' ">
+            and i.client_manager like concat ('%',#{item.clientManager},'%')
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size==0">
+            <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
+                and EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
+                <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
+                    #{userId}
+                </foreach>
+                )
+            </if>
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size==0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+            <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+                and i.department_id in
+                <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
+                    #{departmentId}
+                </foreach>
+            </if>
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+            and (
+            <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
+                EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
+                <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
+                    #{userId}
+                </foreach>
+                )
+            </if>
+            <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+                or i.department_id in
+                <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
+                    #{departmentId}
+                </foreach>
+            </if>
+            )
+        </if>
+        <if test="item!=null and item.state!=null and item.state!='' ">
+            GROUP BY i.id
+            HAVING itemStatus =#{item.state}
+        </if>
+        order by i.id DESC
+    </select>
+
+    <select id="xMineList" resultType="com.dayou.vo.ItemVO">
+        <include refid="Common_query_item"/>
+        <if test="item!=null and item.name!=null and item.name!='' ">
+            and i.name like concat ('%',#{item.name},'%')
+        </if>
+        <if test="item!=null and item.cate!=null and item.cate!='' ">
+            and i.cate =#{item.cate}
+        </if>
+        <if test="item!=null and item.businessNo!=null and item.businessNo!='' ">
+            and i.business_no like concat (#{item.businessNo},'%')
+        </if>
+        <if test="item!=null and item.isCurYear!=null and item.isCurYear==true">
+            AND i.sign_date &gt;= concat( YEAR ( now())- 1, '-12-23' )
+            AND i.sign_date &lt;= concat( YEAR ( now()), '-12-22' )
+        </if>
+        <if test="item!=null and item.clientManager!=null and item.clientManager!='' ">
+            and i.client_manager like concat ('%',#{item.clientManager},'%')
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
+            and i.user_id in
+            <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
+                #{userId}
+            </foreach>
+        </if>
+        <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+            and i.department_id in
+            <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
+                #{departmentId}
+            </foreach>
+        </if>
+        <if test="item!=null and item.state!=null and item.state!='' ">
+            GROUP BY i.id
+            HAVING itemStatus =#{item.state}
+        </if>
+        order by i.id DESC
+    </select>
 </mapper>

+ 6 - 0
dao/src/main/resources/mapper/MarketLogMapper.xml

@@ -48,6 +48,12 @@ where u.deleted = 0 and ml.deleted = 0
                 #{userId}
             </foreach>
         </if>
+        <if test="keyword!=null and keyword!='' ">
+            and (
+                u.name like concat ('%',#{keyword},'%')
+                or ml.task_situation like concat ('%',#{keyword},'%')
+            )
+        </if>
     </select>
 
     <select id="getPage" parameterType="com.dayou.entity.MarketLog" resultType="com.dayou.vo.MarketLogVO">

+ 2 - 0
domain/src/main/java/com/dayou/dto/DataPermissionCondition.java

@@ -20,4 +20,6 @@ public class DataPermissionCondition {
     private LocalDate startDate;
     private LocalDate endDate;
 
+    private String keyword;
+
 }

+ 20 - 6
domain/src/main/java/com/dayou/entity/Item.java

@@ -3,6 +3,7 @@ import java.math.BigDecimal;
 
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.dayou.annotation.Excel;
 import com.dayou.common.BaseEntity;
 import java.time.LocalDate;
 
@@ -29,21 +30,24 @@ public class Item extends BaseEntity {
     private static final long serialVersionUID=1L;
 
     /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称",width=40)
+    private String name;
+
+    /**
      * 事业部流水号
      */
+    @Excel(name = "事业部流水号")
     private String businessNo;
 
     /**
      * 公司OA流水号(项目编号)
      */
+    @Excel(name = "项目编号")
     private String oaNo;
 
     /**
-     * 项目名称
-     */
-    private String name;
-
-    /**
      * 项目类型
      */
     @AbcValidate(required = true,message = "项目类型不能为空",fun = Check.NotNull)
@@ -58,46 +62,55 @@ public class Item extends BaseEntity {
     /**
      * 归属单位
      */
+    @Excel(name = "归属单位",readConverterExp=("TJC=泰济诚,DY=大友"))
     private String belongTo;
 
     /**
      * 委托单位
      */
+    @Excel(name = "委托单位")
     private String clientUnit;
 
     /**
-     * 委托人
+     * 客户名字
      */
+    @Excel(name = "客户名字")
     private String clientName;
 
     /**
      * 联系方式
      */
+    @Excel(name = "联系方式")
     private String mobile;
 
     /**
      * 客户经理
      */
+    @Excel(name = "客户经理")
     private String clientManager;
 
     /**
      * 技术负责人
      */
+    @Excel(name = "技术负责人")
     private String skiller;
 
     /**
      * 合同签订时间
      */
+    @Excel(name = "签订时间")
     private LocalDate signDate;
 
     /**
      * 合同支付方式
      */
+    @Excel(name = "支付方式")
     private String paymentMethod;
 
     /**
      * 合同金额
      */
+    @Excel(name = "合同金额")
     @TableField(value = "amount", fill = FieldFill.UPDATE)
     private BigDecimal amount;
 
@@ -129,5 +142,6 @@ public class Item extends BaseEntity {
     /**
      * 合同上传日期
      */
+    @Excel(name = "合同上传日期")
     private LocalDate uploadDate;
 }

+ 26 - 12
domain/src/main/java/com/dayou/vo/ItemVO.java

@@ -1,5 +1,6 @@
 package com.dayou.vo;
 
+import com.dayou.annotation.Excel;
 import com.dayou.entity.Item;
 import lombok.Data;
 
@@ -15,35 +16,48 @@ import java.util.List;
 @Data
 public class ItemVO extends Item {
 
+
+    /**
+     * 所属部门
+     */
+    @Excel(name = "所属部门")
     private String departmentName;
 
     /**
-     * 项目配置人员id列表
+     * 项目类型
      */
-    private List<Long> userIds;
+    @Excel(name = "项目类型")
+    private String cateName;
 
     /**
-     * 阶段名称
+     * 业务来源
      */
-    private String stageName;
+    @Excel(name = "业务来源")
+    private String businessSourceName;
 
     /**
-     * 阶段id
+     * 项目状态
      */
-    private Long stageId;
+    @Excel(name = "项目状态")
+    private String itemStatus;
 
     /**
-     * 项目类型
+     * 项目配置人员id列表
      */
-    private String cateName;
+    private List<Long> userIds;
 
     /**
-     * 业务来源
+     * 阶段名称
      */
-    private String businessSourceName;
+    @Excel(name = "阶段名称")
+    private String stageName;
 
     /**
-     * 项目状态
+     * 阶段id
      */
-    private String itemStatus;
+    private Long stageId;
+
+
+
+
 }

+ 3 - 0
service/src/main/java/com/dayou/service/IItemService.java

@@ -42,4 +42,7 @@ public interface IItemService extends IService<Item> {
 
         String getItemState(Long id);
 
+        List<ItemVO> xList(ItemDTO item);
+
+        List<ItemVO> xMineList(ItemDTO item);
 }

+ 15 - 0
service/src/main/java/com/dayou/service/impl/ItemServiceImpl.java

@@ -67,6 +67,14 @@ public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements II
     }
 
     @Override
+    public List<ItemVO> xList(ItemDTO item) {
+        List<ItemVO> list = itemMapper.xList(item);
+        return list;
+    }
+
+
+
+    @Override
     public ItemVO detail(Long id){
         ItemVO itemVO = itemMapper.xDetail(id);
         return itemVO;
@@ -138,6 +146,11 @@ public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements II
         return result;
     }
 
+    @Override
+    public List<ItemVO> xMineList(ItemDTO item) {
+        List<ItemVO> list = itemMapper.xMineList(item);
+        return list;
+    }
 
     /**
      * 获取项目状态
@@ -166,4 +179,6 @@ public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements II
         }
         return ItemStateEnum.UNPLAYED.getName();
     }
+
+
 }

+ 1 - 1
service/src/main/java/com/dayou/service/impl/MarketLogServiceImpl.java

@@ -88,7 +88,7 @@ public class MarketLogServiceImpl extends ServiceImpl<MarketLogMapper, MarketLog
     public List<ItemLogCollectVO> logCollect(DataPermissionCondition condition) {
         List<ItemUserLogVO> logList = new ArrayList<>();
         List<ItemLogCollectVO> result = new ArrayList<>();
-        logList = marketLogMapper.getList(condition.getStartDate(),condition.getEndDate(),condition.getUserIds());
+        logList = marketLogMapper.getList(condition.getStartDate(),condition.getEndDate(),condition.getUserIds(),condition.getKeyword());
         Map<Long, List<ItemUserLogVO>> collectByUser = logList.stream().collect(Collectors.groupingBy(ItemUserLog::getUserId));
         for(Map.Entry<Long, List<ItemUserLogVO>> byUserMap : collectByUser.entrySet()){
             Map<LocalDate, List<ItemUserLogVO>> collectByDate = byUserMap.getValue().stream().collect(Collectors.groupingBy(ItemUserLog::getLogDate));