Commit 7f947997 by 宋祥

1.生产任务查询权限根据组过滤,

parent d6c4aa2e
...@@ -116,6 +116,15 @@ public class UserSessionUtils extends UserSession { ...@@ -116,6 +116,15 @@ public class UserSessionUtils extends UserSession {
} }
/** /**
* 获取登录用户的组织信息
*
* @return
*/
public static List<Org> getOrg() {
return HGXSTools.XsOrg.queryByUser();
}
/**
* 获取登录用户的公司编码 * 获取登录用户的公司编码
* *
* @return * @return
......
...@@ -152,9 +152,6 @@ ...@@ -152,9 +152,6 @@
<isNotEmpty prepend=" AND " property="unfinishWeight"> <isNotEmpty prepend=" AND " property="unfinishWeight">
unfinish_weight = #unfinishWeight# unfinish_weight = #unfinishWeight#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy"> <isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy# created_by = #createdBy#
</isNotEmpty> </isNotEmpty>
...@@ -173,19 +170,13 @@ ...@@ -173,19 +170,13 @@
<isNotEmpty prepend=" AND " property="updatedTime"> <isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime# updated_time = #updatedTime#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<!-- 移动端请求参数 -->
<isEqual prepend=" AND " property="completeStatus" compareValue="0">
trim(ifnull(complete_date,'')) = ''
</isEqual>
<isEqual prepend=" AND " property="completeStatus" compareValue="1">
trim(ifnull(complete_date,'')) != ''
</isEqual>
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCodes"> <isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate> COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
...@@ -201,6 +192,13 @@ ...@@ -201,6 +192,13 @@
<isNotEmpty prepend=" AND " property="groupNames"> <isNotEmpty prepend=" AND " property="groupNames">
GROUP_NAME IN <iterate close=")" open="(" conjunction="," property="groupNames">#groupNames[]#</iterate> GROUP_NAME IN <iterate close=")" open="(" conjunction="," property="groupNames">#groupNames[]#</iterate>
</isNotEmpty> </isNotEmpty>
<!-- 移动端请求参数 -->
<isEqual prepend=" AND " property="completeStatus" compareValue="0">
TRIM(IFNULL(COMPLETE_DATE, '')) = ''
</isEqual>
<isEqual prepend=" AND " property="completeStatus" compareValue="1">
TRIM(IFNULL(COMPLETE_DATE, '')) != ''
</isEqual>
</sql> </sql>
<sql id="appCondition"> <sql id="appCondition">
...@@ -247,7 +245,7 @@ ...@@ -247,7 +245,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
id desc, product_type asc, product_name, process_order desc ID DESC, PRODUCT_TYPE ASC, PRODUCT_NAME, PROCESS_ORDER DESC
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql> </sql>
...@@ -257,7 +255,6 @@ ...@@ -257,7 +255,6 @@
<include refid="column"/> <include refid="column"/>
FROM ${hggpSchema}.HGSC007 FROM ${hggpSchema}.HGSC007
WHERE 1=1 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/> <include refid="customCondition"/>
<include refid="orderBy"/> <include refid="orderBy"/>
</select> </select>
...@@ -265,12 +262,11 @@ ...@@ -265,12 +262,11 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007 SELECT COUNT(*) FROM ${hggpSchema}.HGSC007
WHERE 1=1 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/> <include refid="customCondition"/>
</select> </select>
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGSC007 (id, INSERT INTO ${hggpSchema}.HGSC007 (
mat_id, <!-- 物料清单ID --> mat_id, <!-- 物料清单ID -->
order_id, <!-- 生产计划ID --> order_id, <!-- 生产计划ID -->
order_detail_id, <!-- 生产计划明细ID --> order_detail_id, <!-- 生产计划明细ID -->
...@@ -313,13 +309,14 @@ ...@@ -313,13 +309,14 @@
updated_time, <!-- 更新时间 --> updated_time, <!-- 更新时间 -->
spec, spec,
length length
) ) VALUES (
VALUES (#id#, #matId#, #orderId#, #orderDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#, #matId#, #orderId#, #orderDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#,
#processCode#, #processName#, #processOrder#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #processCode#, #processName#, #processOrder#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#,
#projName#, #taskCode#, #productType#, #productCode#, #productName#, #planStartDate#, #planEndDate#, #projName#, #taskCode#, #productType#, #productCode#, #productName#, #planStartDate#, #planEndDate#,
#factoryCode#, #factoryName#, #groupCode#, #groupName#, #completeDate#, #quantity#, #finishQuantity#, #factoryCode#, #factoryName#, #groupCode#, #groupName#, #completeDate#, #quantity#, #finishQuantity#,
#unfinishQuantity#, #singleWeight#, #totalWeight#, #finishWeight#, #unfinishWeight#, #accountCode#, #createdBy#, #unfinishQuantity#, #singleWeight#, #totalWeight#, #finishWeight#, #unfinishWeight#, #accountCode#, #createdBy#,
#createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #spec#, #length#) #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #spec#, #length#
)
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -362,17 +359,12 @@ ...@@ -362,17 +359,12 @@
total_weight = #totalWeight#, <!-- 总重 --> total_weight = #totalWeight#, <!-- 总重 -->
finish_weight = #finishWeight#, <!-- 完工重量 --> finish_weight = #finishWeight#, <!-- 完工重量 -->
unfinish_weight = #unfinishWeight#, <!-- 未完工重量 --> unfinish_weight = #unfinishWeight#, <!-- 未完工重量 -->
account_code = #accountCode#, <!-- 帐套 -->
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 --> updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 --> updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime#, <!-- 更新时间 --> updated_time = #updatedTime#, <!-- 更新时间 -->
spec = #spec#, spec = #spec#,
length = #length# length = #length#
WHERE WHERE id = #id#
id = #id#
</update> </update>
<!-- 行锁 --> <!-- 行锁 -->
...@@ -381,10 +373,10 @@ ...@@ -381,10 +373,10 @@
SET CREATED_TIME = CREATED_TIME SET CREATED_TIME = CREATED_TIME
WHERE 1=1 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
id = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="ids"> <isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate> ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty> </isNotEmpty>
</update> </update>
......
package com.baosight.hggp.hg.sc.util; package com.baosight.hggp.hg.sc.util;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.xservices.xs.util.LoginUserDetails; import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -31,26 +35,12 @@ public class HgScUtils { ...@@ -31,26 +35,12 @@ public class HgScUtils {
if (LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) { if (LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
return; return;
} }
// 查询自己所在组的任务 added by songx at 20240820 // 查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName(); List<String> allGroupNames = UserSessionUtils.getAllGroupName();
if (CollectionUtils.isNotEmpty(allGroupNames)) { if (CollectionUtils.isNotEmpty(allGroupNames)) {
queryMap.put("groupNames", allGroupNames); queryMap.put("groupNames", allGroupNames);
return; queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0);
}
// 如果没有组,则查看所在厂区的任务
List<String> factoryNames = UserSessionUtils.getFactoryName();
if (CollectionUtils.isNotEmpty(factoryNames)) {
queryMap.put("factoryNames", factoryNames);
return;
}
// 如果没有厂区,则查看所在公司的任务
List<String> companyCodes = UserSessionUtils.getCompanyCode();
if (CollectionUtils.isNotEmpty(companyCodes)) {
queryMap.put("companyCodes", companyCodes);
return;
} }
// 当用户无组织机构时,抛出异常
throw new PlatException("当前用户未绑定组织机构,无法操作数据,请联系管理员!");
} }
} }
......
...@@ -6,14 +6,24 @@ ...@@ -6,14 +6,24 @@
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
<!-- 0:不启用角色权限,1或者空:启用-->
<isNotEqual property="enableRoleAuth" compareValue="0">
<include refid="HGXSDataAuth.roleAuthCondition"/>
</isNotEqual>
</sql>
<sql id="roleAuthCondition">
<!-- 无权限时使用 --> <!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode"> <isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode# DEP_CODE = #authDepCode#
</isNotEmpty> </isNotEmpty>
<!-- 仅本人和部门组合 --> <!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1"> <isEqual prepend=" AND " property="authCombination" compareValue="1" open="(" close=")">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," CREATED_BY = #authOnlyPeople#
property="authDepCodes">#authDepCodes[]#</iterate>) OR DEP_CODE IN
<iterate close=")" open="(" conjunction="," property="authDepCodes">
#authDepCodes[]#
</iterate>
</isEqual> </isEqual>
<!-- 仅本人或部门 --> <!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1"> <isNotEqual prepend=" AND " property="authCombination" compareValue="1">
...@@ -22,7 +32,9 @@ ...@@ -22,7 +32,9 @@
</isNotEmpty> </isNotEmpty>
<isNotEmpty property="authDepCodes"> <isNotEmpty property="authDepCodes">
DEP_CODE IN DEP_CODE IN
<iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate> <iterate close=")" open="(" conjunction="," property="authDepCodes">
#authDepCodes[]#
</iterate>
</isNotEmpty> </isNotEmpty>
</isNotEqual> </isNotEqual>
</sql> </sql>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<EF:EFCodeOption codeName="hggp.hgwd.fileType"/> <EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="220" sort="true"/> <EF:EFColumn ename="docName" cname="文件名称" enable="false" width="220" sort="true"/>
<EF:EFColumn ename="docType" cname="文件后缀" enable="false" width="100" align="center" sort="true"/> <EF:EFColumn ename="docType" cname="文件后缀" enable="false" width="110" align="center" sort="true"/>
<EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/> <EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/>
<EF:EFColumn ename="createdTime" cname="上传时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime" <EF:EFColumn ename="createdTime" cname="上传时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true" dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment