Explorar o código

人员信息中增加一个是否允许查看本单位数据开关。

zhengqiang %!s(int64=5) %!d(string=hai) anos
pai
achega
215a22a992

+ 3 - 0
common/src/main/java/com/jpsoft/smart/modules/base/entity/PersonInfo.java

@@ -152,4 +152,7 @@ public class PersonInfo {
 
     @ApiModelProperty(value="是否接收微信通知")
     private Boolean wechatNoticeEnabled;
+
+    @ApiModelProperty(value="是否允许查看本单位数据")
+    private Boolean allowViewLocal;
 }

+ 8 - 2
common/src/main/resources/mapper/base/CompanyInfo.xml

@@ -127,7 +127,7 @@
                 and a.name_ like #{searchParams.name}
             </if>
             <if test="searchParams.parentCode != null">
-                and a.code_ like #{searchParams.parentCode}
+                and b.code_ like #{searchParams.parentCode}
             </if>
             <if test="searchParams.bindCompanyCode != null">
                 and a.code_ like #{searchParams.bindCompanyCode}
@@ -181,7 +181,13 @@
         select a.*,b.name_ as parent_name
         from base_company_info a
         left join base_company_info b on a.parent_id = b.id_
-        where a.parent_id=#{parentId} and a.del_flag=0
+        where a.del_flag=0
+        <if test="parentId!=null">
+            and a.parent_id=#{parentId,jdbcType=VARCHAR}
+        </if>
+        <if test="parentId==null">
+            and (a.parent_id is null or a.parent_id='')
+        </if>
         order by a.sort_no asc,a.name_ asc
     </select>
 </mapper>

+ 6 - 2
common/src/main/resources/mapper/base/PersonInfo.xml

@@ -30,6 +30,7 @@
         <result property="updateTime" column="update_time"/>
         <result property="popedom" column="popedom_"/>
         <result property="wechatNoticeEnabled" column="wechat_notice_enabled"/>
+        <result property="allowViewLocal" column="allow_view_local"/>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.smart.modules.base.entity.PersonInfo">
         <selectKey resultType="long" keyColumn="id_" keyProperty="id">
@@ -40,7 +41,7 @@
 	    (company_id,name_,phone_,id_card,open_id,face_enabled,face_bound,card_enabled,
 	    app_enabled,password_enabled,guest_enabled,position1_,position2_,
 	    position3_,position4_,position5_,face_image_url,del_flag,
-	    create_by,create_time,update_by,update_time,popedom_,wechat_notice_enabled)
+	    create_by,create_time,update_by,update_time,popedom_,wechat_notice_enabled,allow_view_local)
 		values
 		(
             #{companyId,jdbcType=VARCHAR}
@@ -67,6 +68,7 @@
             ,#{updateTime,jdbcType= TIMESTAMP }
             ,#{popedom,jdbcType= VARCHAR }
             ,#{wechatNoticeEnabled,jdbcType= NUMERIC }
+            ,#{allowViewLocal,jdbcType= NUMERIC }
 		)
 	]]>
     </insert>
@@ -148,6 +150,9 @@
             <if test="wechatNoticeEnabled!=null">
                 wechat_notice_enabled=#{wechatNoticeEnabled,jdbcType= VARCHAR },
             </if>
+            <if test="allowViewLocal!=null">
+                allow_view_local=#{allowViewLocal,jdbcType= VARCHAR },
+            </if>
         </set>
         where id_=#{id}
     </update>
@@ -334,7 +339,6 @@
         <foreach collection="list" index="index" item="item" open="and company_id in(" separator="," close=")">
             #{item.id}
         </foreach>
-
     </select>
 
     <select id="findById" resultMap="PersonInfoMap">

+ 2 - 2
web/src/main/java/com/jpsoft/smart/modules/base/controller/CompanyInfoController.java

@@ -447,8 +447,8 @@ public class CompanyInfoController {
 
                 PojoUtils.map(companyInfo,dto);
 
-//                Boolean hasChildren = companyInfoService.hasChildren(companyInfo.getId());
-//                dto.setHasChildren(hasChildren);
+                Boolean hasChildren = companyInfoService.hasChildren(companyInfo.getId());
+                dto.setHasChildren(hasChildren);
 
                 dtoList.add(dto);
             }

+ 10 - 5
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/PersonDeviceLogApiController.java

@@ -305,7 +305,7 @@ public class PersonDeviceLogApiController {
     }
 
     @PostMapping("queryCompanyList")
-    @ApiOperation(value="查询企业列表")
+    @ApiOperation(value="查询单位列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
             @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
@@ -317,10 +317,15 @@ public class PersonDeviceLogApiController {
 
         try {
             PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
-
             CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
 
-            List<CompanyInfo> companyList = companyInfoService.findByCompanyCode(companyInfo.getCode() + "%",personInfo.getId());
+            String companyCode = "";
+
+            if (personInfo.getAllowViewLocal()!=null && personInfo.getAllowViewLocal()){
+                companyCode = companyInfo.getCode() + "%";
+            }
+
+            List<CompanyInfo> companyList = companyInfoService.findByCompanyCode(companyCode, personInfo.getId());
 
             List<Map> mapList = companyList.stream().map((company)->{
                 Map<String,Object> map = new HashMap<>();
@@ -340,14 +345,14 @@ public class PersonDeviceLogApiController {
 
             for (Map map : mapList) {
                 String companyId = (String)map.get("id");
-                String companyCode = (String)map.get("code");
+                String code = (String)map.get("code");
 
                 //单位
                 long personNum = personInfoService.countByCompanyId(companyId);
                 sumPersonNum += personNum;
 
                 //当日已测人数
-                long detectedNum = personDeviceLogService.countByAttendance(companyCode,beginTime.toDate(),endTime.toDate());
+                long detectedNum = personDeviceLogService.countByAttendance(code,beginTime.toDate(),endTime.toDate());
                 sumDetectedNum += detectedNum;
 
                 map.put("personNum",personNum);