wucl 6 miesięcy temu
rodzic
commit
36bc267cd5

+ 4 - 0
biz-base/src/main/java/com/dayou/controller/UserController.java

@@ -1,5 +1,6 @@
 package com.dayou.controller;
 
+import com.dayou.annotation.DataPermission;
 import com.dayou.annotation.OperLog;
 import com.dayou.bo.PrivilegeTreeBO;
 import com.dayou.condition.LoginCondition;
@@ -34,6 +35,8 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
 
+import static com.dayou.common.Constants.FINANCE_DEPARTMENT;
+import static com.dayou.common.Constants.MANAGER_OFFICE;
 import static com.dayou.constants.JwtConstants.REST_TOKEN;
 
 /**
@@ -52,6 +55,7 @@ public class UserController extends BaseController {
     /**
     * 基础用户列表 部门
     */
+    @DataPermission(department=true,ignoreDepartment = {MANAGER_OFFICE})
     @GetMapping("")
     public RestResponse<Page<UserVO>> page(UserVO userVO, Page page){
         Page<UserVO> pages=userService.xPage(page,userVO);

+ 32 - 20
dao/src/main/resources/mapper/BusinessIncomeMapper.xml

@@ -8,7 +8,7 @@
             fc.claim_amount as realAmount,
             mp.report_no,
             IF
-                ( fc.claim_datetime > mp.save_file_date, fc.claim_datetime, mp.save_file_date ) AS settleDate,
+            ( fc.claim_datetime > mp.delivery_date, fc.claim_datetime, mp.delivery_date ) AS settleDate,
             mp.NAME,
             mp.created,
             dd.NAME AS businessCate,
@@ -31,38 +31,50 @@
                 WHERE
                     deleted = 0
                   AND production_fund_id IS NOT NULL
-                  AND claim_datetime &gt;= #{vo.startDate}
-                  AND claim_datetime  &lt;= #{vo.endDate}
-                UNION ALL
+
+            ) fc
+                INNER JOIN ( SELECT id,order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
+                INNER JOIN (
                 SELECT
-                    allot_amount AS claim_amount,
-                    order_fund_id,
-                    production_fund_id,
-                    created AS claim_datetime
+                    id,
+                    major_id,
+                    NAME,
+                    report_no,
+                    production,
+                    evaluate_amount,
+                    delivery_date,
+                    fund.real_amount,
+                    created
                 FROM
-                    order_fund_allot
+                    major_production mpr
+                        INNER JOIN ( SELECT production_no, real_amount, production_type FROM production_fund WHERE deleted = 0 AND business_type = 'MAJOR_BUSINESS' ) fund ON ( fund.production_no = mpr.report_no AND fund.production_type = mpr.production )
                 WHERE
-                    deleted = 0
-                  AND created  &gt;= #{vo.startDate}
-                  AND created &lt;= #{vo.endDate}
-            ) fc
-                INNER JOIN ( SELECT id,order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
-                INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, delivery_date,created FROM major_production WHERE deleted = 0 ) mp ON mp.report_no = pf.production_no
+                    fund.real_amount IS NOT NULL
+                  AND mpr.delivery_date IS NOT NULL
+            ) mp ON mp.report_no = pf.production_no
                 LEFT JOIN major m ON m.id = mp.major_id
                 INNER JOIN ( SELECT id,business_id, production_id, business_type ,commission_rate_id FROM commission_declare WHERE  deleted = 0 AND declare_result = '审核通过' ) cd ON (
-                        cd.business_id = m.id
-                    AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
+                cd.business_id = m.id
+                    AND ( cd.production_id = mp.id ))
                 LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
                 LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
                 LEFT JOIN ( SELECT id,major_id,user_type, major_production_id, user_id, ratio ,declare_id FROM major_production_allot WHERE deleted = 0 ) mpa
-                          ON ( mpa.major_id = m.id and (mpa.major_production_id is null or mpa.major_production_id = mp.id )
+                          ON ( mpa.major_id = m.id and mpa.major_production_id = mp.id
                               and  if(mpa.user_type='MARKET','COMMISSION_DECLARE_MAJOR_MARKET','COMMISSION_DECLARE_MAJOR_EVALUATE') = cd.business_type
-                                 )
-                              and if(mpa.user_type='MARKET',mp.delivery_date is not null,mp.save_file_date is not null)
+                              )
+
                 left join user u on u.id = mpa.user_id
 
         WHERE
             u.id= #{vo.userId}
+        <if test="vo!=null and vo.startDate!=null and vo.startDate!='' ">
+            AND (select IF
+            ( fc.claim_datetime > mp.delivery_date, fc.claim_datetime, mp.delivery_date )) &gt;= #{vo.startDate}
+        </if>
+        <if test="vo!=null and vo.endDate!=null and vo.endDate!='' ">
+            AND (select IF
+            ( fc.claim_datetime > mp.delivery_date, fc.claim_datetime, mp.delivery_date )) &lt;= #{vo.endDate}
+        </if>
         order by settleDate DESC
     </select>
 

+ 12 - 0
dao/src/main/resources/mapper/UserMapper.xml

@@ -65,6 +65,18 @@
             <if test="userVO!=null and userVO.keyword!=null and userVO.keyword!='' ">
                 and NAME like concat('%',#{userVO.keyword},'%') or staff_no like concat('%',#{userVO.keyword},'%')
             </if>
+            <if test="userVO!=null and userVO.departmentIds!=null and userVO.departmentIds.size!=0 ">
+                and id in (
+                select u.id from (select user_id from user_post where post_id in ( select id from post where department_id
+                in
+                <foreach collection="userVO.departmentIds" open="(" close=")" separator="," item="departmentId">
+                    #{departmentId}
+                </foreach>
+
+                and deleted = 0) and deleted = 0) u1
+                left join user u on u.id = u1.user_id where u.deleted = 0
+                )
+            </if>
         </where>
     </select>
 

+ 4 - 0
domain/src/main/java/com/dayou/vo/UserVO.java

@@ -5,6 +5,7 @@ import lombok.Data;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 /**
  * 类说明:
@@ -23,5 +24,8 @@ public class UserVO extends User {
     private String keyword;
     private String staffNo;
     private String name;
+
+    private List<Long> departmentIds;
+    private Set<Long> userIds;
 }
 

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

@@ -92,7 +92,6 @@ public class BusinessProductionPerformanceServiceImpl extends ServiceImpl<Busine
                             bpp.setFatalMistakes(new ArrayList<>());
                             bpp.setXFatalMistakes(new ArrayList<>());
                         }else {
-                            bpp.setCheckLoop(performance.getCheckLoop());
                             bpp.setProductionId(bpp.getPId());
                             JSONObject jsonObject = JSON.parseObject(bpp.getReason());
                             if (jsonObject!=null){

+ 3 - 3
service/src/main/java/com/dayou/service/impl/UserServiceImpl.java

@@ -196,9 +196,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
 
         User user = checkUserLogin(account, pwd);
 
-        if (user.getEnable().equals(Boolean.FALSE)) {
-            ErrorCode.throwBusinessException(USER_DISABLE);
-        }
+//        if (user.getEnable().equals(Boolean.FALSE)) {
+//            ErrorCode.throwBusinessException(USER_DISABLE);
+//        }
 
         Long userId = user.getId();