@@ -1,4 +1,3 @@
-
package com.qunzhixinxi.hnqz.common.core.constant;
/**
@@ -7,191 +6,190 @@ package com.qunzhixinxi.hnqz.common.core.constant;
*/
public interface SecurityConstants {
- /**
- * 刷新
- */
- String REFRESH_TOKEN = "refresh_token";
- * 验证码有效期
- int CODE_TIME = 300;
- * 验证码长度
- String CODE_SIZE = "4";
- * 角色前缀
- String ROLE = "ROLE_";
- * 前缀
- String PIGX_PREFIX = "hnqz_";
- * oauth 相关前缀
- String OAUTH_PREFIX = "oauth:";
- * 项目的license
- String PIGX_LICENSE = "made by hnqz";
- * 内部
- String FROM_IN = "Y";
- * 标志
- String FROM = "from";
- * OAUTH URL
- String OAUTH_TOKEN_URL = "/oauth/token";
- * 手机号登录URL
- String SMS_TOKEN_URL = "/mobile/token/sms";
- * 社交登录URL
- String SOCIAL_TOKEN_URL = "/mobile/token/social";
- * 自定义登录URL
- String MOBILE_TOKEN_URL = "/mobile/token/*";
- * 微信获取OPENID
- String WX_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/oauth2/access_token"
- + "?appid=%s&secret=%s&code=%s&grant_type=authorization_code";
- * 微信小程序OPENID
- String MINI_APP_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/jscode2session"
- + "?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code";
- * 码云获取token
- String GITEE_AUTHORIZATION_CODE_URL = "https://gitee.com/oauth/token?grant_type="
- + "authorization_code&code=%S&client_id=%s&redirect_uri=" + "%s&client_secret=%s";
- * 开源中国获取token
- String OSC_AUTHORIZATION_CODE_URL = "https://www.oschina.net/action/openapi/token";
- * 码云获取用户信息
- String GITEE_USER_INFO_URL = "https://gitee.com/api/v5/user?access_token=%s";
- * 开源中国用户信息
- String OSC_USER_INFO_URL = "https://www.oschina.net/action/openapi/user?access_token=%s&dataType=json";
- * {bcrypt} 加密的特征码
- String BCRYPT = "{bcrypt}";
- * sys_oauth_client_details 表的字段,不包括client_id、client_secret
- String CLIENT_FIELDS = "client_id, CONCAT('{noop}',client_secret) as client_secret, resource_ids, scope, "
- + "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
- + "refresh_token_validity, additional_information, autoapprove";
- * JdbcClientDetailsService 查询语句
- String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS + " from sys_oauth_client_details";
- * 按条件client_id 查询
- String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ? and del_flag = 0 and tenant_id = %s";
- * 资源服务器默认bean名称
- String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";
- * 客户端模式
- String CLIENT_CREDENTIALS = "client_credentials";
- * 用户ID字段
- String DETAILS_USER_ID = "id";
- * 用户名
- String DETAILS_USERNAME = "username";
- * 用户基本信息
- String DETAILS_USER = "user_info";
- * 用户名phone
- String DETAILS_PHONE = "phone";
- * 头像
- String DETAILS_AVATAR = "avatar";
- * 用户部门字段
- String DETAILS_DEPT_ID = "deptId";
- * 租户ID 字段
- String DETAILS_TENANT_ID = "tenantId";
- * 协议字段
- String DETAILS_LICENSE = "license";
- * 激活字段 兼容外围系统接入
- String ACTIVE = "active";
- * AES 加密
- String AES = "aes";
- String USERINFO_PLATID="platId";
- String USERINFO_DRUGENTID="drugEntId";
- String USERINFO_ROLES="roles";
+ /**
+ * 刷新
+ */
+ String REFRESH_TOKEN = "refresh_token";
+
+ * 验证码有效期
+ int CODE_TIME = 300;
+ * 验证码长度
+ String CODE_SIZE = "4";
+ * 角色前缀
+ String ROLE = "ROLE_";
+ * 前缀
+ String PIGX_PREFIX = "hnqz_";
+ * oauth 相关前缀
+ String OAUTH_PREFIX = "oauth:";
+ * 项目的license
+ String PIGX_LICENSE = "made by hnqz";
+ * 内部
+ String FROM_IN = "Y";
+ * 标志
+ String FROM = "from";
+ * OAUTH URL
+ String OAUTH_TOKEN_URL = "/oauth/token";
+ * 手机号登录URL
+ String SMS_TOKEN_URL = "/mobile/token/sms";
+ * 社交登录URL
+ String SOCIAL_TOKEN_URL = "/mobile/token/social";
+ * 自定义登录URL
+ String MOBILE_TOKEN_URL = "/mobile/token/*";
+ * 微信获取OPENID
+ String WX_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/oauth2/access_token"
+ + "?appid=%s&secret=%s&code=%s&grant_type=authorization_code";
+ * 微信小程序OPENID
+ String MINI_APP_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/jscode2session"
+ + "?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code";
+ * 码云获取token
+ String GITEE_AUTHORIZATION_CODE_URL = "https://gitee.com/oauth/token?grant_type="
+ + "authorization_code&code=%S&client_id=%s&redirect_uri=" + "%s&client_secret=%s";
+ * 开源中国获取token
+ String OSC_AUTHORIZATION_CODE_URL = "https://www.oschina.net/action/openapi/token";
+ * 码云获取用户信息
+ String GITEE_USER_INFO_URL = "https://gitee.com/api/v5/user?access_token=%s";
+ * 开源中国用户信息
+ String OSC_USER_INFO_URL = "https://www.oschina.net/action/openapi/user?access_token=%s&dataType=json";
+ * {bcrypt} 加密的特征码
+ String BCRYPT = "{bcrypt}";
+ * sys_oauth_client_details 表的字段,不包括client_id、client_secret
+ String CLIENT_FIELDS = "client_id, CONCAT('{noop}',client_secret) as client_secret, resource_ids, scope, "
+ + "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
+ + "refresh_token_validity, additional_information, autoapprove";
+ * JdbcClientDetailsService 查询语句
+ String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS + " from sys_oauth_client_details";
+ * 按条件client_id 查询
+ String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ? and del_flag = 0 and tenant_id = %s";
+ * 资源服务器默认bean名称
+ String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";
+ * 客户端模式
+ String CLIENT_CREDENTIALS = "client_credentials";
+ * 用户ID字段
+ String DETAILS_USER_ID = "id";
+ * 用户名
+ String DETAILS_USERNAME = "username";
+ * 用户基本信息
+ String DETAILS_USER = "user_info";
+ * 用户名phone
+ String DETAILS_PHONE = "phone";
+ * 头像
+ String DETAILS_AVATAR = "avatar";
+ * 用户部门字段
+ String DETAILS_DEPT_ID = "deptId";
+ * 租户ID 字段
+ String DETAILS_TENANT_ID = "tenantId";
+ * 协议字段
+ String DETAILS_LICENSE = "license";
+ * 激活字段 兼容外围系统接入
+ String ACTIVE = "active";
+ * AES 加密
+ String AES = "aes";
+ String USERINFO_PLAT_ID = "platId";
+ String USERINFO_DRUG_ENT_ID = "drugEntId";
+ String USERINFO_ROLES = "roles";
}
@@ -33,85 +33,87 @@ import java.util.Optional;
@Slf4j
public class HnqzUserAuthenticationConverter implements UserAuthenticationConverter {
- private static final String N_A = "N/A";
+ private static final String N_A = "N/A";
- * Extract information about the user to be used in an access token (i.e. for resource
- * servers).
- * @param authentication an authentication representing a user
- * @return a map of key values representing the unique information about the user
- @Override
- public Map<String, ?> convertUserAuthentication(Authentication authentication) {
- Map<String, Object> response = new LinkedHashMap<>();
- response.put(USERNAME, authentication.getName());
- if (authentication.getAuthorities() != null && !authentication.getAuthorities().isEmpty()) {
- response.put(AUTHORITIES, AuthorityUtils.authorityListToSet(authentication.getAuthorities()));
- }
- return response;
+ * Extract information about the user to be used in an access token (i.e. for resource
+ * servers).
+ *
+ * @param authentication an authentication representing a user
+ * @return a map of key values representing the unique information about the user
+ @Override
+ public Map<String, ?> convertUserAuthentication(Authentication authentication) {
+ Map<String, Object> response = new LinkedHashMap<>();
+ response.put(USERNAME, authentication.getName());
+ if (authentication.getAuthorities() != null && !authentication.getAuthorities().isEmpty()) {
+ response.put(AUTHORITIES, AuthorityUtils.authorityListToSet(authentication.getAuthorities()));
+ }
+ return response;
- * Inverse of {@link #convertUserAuthentication(Authentication)}. Extracts an
- * Authentication from a map.
- * @param responseMap a map of user information
- * @return an Authentication representing the user or null if there is none
- public Authentication extractAuthentication(Map<String, ?> responseMap) {
- if (responseMap.containsKey(USERNAME)) {
- Collection<? extends GrantedAuthority> authorities = getAuthorities(responseMap);
- Map<String, ?> map = MapUtil.get(responseMap, SecurityConstants.DETAILS_USER, Map.class);
- validateTenantId(map);
- String username = MapUtil.getStr(map, SecurityConstants.DETAILS_USERNAME);
- Integer id = MapUtil.getInt(map, SecurityConstants.DETAILS_USER_ID);
- Integer deptId = MapUtil.getInt(map, SecurityConstants.DETAILS_DEPT_ID);
- Integer tenantId = MapUtil.getInt(map, SecurityConstants.DETAILS_TENANT_ID);
- String phone = MapUtil.getStr(map, SecurityConstants.DETAILS_PHONE);
- String avatar = MapUtil.getStr(map, SecurityConstants.DETAILS_AVATAR);
- String platId=MapUtil.getStr(map, SecurityConstants.USERINFO_PLATID);
- String drugEntId=MapUtil.getStr(map, SecurityConstants.USERINFO_DRUGENTID);
+ * Inverse of {@link #convertUserAuthentication(Authentication)}. Extracts an
+ * Authentication from a map.
+ * @param responseMap a map of user information
+ * @return an Authentication representing the user or null if there is none
+ public Authentication extractAuthentication(Map<String, ?> responseMap) {
+ if (responseMap.containsKey(USERNAME)) {
+ Collection<? extends GrantedAuthority> authorities = getAuthorities(responseMap);
+ Map<String, ?> map = MapUtil.get(responseMap, SecurityConstants.DETAILS_USER, Map.class);
+ validateTenantId(map);
+ String username = MapUtil.getStr(map, SecurityConstants.DETAILS_USERNAME);
+ Integer id = MapUtil.getInt(map, SecurityConstants.DETAILS_USER_ID);
+ Integer deptId = MapUtil.getInt(map, SecurityConstants.DETAILS_DEPT_ID);
+ Integer tenantId = MapUtil.getInt(map, SecurityConstants.DETAILS_TENANT_ID);
+ String phone = MapUtil.getStr(map, SecurityConstants.DETAILS_PHONE);
+ String avatar = MapUtil.getStr(map, SecurityConstants.DETAILS_AVATAR);
+ String platId = MapUtil.getStr(map, SecurityConstants.USERINFO_PLAT_ID);
+ Integer drugEntId = MapUtil.getInt(map, SecurityConstants.USERINFO_DRUG_ENT_ID);
- HnqzUser user = new HnqzUser(id, deptId, phone, avatar, tenantId, username, N_A, true, true, true, true,
- authorities,platId,drugEntId,null);
- return new UsernamePasswordAuthenticationToken(user, N_A, authorities);
- return null;
+ HnqzUser user = new HnqzUser(id, deptId, phone, avatar, tenantId, username, N_A, true, true, true, true,
+ authorities, platId, drugEntId, null);
+ return new UsernamePasswordAuthenticationToken(user, N_A, authorities);
+ return null;
- private Collection<? extends GrantedAuthority> getAuthorities(Map<String, ?> map) {
- Object authorities = map.get(AUTHORITIES);
- if (authorities instanceof String) {
- return AuthorityUtils.commaSeparatedStringToAuthorityList((String) authorities);
- if (authorities instanceof Collection) {
- return AuthorityUtils.commaSeparatedStringToAuthorityList(
- StringUtils.collectionToCommaDelimitedString((Collection<?>) authorities));
- return AuthorityUtils.NO_AUTHORITIES;
+ private Collection<? extends GrantedAuthority> getAuthorities(Map<String, ?> map) {
+ Object authorities = map.get(AUTHORITIES);
+ if (authorities instanceof String) {
+ return AuthorityUtils.commaSeparatedStringToAuthorityList((String) authorities);
+ if (authorities instanceof Collection) {
+ return AuthorityUtils.commaSeparatedStringToAuthorityList(
+ StringUtils.collectionToCommaDelimitedString((Collection<?>) authorities));
+ return AuthorityUtils.NO_AUTHORITIES;
- private void validateTenantId(Map<String, ?> map) {
- String headerValue = getCurrentTenantId();
- Integer userValue = MapUtil.getInt(map, SecurityConstants.DETAILS_TENANT_ID);
- if (StrUtil.isNotBlank(headerValue) && !userValue.toString().equals(headerValue)) {
- log.warn("请求头中的租户ID({})和用户的租户ID({})不一致", headerValue, userValue);
- // TODO: 不要提示租户ID不对,可能被穷举
- throw new HnqzAuth2Exception(SpringSecurityMessageSource.getAccessor()
- .getMessage("AbstractUserDetailsAuthenticationProvider.badTenantId", "Bad tenant ID"));
+ private void validateTenantId(Map<String, ?> map) {
+ String headerValue = getCurrentTenantId();
+ Integer userValue = MapUtil.getInt(map, SecurityConstants.DETAILS_TENANT_ID);
+ if (StrUtil.isNotBlank(headerValue) && !userValue.toString().equals(headerValue)) {
+ log.warn("请求头中的租户ID({})和用户的租户ID({})不一致", headerValue, userValue);
+ // TODO: 不要提示租户ID不对,可能被穷举
+ throw new HnqzAuth2Exception(SpringSecurityMessageSource.getAccessor()
+ .getMessage("AbstractUserDetailsAuthenticationProvider.badTenantId", "Bad tenant ID"));
- private Optional<HttpServletRequest> getCurrentHttpRequest() {
- return Optional.ofNullable(RequestContextHolder.getRequestAttributes()).filter(
- requestAttributes -> ServletRequestAttributes.class.isAssignableFrom(requestAttributes.getClass()))
- .map(requestAttributes -> ((ServletRequestAttributes) requestAttributes))
- .map(ServletRequestAttributes::getRequest);
+ private Optional<HttpServletRequest> getCurrentHttpRequest() {
+ return Optional.ofNullable(RequestContextHolder.getRequestAttributes()).filter(
+ requestAttributes -> ServletRequestAttributes.class.isAssignableFrom(requestAttributes.getClass()))
+ .map(requestAttributes -> ((ServletRequestAttributes) requestAttributes))
+ .map(ServletRequestAttributes::getRequest);
- private String getCurrentTenantId() {
- return getCurrentHttpRequest()
- .map(httpServletRequest -> httpServletRequest.getHeader(CommonConstants.TENANT_ID)).orElse(null);
+ private String getCurrentTenantId() {
+ return getCurrentHttpRequest()
+ .map(httpServletRequest -> httpServletRequest.getHeader(CommonConstants.TENANT_ID)).orElse(null);
package com.qunzhixinxi.hnqz.common.security.service;
import lombok.Getter;
@@ -13,89 +12,87 @@ import java.util.Collection;
* @author hnqz
* @date 2020/4/16 扩展用户信息
+@Getter
public class HnqzUser extends User {
- private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
- * 用户ID
- @Getter
- private Integer id;
- * 部门ID
- private Integer deptId;
- * 手机号
- private String phone;
- private String avatar;
- * 租户ID
- private Integer tenantId;
- private String platId;
- private String drugEntId;
- private Integer[] roles;
- * Construct the <code>User</code> with the details required by
- * {@link DaoAuthenticationProvider}.
- * @param id 用户ID
- * @param deptId 部门ID
- * @param tenantId 租户ID
- * @param username the username presented to the
- * <code>DaoAuthenticationProvider</code>
- * @param password the password that should be presented to the
- * @param enabled set to <code>true</code> if the user is enabled
- * @param accountNonExpired set to <code>true</code> if the account has not expired
- * @param credentialsNonExpired set to <code>true</code> if the credentials have not
- * expired
- * @param accountNonLocked set to <code>true</code> if the account is not locked
- * @param authorities the authorities that should be granted to the caller if they
- * presented the correct username and password and the user is enabled. Not null.
- * @throws IllegalArgumentException if a <code>null</code> value was passed either as
- * a parameter or as an element in the <code>GrantedAuthority</code> collection
- public HnqzUser(Integer id, Integer deptId, String phone, String avatar, Integer tenantId, String username,
- String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired,
- boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities,String platId,String drugEntId,Integer[] roles) {
- super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
- this.id = id;
- this.deptId = deptId;
- this.phone = phone;
- this.avatar = avatar;
- this.tenantId = tenantId;
- this.platId=platId;
- this.drugEntId=drugEntId;
- this.roles=roles;
+ private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
+ * 用户ID
+ private final Integer id;
+ * 部门ID
+ private final Integer deptId;
+ * 手机号
+ private final String phone;
+ private final String avatar;
+ * 租户ID
+ private final Integer tenantId;
+ * 平台ID(手机号)
+ private final String platId;
+ * 药企ID
+ private final Integer drugEntId;
+ * 角色
+ private final Integer[] roles;
+ * Construct the <code>User</code> with the details required by
+ * {@link DaoAuthenticationProvider}.
+ * @param id 用户ID
+ * @param deptId 部门ID
+ * @param tenantId 租户ID
+ * @param username the username presented to the
+ * <code>DaoAuthenticationProvider</code>
+ * @param password the password that should be presented to the
+ * @param enabled set to <code>true</code> if the user is enabled
+ * @param accountNonExpired set to <code>true</code> if the account has not expired
+ * @param credentialsNonExpired set to <code>true</code> if the credentials have not
+ * expired
+ * @param accountNonLocked set to <code>true</code> if the account is not locked
+ * @param authorities the authorities that should be granted to the caller if they
+ * presented the correct username and password and the user is enabled. Not null.
+ * @throws IllegalArgumentException if a <code>null</code> value was passed either as
+ * a parameter or as an element in the <code>GrantedAuthority</code> collection
+ public HnqzUser(Integer id, Integer deptId, String phone, String avatar, Integer tenantId, String username,
+ String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired,
+ boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities, String platId,
+ Integer drugEntId, Integer[] roles) {
+ super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
+ this.id = id;
+ this.deptId = deptId;
+ this.phone = phone;
+ this.avatar = avatar;
+ this.tenantId = tenantId;
+ this.platId = platId;
+ this.drugEntId = drugEntId;
+ this.roles = roles;
@@ -1,28 +0,0 @@
-package com.qunzhixinxi.hnqz.admin.api.constant.enums;
-import com.baomidou.mybatisplus.annotation.EnumValue;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-/**
- * 回调状态enum
- *
- * @author lixuesong
- * @date 2022年03月18日 17:44
-@Getter
-@AllArgsConstructor
-public enum GigCallBackStatus {
- // 回调状态
- RETURNED(0, "已返回"),
- IN_PROGRESS(1, "进行中"),
- NOT_SUBMIT(2, "未发起");
- @EnumValue
- private int code;
- private String desc;
-}
@@ -1,41 +0,0 @@
- * 零工渠道(如税邦云的中金、平安银行)
- * @date 2022年03月03日 14:06
-public enum GigChannelEnum {
- // 渠道
- DEFAULT(0, "默认渠道"),
- CICC(1, "中金"),
- PING_AN_BANK(2, "平安银行");
- * 根据枚举编码获取枚举对象
- * @param code
- * @return
- public static GigChannelEnum resolve(int code){
- for (GigChannelEnum channelEnum: GigChannelEnum.values()){
- if (channelEnum.code == code){
- return channelEnum;
- return DEFAULT;
@@ -1,152 +0,0 @@
- * 零工平台类型(订单支付方式类型)
- * @date 2022年03月02日 11:10
-public enum GigTypeEnum {
- // 零工平台类型
- REN_LI_JIA(0, "人力家", "人力家", RenlijiaCertStatus.class),
- OLADING(2, "钉灵工", "钉灵工-海南飞亿", OladingCertStatus.class),
- YEE(3, "易联数科", "易联数科", YeeCertStatus.class),
- ZHENG_QI_ZHI_XING(4, "正启之星", "正启之星", ZhengQiZhiXingCertStatus.class),
- LANG_CHAO(5, "浪潮", "浪潮", LangChaoCertStatus.class),
- HUI_QI_YUN(6, "汇企云", "汇企云", HuiQiYunCertStatus.class),
- ZHONG_YI_YUN(7, "众蚁云", "众蚁云", ZhongYiYunCertStatus.class),
- ZHONG_ZHI(8, "中智", "中智", ZhongZhiCertStatus.class),
- QI_FU(9, "福建企赋", "福建企赋", ZhongYiYunCertStatus.class),
- SHEN_ZHEN_REN_CAI(10, "深圳人才", "深圳人才", OladingCertStatus.class),
- YI_MA(11, "易马财税", "易马财税", ZhengQiZhiXingCertStatus.class),
- XIN_SHI_YI(12, "薪事易", "薪事易", XinShiYiCertStatus.class),
- HE_CHUANG(13, "合创众盈", "合创众盈", OladingCertStatus.class),
- MAH_SETTLE(99, "MAH结算", "MAH结算", null);
- * 对应原有subjectType值
- private String desc2;
- private Class<?> statusClass;
- public static GigTypeEnum resolve(int code) {
- for (GigTypeEnum gigTypeEnum : GigTypeEnum.values()) {
- if (code == gigTypeEnum.getCode()) {
- return gigTypeEnum;
- * 根据认证状态code获取对应字符串
- * @param gigType
- * @param certStatus
- public static String getCertStatusByCode(GigTypeEnum gigType, int certStatus) {
- String certStatusStr = "";
- switch (gigType) {
- case REN_LI_JIA:
- certStatusStr = RenlijiaCertStatus.resolve(certStatus).name();
- break;
- case YEE:
- certStatusStr = YeeCertStatus.resolve(String.valueOf(certStatus)).name();
- case OLADING:
- case SHEN_ZHEN_REN_CAI:
- case HE_CHUANG:
- certStatusStr = OladingCertStatus.resolve(String.valueOf(certStatus)).name();
- case ZHENG_QI_ZHI_XING:
- case YI_MA:
- certStatusStr = ZhengQiZhiXingCertStatus.resolve(certStatus).name();
- case LANG_CHAO:
- certStatusStr = LangChaoCertStatus.resolve(certStatus).name();
- case HUI_QI_YUN:
- certStatusStr = HuiQiYunCertStatus.resolve(certStatus).name();
- case ZHONG_YI_YUN:
- certStatusStr = ZhongYiYunCertStatus.resolve(certStatus).name();
- case ZHONG_ZHI:
- certStatusStr = ZhongZhiCertStatus.resolve(certStatus).name();
- case QI_FU:
- case XIN_SHI_YI:
- certStatusStr = XinShiYiCertStatus.resolve(certStatus).name();
- default:
- return certStatusStr;
- * 根据认证状态code获取对应中文
- public static String getCertStatusNameByCode(GigTypeEnum gigType, int certStatus) {
- certStatusStr = RenlijiaCertStatus.resolve(certStatus).getMessage();
- certStatusStr = YeeCertStatus.resolve(String.valueOf(certStatus)).getMessage();
- certStatusStr = OladingCertStatus.resolve(String.valueOf(certStatus)).getMessage();
- certStatusStr = ZhengQiZhiXingCertStatus.resolve(certStatus).getMessage();
- certStatusStr = LangChaoCertStatus.resolve(certStatus).getMessage();
- certStatusStr = HuiQiYunCertStatus.resolve(certStatus).getMessage();
- certStatusStr = ZhongYiYunCertStatus.resolve(certStatus).getMessage();
- certStatusStr = ZhongZhiCertStatus.resolve(certStatus).getMessage();
- certStatusStr = XinShiYiCertStatus.resolve(certStatus).getMessage();
@@ -1,39 +0,0 @@
- * @author: lixuesong
- * @createTime: 2023/03/29 11:33
- * @description: 汉唐认证状态
-public enum HanTangCertStatus {
- // 签约状态
- UN_SIGN(0, "未签约"),
- CERT(1, "已认证"),
- SIGN(2, "已签约");
- private final int code;
- private final String message;
- * @param code 枚举编码
- * @return 如果存在返回枚举,否则返回 {@code null}
- public static HanTangCertStatus resolve(final int code) {
- for (HanTangCertStatus certStatus : HanTangCertStatus.values()) {
- if (certStatus.getCode() == code) {
- return certStatus;
- return UN_SIGN;
- * @createTime: 2022/11/30 14:47
- * @description: 汇企云认证状态
-public enum HuiQiYunCertStatus {
- public static HuiQiYunCertStatus resolve(final int code) {
- for (HuiQiYunCertStatus certStatus : HuiQiYunCertStatus.values()) {
- * @createTime: 2022/10/27 15:03
- * @description: 浪潮认证状态
-public enum LangChaoCertStatus {
- // 签约状态(注意:CERT实际对应浪潮的已签约状态/最终状态,SIGN为我们内部额外添加的状态)
- public static LangChaoCertStatus resolve(final int code) {
- for (LangChaoCertStatus certStatus : LangChaoCertStatus.values()) {
@@ -1,46 +0,0 @@
- * {@code CertStatus}
- * <p>
- * 易联数科签约状态枚举
- * @author Hengchen.Sun
- * @version 1.0.0
- * @date 2022/03/09 22:21
-public enum OladingCertStatus {
- UN_SIGNED("0", "未签约"),
- CERT("1", "已认证"),
- SIGNED("2", "已签约"),
- SIGNING("3", "签约中"),
- UN_CERT("4", "未认证");
- private final String code;
- public static OladingCertStatus resolve(final String code) {
- for (OladingCertStatus oladingCertStatus : OladingCertStatus.values()) {
- if (oladingCertStatus.getCode().equals(code)) {
- return oladingCertStatus;
- return UN_SIGNED;
- * 人力家认证状态
- * @date 2022年03月11日 10:52
-public enum RenlijiaCertStatus {
- // 认证状态
- CER_STATUS_1(1, "认证成功"),
- CER_STATUS_2(2, "认证失败"),
- CER_STATUS_3(3, "认证中"),
- CER_STATUS_4(4, "未认证");
- public static RenlijiaCertStatus resolve(final int code) {
- for (RenlijiaCertStatus certStatus : RenlijiaCertStatus.values()) {
- return CER_STATUS_4;
@@ -1,131 +0,0 @@
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
- * 税源地
-public enum SubjectLocation {
- // 仁励家通道
- REN_LI_JIA("REN_LI_JIA", GigTypeEnum.REN_LI_JIA, "人力家", 0, "renlijia_invoice"),
- //// 税邦云通道
- //ZHONG_YING("ZHONG_YING", GigTypeEnum.TAX_HELPOR, "税邦云", 1, "tax_helper_invoice"),
- //LUO_SHU_YUN("LUO_SHU_YUN", GigTypeEnum.TAX_HELPOR, "税邦云", 2, "tax_helper_invoice"),
- // 钉零工通道
- FEI_YI("FEI_YI", GigTypeEnum.OLADING, "钉灵工-海南飞亿", 3, "olading_invoice"),
- JIN_YUAN("JIN_YUAN", GigTypeEnum.OLADING, "金园数科", 4, "olading_jinyuan_invoice"),
- XIN_TAI_ZI("XIN_TAI_ZI", GigTypeEnum.OLADING, "钉灵工-河南薪泰梓", 5, "olading_henan_invoice"),
- // 易联
- YI_LIAN("YI_LIAN", GigTypeEnum.YEE, "易联数科", 6, "yee_invoice"),
- // 正启之星
- ZHENG_QI_ZHI_XING("ZHENG_QI_ZHI_XING", GigTypeEnum.ZHENG_QI_ZHI_XING, "安之慧", 7, "zheng_qi_zhi_xing_invoice"),
- // 浪潮
- LANG_CHAO("LANG_CHAO", GigTypeEnum.LANG_CHAO, "浪潮", 8, "langchao_invoice"),
- // 正启之星-江西
- JIANG_XI("JIANG_XI", GigTypeEnum.ZHENG_QI_ZHI_XING, "正启之星-江西", 9, "zheng_qi_zhi_xing_jiang_xi_invoice"),
- // 汇企云
- HUI_QI_YUN("HUI_QI_YUN", GigTypeEnum.HUI_QI_YUN, "汇企云", 10, "hui_qi_yun_invoice"),
- // 众蚁云
- ZHONG_YI_YUN("ZHONG_YI_YUN", GigTypeEnum.ZHONG_YI_YUN, "众蚁云", 11, "zhong_yi_yun_invoice"),
- // 中智
- ZHONG_ZHI("ZHONG_ZHI", GigTypeEnum.ZHONG_ZHI, "中智", 12, "zhongzhi_invoice"),
- ZHAO_YU("ZHAO_YU", GigTypeEnum.OLADING, "钉灵工-河南兆宇", 13, "olading_zhaoyu_invoice"),
- QI_FU("QI_FU", GigTypeEnum.QI_FU, "福建企赋", 14, "qifu_invoice"),
- SHEN_ZHEN_REN_CAI("SHEN_ZHEN_REN_CAI", GigTypeEnum.SHEN_ZHEN_REN_CAI, "深圳之光", 14, "shenzhenrencai_invoice"),
- YI_MA("YI_MA", GigTypeEnum.YI_MA, "易马财税", 16, "yi_ma_invoice"),
- XIN_SHI_YI("XIN_SHI_YI", GigTypeEnum.XIN_SHI_YI, "薪事易-海南飞亿", 17, "xinshiyi_invoice"),
- // 合创众盈
- HE_CHUANG_ZHONG_ZHI("HE_CHUANG_ZHONG_ZHI", GigTypeEnum.HE_CHUANG, "合创众盈-天津中智", 18, "hechuang_zhongzhi_invoice"),
- HE_CHUANG_REN_CAI_YUN("HE_CHUANG_REN_CAI_YUN", GigTypeEnum.HE_CHUANG, "合创众盈-福州人才云", 19, "hechuang_rencaiyun_invoice"),
- MAH_SETTLE("MAH_SETTLE", GigTypeEnum.MAH_SETTLE, "MAH结算", 99, "");
- * 税源地类型
- private final String type;
- * 渠道类型
- private final GigTypeEnum gigType;
- * 描述
- private final String description;
- * 排序
- private final Integer sort;
- * 发票类目
- private final String invoiceType;
- * 根据gigType获取枚举
- public static List<SubjectLocation> getByGigType(GigTypeEnum gigType) {
- List<SubjectLocation> list = new ArrayList<>();
- for (SubjectLocation subjectLocation : SubjectLocation.values()) {
- if (subjectLocation.gigType.equals(gigType)) {
- list.add(subjectLocation);
- return list;
- * 根据type获取枚举
- * @param type
- public static SubjectLocation resolve(String type) {
- for (SubjectLocation subjectLocation: SubjectLocation.values()){
- if (subjectLocation.type.equals(type)){
- return subjectLocation;
- * 获取所有渠道对应的发票类目type
- * @return 发票类目type列表
- public static List<String> getAllInvoices() {
- return Arrays.stream(SubjectLocation.values()).map(SubjectLocation::getInvoiceType).collect(Collectors.toList());
@@ -1,53 +0,0 @@
- * 结算渠道
-public enum SubjectTypeEnum {
- TYPE_RENLIJIA("0", "人力家"),
- TYPE_SHUIBANGYUN("1", "税邦云"),
- TYPE_OLADING("2", "自由职家"),
- TYPE_YEE("3", "易联数科"),
- TYPE_ZHENG_QI_ZHI_XING("4", "政企之星"),
- TYPE_LANG_CHAO("5", "浪潮"),
- TYPE_HUI_QI_YUN("6", "汇企云"),
- TYPE_ZHONG_YI_YUN("7", "众蚁云"),
- TYPE_ZHONG_ZHI("8", "中智"),
- TYPE_QI_FU("9", "福建企赋"),
- TYPE_SHEN_ZHEN_REN_CAI("10", "深圳人才"),
- TYPE_YI_MA("11", "易马财税"),
- TYPE_XIN_SHI_YI("12", "薪事易"),
- TYPE_HE_CHUANG("13", "合创众盈"),
- ENABLE_FLAG_FALSE("0", "无效"),
- ENABLE_FLAG_TRUE("1", "有效"),
- TYPE_NULL("", "")
- ;
- * 类型
- private String code;
- public static SubjectTypeEnum resolve(String code) {
- for (SubjectTypeEnum subjectTypeEnum: SubjectTypeEnum.values()){
- if (subjectTypeEnum.code.equals(code) && subjectTypeEnum.name().startsWith("TYPE_")){
- return subjectTypeEnum;
- return TYPE_NULL;
@@ -1,48 +0,0 @@
- * 微信自动回复相关类型
- * @date 2021年05月06日 15:05
-public enum SysWxReplyMessageEnum {
- * 消息类型
- MESSAGE_TYPE_TEXT(0, "文字"),
- MESSAGE_TYPE_IMAGE(1, "图片"),
- MESSAGE_TYPE_VIDEO(2, "视频"),
- MESSAGE_TYPE_MULTI(3, "图文消息"),
- * 消息的素材类型
- MESSAGE_MEDIA_TYPE_TEXT(0, "文字"),
- MESSAGE_MEDIA_TYPE_IMAGE(1, "图片"),
- MESSAGE_MEDIA_TYPE_VIDEO(2, "视频"),
- * 微信的素材类型
- WX_MEDIA_TYPE_TEXT(0, "text"),
- WX_MEDIA_TYPE_IMAGE(1, "image"),
- WX_MEDIA_TYPE_VIDEO(2, "video"),
- WX_MEDIA_TYPE_NEWS(3, "news"),
- WX_MEDIA_TYPE_TRANSFER(4, "transfer_customer_service");
- private Integer type;
- private String description;
@@ -1,38 +0,0 @@
- * 薪事易认证状态
- * @date 2024/02/04
-public enum XinShiYiCertStatus {
- SIGN(2, "已签约"),
- UN_CERT(3, "未认证");
- public static XinShiYiCertStatus resolve(final int code) {
- for (XinShiYiCertStatus certStatus : XinShiYiCertStatus.values()) {
@@ -1,42 +0,0 @@
-public enum YeeCertStatus {
- SIGNED("1", "已签约"),
- TERMINATED("2", "已解约");
- public static YeeCertStatus resolve(final String code) {
- for (YeeCertStatus yeeCertStatus : YeeCertStatus.values()) {
- if (yeeCertStatus.getCode().equals(code)) {
- return yeeCertStatus;
- * @createTime: 2022/09/07 10:58
- * @description: 正启之星认证状态
-public enum ZhengQiZhiXingCertStatus {
- public static ZhengQiZhiXingCertStatus resolve(final int code) {
- for (ZhengQiZhiXingCertStatus certStatus : ZhengQiZhiXingCertStatus.values()) {
@@ -1,40 +0,0 @@
- * 众蚁云认证状态
- * @author snows
- * @date 2023/2/1 14:04
-public enum ZhongYiYunCertStatus {
- SIGNING(3, "签约中");
- public static ZhongYiYunCertStatus resolve(final int code) {
- for (ZhongYiYunCertStatus certStatus : ZhongYiYunCertStatus.values()) {
- * @description: 中智认证状态
-public enum ZhongZhiCertStatus {
- public static ZhongZhiCertStatus resolve(final int code) {
- for (ZhongZhiCertStatus certStatus : ZhongZhiCertStatus.values()) {
@@ -1,51 +0,0 @@
-package com.qunzhixinxi.hnqz.admin.api.dto;
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.SubjectLocation;
-import lombok.Data;
-import java.io.Serializable;
- * {@code ExecSettlementDTO} 执行结算DTO
- * @date 2021-05-27
- * @since ver.1.0.0
-@Data
-public class ExecSettlementDTO implements Serializable {
- private static final long serialVersionUID = 8082076164255320136L;
- * 部门id
- private String mobile;
- * 积分包id
- private Integer packageId;
- * 结算dto
- private List<SettlementDTO> settlementDTOList;
- * 结算总金额
- private String amount;
- private SubjectLocation location;
@@ -1,37 +0,0 @@
-import java.time.LocalDateTime;
- * 结算手动回调参数
- * @date 2024/02/01
-public class NotifyByOneSelfDTO implements Serializable {
- private static final long serialVersionUID = -1814430828743680757L;
- * 积分包id(多个逗号拼接)
- private String packageId;
- * 积分包名称
- private String scorePackageName;
- * 结算回调时间
- private LocalDateTime notifyTime;
- * 结算状态
- private Integer settleStatus;
@@ -1,47 +0,0 @@
- * {@code ScorePackageSettleNoteDTO} 类积分包结算dto
-public class ScorePackageSettleNoteDTO implements Serializable {
- private static final long serialVersionUID = -4419586532513327754L;
- // 手机号
- // 部门id
- // 积分包id
- // 结算记录id
- private Integer settleNoteId;
- // 税源地
- // 发票类型
- private Integer invoiceType;
- // 发票类目
- private String invoiceCategory;
- // 任务id
- private Integer taskId;
- // 结算金额
@@ -1,89 +0,0 @@
-import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
- * 结算管理配置参数
-public class SettleConfigDTO implements Serializable {
- private static final long serialVersionUID = 6592319640299289406L;
- @NotNull(message = "deptId必填")
- * 各渠道配置
-// @NotEmpty(message = "subList必填")
- private List<DeptSub> subList;
- * 渠道配置
- @Data
- public static class DeptSub {
- * 认证方式
- private String subjectType;
- * 结算通道
- private Integer subjectChannel;
- private SubjectLocation subjectLocation;
- * 限额
- private BigDecimal limitAmount;
- * 是否有效:0-无效 1-生效
- private String enableFlag;
- * 税邦云用户类型id
- private String subjectUserType;
- * 税邦云用户类型对应的发票类目
- private String[] subjectInvoiceCategory;
- * 认证是否启用:1:启用,0:停用
- private Boolean certEnable;
- * 结算是否启用:1:启用,0:停用
- private Boolean settleEnable;
- * E证通认证是否启用:1-启用,0-停用
- private Boolean eidEnable;
@@ -1,33 +0,0 @@
- * {@code SettlementDTO} 类 结算DTO
-public class SettlementDTO implements Serializable {
- private static final long serialVersionUID = -229912291812823804L;
- * 任务id
- * 结算申请记录id
- * 结算金额id
@@ -1,7 +1,5 @@
package com.qunzhixinxi.hnqz.admin.api.dto;
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.GigTypeEnum;
import lombok.Data;
import java.io.Serializable;
@@ -68,17 +66,6 @@ public class UserSignCertDTO implements Serializable {
private String agreementUrl;
- * 零工认证渠道
- @Deprecated
- private List<GigTypeEnum> gigTypeList;
* 验证码
@@ -3,7 +3,6 @@ package com.qunzhixinxi.hnqz.admin.api.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@@ -43,8 +42,4 @@ public class MonitoringIndicator extends Model<MonitoringIndicator> {
private BigDecimal yaoyiLimitAmount;
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
@@ -44,10 +43,6 @@ public class SysDeptSub extends Model<SysDeptSub> {
private Integer subjectChannel;
private BigDecimal limitAmount;
@@ -177,7 +177,7 @@ public class SysUser implements Serializable {
* 物明经销商管理平台ID
+ private Integer drugEntId;
@@ -3,10 +3,6 @@ package com.qunzhixinxi.hnqz.admin.api.entity;
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.GigCallBackStatus;
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.GigChannelEnum;
@@ -41,26 +37,6 @@ public class SysUserSub extends Model<SysUserSub> {
private Integer deptId;
- private GigTypeEnum gigType;
- * 渠道
- private GigChannelEnum gigChannel;
- * 回调状态
- private GigCallBackStatus callbackStatus;
* 认证状态
@@ -1,13 +1,13 @@
package com.qunzhixinxi.hnqz.admin.api.entity;
+import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.qunzhixinxi.hnqz.admin.api.constant.UpmsType;
-import lombok.EqualsAndHashCode;
+import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Set;
@@ -20,160 +20,160 @@ import java.util.Set;
@Data
@TableName("wm_da_agent")
-@EqualsAndHashCode(callSuper = true)
-public class WmDaAgent extends Model<WmDaAgent> {
- private static final long serialVersionUID = 1L;
- * 代理商类型(团队:AT, 公司: AE)
- private String agentType;
- @TableId
- private String id;
- * 公司名称
- private String gsmc;
- * 营业执照
- private String yyzz;
- * 社保缴纳证明
- private String sbjnzm;
- * 法人身份证证明-正面
- private String frsfzzmZm;
- * 法人身份证证明-背面
- private String frsfzzmBm;
- * 法人身份证证明-手持
- private String frsfzzmSc;
- * 是否审核
- private String isExamine;
- * 证件类型
- private String zjType;
- * 证件号码
- private String zjNumber;
- * 结算账号
- private String jsAccount;
- * 关联药企
- private String extDrugEnt;
- * 组织机构ID
- private String deptId;
- * 是否删除
- private String delFlag;
- * 是否禁用
- * 所属租户
- * 创建时间
- private LocalDateTime createTime;
- * 创建人
- private Integer createUser;
- * 更新时间
- private LocalDateTime updateTime;
- * 更新人
- private String updateUser;
- private String temp1;
- private String temp2;
- * 派工权限
- private String pgqx;
- * 企业类型
- private String qylx;
- private String management;
- * 结算主体类型:0->人力家,1->税邦云
- private String[] subjectType;
- * MAH结算-药企deptId
- private Integer mahSettleDeptId;
- * 是否允许结算(选择“允许结算”时,相当于打开了MAH支付权限,该CSO结算时可以选择药企,走药企结算。)
- @TableField(exist = false)
- private Boolean mahSettleFlag;
- private Map<String, Integer> subjectTypeAndChannel;
- * 部门专用权限限制(0.导出)
- private String[] deptPermissions;
- * 对应sys_dept表level字段
- private Integer deptLevel;
- * 财务复核方式(字段存于sys_dept表)
- private UpmsType.FinancialReviewType financialReviewType;
- * csm用户id
- private Set<Integer> csmUserIdList;
+public class WmDaAgent implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+ * 代理商类型(团队:AT, 公司: AE)
+ private String agentType;
+ * 公司名称
+ private String gsmc;
+ * 营业执照
+ private String yyzz;
+ * 社保缴纳证明
+ private String sbjnzm;
+ * 法人身份证证明-正面
+ private String frsfzzmZm;
+ * 法人身份证证明-背面
+ private String frsfzzmBm;
+ * 法人身份证证明-手持
+ private String frsfzzmSc;
+ * 是否审核
+ private String isExamine;
+ * 证件类型
+ private String zjType;
+ * 证件号码
+ private String zjNumber;
+ * 结算账号
+ private String jsAccount;
+ * 关联药企
+ private String extDrugEnt;
+ * 组织机构ID
+ private Integer deptId;
+ * 是否删除
+ private String delFlag;
+ * 是否禁用
+ private String enableFlag;
+ * 所属租户
+ private Integer tenantId;
+ * 创建时间
+ private LocalDateTime createTime;
+ * 创建人
+ private Integer createUser;
+ * 更新时间
+ private LocalDateTime updateTime;
+ * 更新人
+ private String updateUser;
+ private String drugEntId;
+ private String temp1;
+ private String temp2;
+ * 派工权限
+ private String pgqx;
+ * 企业类型
+ private String qylx;
+ private String management;
+ * 结算主体类型:0->人力家,1->税邦云
+ private String[] subjectType;
+ * MAH结算-药企deptId
+ private Integer mahSettleDeptId;
+ * 是否允许结算(选择“允许结算”时,相当于打开了MAH支付权限,该CSO结算时可以选择药企,走药企结算。)
+ @TableField(exist = false)
+ private Boolean mahSettleFlag;
+ private Map<String, Integer> subjectTypeAndChannel;
+ * 部门专用权限限制(0.导出)
+ private String[] deptPermissions;
+ * 对应sys_dept表level字段
+ private Integer deptLevel;
+ * 财务复核方式(字段存于sys_dept表)
+ private UpmsType.FinancialReviewType financialReviewType;
+ * csm用户id
+ private Set<Integer> csmUserIdList;
@@ -20,95 +20,94 @@ import java.util.Set;
@TableName("wm_da_drug_ent")
-public class WmDaDrugEnt extends Model<WmDaDrugEnt> {
- * 企业名称
- private String entname;
- * 统一社会信用代码
- private String entcode;
- private String temp3;
- private String temp4;
- private Integer updateUser;
- * 管理模式
- * 结算主体和通道
+public class WmDaDrugEnt implements Serializable {
+ * 企业名称
+ private String entname;
+ * 统一社会信用代码
+ private String entcode;
+ private String temp3;
+ private String temp4;
+ private Integer updateUser;
+ * 管理模式
+ * 结算主体和通道
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.AllArgsConstructor;
@@ -28,8 +27,7 @@ import java.util.Set;
@TableName(value = "wm_score_package")
-public class WmScorePackage extends Model<WmScorePackage> {
+public class WmScorePackage implements Serializable {
private static final long serialVersionUID = 1L;
@@ -40,7 +38,7 @@ public class WmScorePackage extends Model<WmScorePackage> {
* 药企ID
* 积分包序列号
@@ -88,11 +86,11 @@ public class WmScorePackage extends Model<WmScorePackage> {
* 一级代理商
- private String level1Id;
+ private Integer level1Id;
* 二级代理商
- private String level2Id;
+ private Integer level2Id;
* 众包ID
@@ -222,6 +220,7 @@ public class WmScorePackage extends Model<WmScorePackage> {
* 已支付积分值
private Integer payScore;
* 接包对象
@@ -422,9 +421,6 @@ public class WmScorePackage extends Model<WmScorePackage> {
@TableField(exist = false)
private String subjectLocation;
- @TableField(value = "sub_location")
* 数据来源类型(0:手动上传,1:系统对接)
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.qunzhixinxi.hnqz.admin.api.constant.UpmsState;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.CategoryEnum;
@@ -141,11 +140,6 @@ public class WmScorePackageSettleNote extends Model<WmScorePackageSettleNote> {
private String subType;
* 第三方任务id
@@ -110,7 +110,7 @@ public class WmTask extends Model<WmTask> {
* 服务药企
* 分享图片地址
@@ -25,7 +25,7 @@ public class WmTaskRule extends Model<WmTaskRule> {
- private String drugentId;
+ private Integer drugentId;
* 规则类型,1药企 2一级代理商
@@ -39,17 +39,17 @@ private static final long serialVersionUID = 1L;
- private String durgentId;
+ private Integer durgentId;
- private String taskEntId;
+ private Integer taskEntId;
* 完成后可获得分
@@ -26,11 +26,11 @@ public class WmTaskTypeEntRef extends Model<WmTaskTypeEntRef> {
* 代理商ID
- private String agentId;
+ private Integer agentId;
* 组织机构ID
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
@@ -82,9 +81,5 @@ public class XinbadaInputRecord extends Model<XinbadaInputRecord> {
private LocalDateTime createTime;
- * 零工平台类型
@@ -1,8 +1,5 @@
package com.qunzhixinxi.hnqz.admin.api.model;
@@ -18,21 +15,6 @@ public class GigBaseInfoModel implements Serializable {
private static final long serialVersionUID = 1350706535215124015L;
- private SubjectLocation gigLocation;
* 绑卡操作类型(captcha-获取验证码)
@@ -1,6 +1,5 @@
package com.qunzhixinxi.hnqz.admin.api.model.input;
import java.time.LocalDate;
@@ -30,8 +29,6 @@ public class SettleAmountMonitorInput {
private LocalDate endTime;
private SettleAmountMonitorInput() {
LocalDate date = LocalDate.now();
this.startTime = date.withDayOfMonth(1);
@@ -39,18 +36,18 @@ public class SettleAmountMonitorInput {
- public SettleAmountMonitorInput(List<String> idCards, List<Integer> settleNoteIds, SubjectLocation location) {
- this();
- this.idCards = idCards;
- this.settleNoteIds = settleNoteIds;
- this.location = location;
- public SettleAmountMonitorInput(Set<Integer> userIds, List<Integer> settleNoteIds, SubjectLocation location) {
- this.userIds = userIds;
+ //public SettleAmountMonitorInput(List<String> idCards, List<Integer> settleNoteIds) {
+ // this();
+ // this.idCards = idCards;
+ // this.settleNoteIds = settleNoteIds;
+ // //this.location = location;
+ //
+ //}
+ //public SettleAmountMonitorInput(Set<Integer> userIds, List<Integer> settleNoteIds) {
+ // this.userIds = userIds;
@@ -3,7 +3,6 @@ package com.qunzhixinxi.hnqz.admin.api.model.input;
import com.qunzhixinxi.hnqz.admin.api.entity.WmScorePackageSettleNote;
@@ -90,8 +89,6 @@ public class WmScorePackageSettleInput implements Serializable {
* MAH结算-药企deptId
@@ -1,7 +1,6 @@
import com.qunzhixinxi.hnqz.admin.api.entity.WmScorePackage;
import java.math.BigDecimal;
@@ -97,8 +96,6 @@ public class WmScorePackageSettleOutput {
* 结算渠道名称
package com.qunzhixinxi.hnqz.admin.api.model.output;
@@ -99,10 +98,6 @@ public class WmTaskSettleNoteOutput {
* 税源地名称
package com.qunzhixinxi.hnqz.admin.api.vo;
@@ -47,11 +46,6 @@ public class SettleFinancialReviewSettleDetailVO implements Serializable {
private String username;
@@ -41,11 +40,6 @@ public class SettleFinancialReviewVO implements Serializable {
private String idCardNumber;
* 结算金额
@@ -1,9 +1,5 @@
@@ -32,26 +28,6 @@ public class SysUserSubVO {
@@ -156,7 +156,7 @@ public class UserVO implements Serializable {
* 备用字段5
* 角色列表
@@ -49,7 +49,6 @@ import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
import com.qunzhixinxi.hnqz.admin.api.vo.WmQuizVO;
import com.qunzhixinxi.hnqz.admin.config.UpmsConfig;
import com.qunzhixinxi.hnqz.admin.api.entity.MedicalEquipment;
-import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptSub;
import com.qunzhixinxi.hnqz.admin.api.entity.SysUserExtRecord;
import com.qunzhixinxi.hnqz.admin.api.entity.SysUserSub;
import com.qunzhixinxi.hnqz.admin.api.entity.WmDaAgent;
@@ -82,12 +81,9 @@ import com.qunzhixinxi.hnqz.admin.api.vo.WmTaskTypeVO;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.DelEnum;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.DeptPermissionEnum;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.EnableEnum;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.PackageStatusEnum;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.PackageTypeEnum;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.ScorePackageStatusEnum;
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.SubjectTypeEnum;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.TaskStatusEnum;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.UserSignResultEnum;
import com.qunzhixinxi.hnqz.admin.event.TaskInfoImgEvent;
@@ -95,7 +91,6 @@ import com.qunzhixinxi.hnqz.admin.mapper.WmScoreTaskTypeMapper;
import com.qunzhixinxi.hnqz.admin.service.MedicalEquipmentService;
import com.qunzhixinxi.hnqz.admin.service.SysDeptCsmService;
import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
-import com.qunzhixinxi.hnqz.admin.service.SysDeptSubService;
import com.qunzhixinxi.hnqz.admin.service.SysDictItemService;
import com.qunzhixinxi.hnqz.admin.service.SysFileService;
import com.qunzhixinxi.hnqz.admin.service.SysUserExtRecordService;
@@ -230,7 +225,6 @@ public class ApiController {
private final WmDaPharmacyService wmDaPharmacyService;
private final RedisTemplate<String, Object> redisTemplate;
private final UpmsConfig upmsConfig;
- private final SysDeptSubService sysDeptSubService;
private final WmWkAlbumService wmWkAlbumService;
private final WmDeptTaskTypeTemplateService wmDeptTaskTypeTemplateService;
private final WmUserSignDetailService wmUserSignDetailService;
@@ -940,35 +934,35 @@ public class ApiController {
mapOne.put("userType", sysU.getUserType());
mapOne.put("jumpFlag", "北京遥领医疗科技有限公司".equals(sysDept.getName()) ? "1" : "0");
- // 结算渠道
- List<SysDeptSub> subList = sysDeptSubService.list(Wrappers.<SysDeptSub>lambdaQuery()
- .eq(SysDeptSub::getDeptId, sysU.getDeptId())
- .eq(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode())
- );
- List<String> subTypeList = subList.stream()
- .map(SysDeptSub::getSubjectType)
- .distinct()
- .collect(Collectors.toList());
- mapOne.put("subList", subTypeList);
- List<SubjectLocation> subjectLocationList = subList.stream()
- .map(SysDeptSub::getSubjectLocation)
- .sorted(Comparator.comparing(SubjectLocation::getSort))
- mapOne.put("subjectLocationList", subjectLocationList);
+ //// 结算渠道
+ //List<SysDeptSub> subList = sysDeptSubService.list(Wrappers.<SysDeptSub>lambdaQuery()
+ // .eq(SysDeptSub::getDeptId, sysU.getDeptId())
+ // .eq(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode())
+ //);
+ //List<String> subTypeList = subList.stream()
+ // .map(SysDeptSub::getSubjectType)
+ // .distinct()
+ // .collect(Collectors.toList());
+ //mapOne.put("subList", subTypeList);
+ //// 税源地
+ //List<SubjectLocation> subjectLocationList = subList.stream()
+ // .map(SysDeptSub::getSubjectLocation)
+ // .sorted(Comparator.comparing(SubjectLocation::getSort))
+ //mapOne.put("subjectLocationList", subjectLocationList);
// 查询配置了任务类型模板的任务类型
mapOne.put("hasTaskTypeTemplate", wmDeptTaskTypeTemplateService.listTaskTypeByDeptId(sysU.getDeptId()));
- // 税源地和channel对应关系
- Map<String, Integer> collect = subList.stream()
- .collect(Collectors.toMap(sysDeptSub -> sysDeptSub.getSubjectLocation().name(), SysDeptSub::getSubjectChannel));
- mapOne.put("subjectTypeAndChannel", collect);
- // 税源地和eidEnable对应关系
- Map<SubjectLocation, Boolean> subEidMap = subList.stream().collect(Collectors.toMap(SysDeptSub::getSubjectLocation, SysDeptSub::getEidEnable));
- mapOne.put("subjectLocationEid", subEidMap);
+ //// 税源地和channel对应关系
+ //Map<String, Integer> collect = subList.stream()
+ // .collect(Collectors.toMap(sysDeptSub -> sysDeptSub.getSubjectLocation().name(), SysDeptSub::getSubjectChannel));
+ //mapOne.put("subjectTypeAndChannel", collect);
+ //// 税源地和eidEnable对应关系
+ //Map<SubjectLocation, Boolean> subEidMap = subList.stream().collect(Collectors.toMap(SysDeptSub::getSubjectLocation, SysDeptSub::getEidEnable));
+ //mapOne.put("subjectLocationEid", subEidMap);
// todo
// 认证服务信息回显
@@ -1244,10 +1238,10 @@ public class ApiController {
List<SysUser> sysUserList = sysUserService.list(Wrappers.query(sysUser));
if (sysUserList.size() > 0) {
SysDept sysDept = sysDeptService.getById(sysUserList.get(0).getDeptId());
- wmTaskType.setLevel1Id(sysDept.getLevel2Id() + "");
+ wmTaskType.setLevel1Id(sysDept.getLevel2Id());
} else {
SysDept sysDept = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
@@ -1584,13 +1578,13 @@ public class ApiController {
SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
if (sysDept.getLevel() == 2) {
WmDaDrugEnt drugEnt = wmDaDrugEntService.selectByDeptId(sysDept.getDeptId());
- drugIds.add(drugEnt.getId());
+ drugIds.add(drugEnt.getId().toString());
if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
List<WmDaDrugEnt> entList = wmDaDrugEntService.getListByCsoDeptId(sysDept.getDeptId());
- drugIds.addAll(entList.stream().map(WmDaDrugEnt::getId).collect(Collectors.toList()));
+ drugIds.addAll(entList.stream().map(ent -> ent.getId().toString()).collect(Collectors.toList()));
@@ -2338,12 +2332,12 @@ public class ApiController {
if (CollUtil.isEmpty(userSubList)) {
return R.ok(1, "该积分包需要认证成功后才能领取,请点击“去认证”完成认证");
- // 该企业下只要有一个渠道是 “已核身/已认证”就可以领包
- boolean certNoMatch = userSubList.stream().noneMatch(userSub -> Arrays.asList(1, 15).contains(userSub.getCertStatus())
- || (userSub.getCertStatus().equals(2) && GigCallBackStatus.IN_PROGRESS.equals(userSub.getCallbackStatus())));
- if (certNoMatch) {
- return R.ok(1, "该积分包需要认证成功后才能领取,请点击“去认证”完成认证");
+ //// 该企业下只要有一个渠道是 “已核身/已认证”就可以领包
+ //boolean certNoMatch = userSubList.stream().noneMatch(userSub -> Arrays.asList(1, 15).contains(userSub.getCertStatus())
+ // || (userSub.getCertStatus().equals(2) && GigCallBackStatus.IN_PROGRESS.equals(userSub.getCallbackStatus())));
+ //if (certNoMatch) {
+ // return R.ok(1, "该积分包需要认证成功后才能领取,请点击“去认证”完成认证");
// 封装结果
@@ -2824,7 +2818,7 @@ public class ApiController {
wmTaskType.setDurgentId(sysU.getDrugEntId());
WmTaskType wmTaskType1 = wmTaskTypeService.getById("7");
wmTaskType.setTaskTypeName(wmTaskType1.getTaskTypeName());
- wmTaskType.setTaskEntId(sysDept.getLevel2Id() + "");
+ wmTaskType.setTaskEntId(sysDept.getLevel2Id() );
socre = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
System.out.println("获取任务得分:" + socre);
if (socre < 0) {
@@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptSub;
import com.qunzhixinxi.hnqz.admin.service.SysDeptSubService;
import com.qunzhixinxi.hnqz.admin.service.SysUserService;
import com.qunzhixinxi.hnqz.admin.service.SysUserSubService;
@@ -50,108 +48,108 @@ public class InitController {
return R.ok("TEST:"+ System.currentTimeMillis());
- @Inner(value = false)
- @PostMapping(value = "/user-sub")
- @Transactional(rollbackFor = Exception.class)
- public R<Boolean> doUserSubInit() {
- // 获取企业的结算通道
- List<SysDeptSub> deptSubList = deptSubService.list(Wrappers.<SysDeptSub>lambdaQuery().eq(SysDeptSub::getEnableFlag, "1"));
- // 按照企业id分组
- Map<Integer, List<SysDeptSub>> deptSubMap = deptSubList.stream().collect(Collectors.groupingBy(SysDeptSub::getDeptId));
- // 获取所有可用的用户
- List<SysUser> userList = userService.list(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getDelFlag, "0").eq(SysUser::getLockFlag, "0"));
- // 按照企业分组
- Map<Integer, List<SysUser>> deptUserMap = userList.stream().collect(Collectors.groupingBy(SysUser::getDeptId));
- List<SysUserSub> initUserSubList = new ArrayList<>();
- // 封装初始化数据
- for (Map.Entry<Integer, List<SysDeptSub>> entry : deptSubMap.entrySet()) {
- // 获取部门id
- int deptId = entry.getKey();
- // 获取企业结算
- List<SysDeptSub> deptSubs = entry.getValue();
- // 无结算渠道自动跳过
- if (CollUtil.isEmpty(deptSubs)) {
- continue;
- // 获取企业的员工
- List<SysUser> deptUsers = deptUserMap.get(deptId);
- // 无结算员工自动跳过
- if (CollUtil.isEmpty(deptUsers)) {
- deptSubs.stream()
- // 过滤出税邦云和人力家结算渠道
- .filter(deptSub -> "0".equals(deptSub.getSubjectType()) || "1".equals(deptSub.getSubjectType()))
- .forEach(deptSub -> {
- int subjectType = Integer.parseInt(deptSub.getSubjectType());
- GigTypeEnum gigTypeEnum = GigTypeEnum.resolve(subjectType);
- Integer subjectChannel = deptSub.getSubjectChannel();
- // todo
- if (subjectChannel != null /*&& GigTypeEnum.TAX_HELPOR.equals(gigTypeEnum)*/) {
- // 税邦云原0-中金、1-平安,转换为新1-中金、2-平安
- subjectChannel = subjectChannel == 0 ? 1 : subjectChannel == 1 ? 2 : 0;
- } else {
- subjectChannel = 0;
- GigChannelEnum gigChannelEnum = GigChannelEnum.resolve(subjectChannel);
- if (gigChannelEnum == null) {
- log.warn("结算通道不存在");
- return;
- List<SysUserSub> userSubs = deptUsers.stream()
- // 过滤出没有状态的
- .filter(sysUser -> {
- if (GigTypeEnum.REN_LI_JIA.equals(gigTypeEnum)) {
- return sysUser.getRljCertStatus() != null;
- return sysUser.getCertStatus() != null;
- }).map(sysUser -> {
- SysUserSub userSub = new SysUserSub();
- userSub.setUserId(sysUser.getUserId());
- userSub.setDeptId(sysUser.getDeptId());
- userSub.setBankCardNumber(sysUser.getBankCardNumber());
- userSub.setCertStatus(GigTypeEnum.REN_LI_JIA.equals(gigTypeEnum) ? sysUser.getRljCertStatus() : sysUser.getCertStatus());
- userSub.setGigType(gigTypeEnum);
- userSub.setGigChannel(gigChannelEnum);
- userSub.setCertRemark("init from sys_user");
- return userSub;
- }).collect(Collectors.toList());
- initUserSubList.addAll(userSubs);
- });
- // 消除
- List<SysUserSub> currSub = userSubService.list();
- Set<Integer> currIds = currSub.stream().mapToInt(SysUserSub::getUserId).boxed().collect(Collectors.toSet());
- List<SysUserSub> pureNew = initUserSubList.stream().filter(sysUserSub -> !currIds.contains(sysUserSub.getUserId())).collect(Collectors.toList());
- pureNew.sort(Comparator.comparing(SysUserSub::getUserId));
- // 初始化user_sub
- userSubService.saveBatch(pureNew);
- return R.ok(Boolean.TRUE);
+ //@Inner(value = false)
+ //@PostMapping(value = "/user-sub")
+ //@Transactional(rollbackFor = Exception.class)
+ //public R<Boolean> doUserSubInit() {
+ // // 获取企业的结算通道
+ // List<SysDeptSub> deptSubList = deptSubService.list(Wrappers.<SysDeptSub>lambdaQuery().eq(SysDeptSub::getEnableFlag, "1"));
+ // // 按照企业id分组
+ // Map<Integer, List<SysDeptSub>> deptSubMap = deptSubList.stream().collect(Collectors.groupingBy(SysDeptSub::getDeptId));
+ // // 获取所有可用的用户
+ // List<SysUser> userList = userService.list(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getDelFlag, "0").eq(SysUser::getLockFlag, "0"));
+ // // 按照企业分组
+ // Map<Integer, List<SysUser>> deptUserMap = userList.stream().collect(Collectors.groupingBy(SysUser::getDeptId));
+ // List<SysUserSub> initUserSubList = new ArrayList<>();
+ // // 封装初始化数据
+ // for (Map.Entry<Integer, List<SysDeptSub>> entry : deptSubMap.entrySet()) {
+ // // 获取部门id
+ // int deptId = entry.getKey();
+ // // 获取企业结算
+ // List<SysDeptSub> deptSubs = entry.getValue();
+ // // 无结算渠道自动跳过
+ // if (CollUtil.isEmpty(deptSubs)) {
+ // continue;
+ // }
+ // // 获取企业的员工
+ // List<SysUser> deptUsers = deptUserMap.get(deptId);
+ // // 无结算员工自动跳过
+ // if (CollUtil.isEmpty(deptUsers)) {
+ // deptSubs.stream()
+ // // 过滤出税邦云和人力家结算渠道
+ // .filter(deptSub -> "0".equals(deptSub.getSubjectType()) || "1".equals(deptSub.getSubjectType()))
+ // .forEach(deptSub -> {
+ // int subjectType = Integer.parseInt(deptSub.getSubjectType());
+ // //GigTypeEnum gigTypeEnum = GigTypeEnum.resolve(subjectType);
+ // Integer subjectChannel = deptSub.getSubjectChannel();
+ // // todo
+ // if (subjectChannel != null /*&& GigTypeEnum.TAX_HELPOR.equals(gigTypeEnum)*/) {
+ // // 税邦云原0-中金、1-平安,转换为新1-中金、2-平安
+ // subjectChannel = subjectChannel == 0 ? 1 : subjectChannel == 1 ? 2 : 0;
+ // } else {
+ // subjectChannel = 0;
+ // GigChannelEnum gigChannelEnum = GigChannelEnum.resolve(subjectChannel);
+ // if (gigChannelEnum == null) {
+ // log.warn("结算通道不存在");
+ // return;
+ // List<SysUserSub> userSubs = deptUsers.stream()
+ // // 过滤出没有状态的
+ // .filter(sysUser -> {
+ // if (GigTypeEnum.REN_LI_JIA.equals(gigTypeEnum)) {
+ // return sysUser.getRljCertStatus() != null;
+ // return sysUser.getCertStatus() != null;
+ // }).map(sysUser -> {
+ // SysUserSub userSub = new SysUserSub();
+ // userSub.setUserId(sysUser.getUserId());
+ // userSub.setDeptId(sysUser.getDeptId());
+ // userSub.setBankCardNumber(sysUser.getBankCardNumber());
+ // userSub.setCertStatus(GigTypeEnum.REN_LI_JIA.equals(gigTypeEnum) ? sysUser.getRljCertStatus() : sysUser.getCertStatus());
+ // userSub.setGigType(gigTypeEnum);
+ // userSub.setGigChannel(gigChannelEnum);
+ // userSub.setCertRemark("init from sys_user");
+ // return userSub;
+ // }).collect(Collectors.toList());
+ // initUserSubList.addAll(userSubs);
+ // });
+ // // 消除
+ // List<SysUserSub> currSub = userSubService.list();
+ // Set<Integer> currIds = currSub.stream().mapToInt(SysUserSub::getUserId).boxed().collect(Collectors.toSet());
+ // List<SysUserSub> pureNew = initUserSubList.stream().filter(sysUserSub -> !currIds.contains(sysUserSub.getUserId())).collect(Collectors.toList());
+ // pureNew.sort(Comparator.comparing(SysUserSub::getUserId));
+ // // 初始化user_sub
+ // userSubService.saveBatch(pureNew);
+ // return R.ok(Boolean.TRUE);
@@ -210,7 +210,7 @@ public class SysDeptController {
WmDaDrugEnt wmDaDrugEnt= wmDaDrugEntService.getById(sysDept.getLevel1Id());
if(null!=wmDaDrugEnt)
{
- wmDaDrugEnt.setDeptId(deptId+"");
+ wmDaDrugEnt.setDeptId(deptId);
wmDaDrugEntService.updateById(wmDaDrugEnt);
}else if(level==3)
@@ -218,7 +218,7 @@ public class SysDeptController {
WmDaAgent wmDaAgent= wmDaAgentService.getById(sysDept.getLevel2Id());
if(null!=wmDaAgent)
- wmDaAgent.setDeptId(deptId+"");
+ wmDaAgent.setDeptId(deptId);
wmDaAgentService.updateById(wmDaAgent);
}else if(level==4)
@@ -226,7 +226,7 @@ public class SysDeptController {
WmDaAgent wmDaAgent= wmDaAgentService.getById(sysDept.getLevel3Id());
@@ -9,10 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptRelation;
import com.qunzhixinxi.hnqz.admin.api.entity.WmDaDrugEnt;
-import com.qunzhixinxi.hnqz.admin.api.dto.SettleConfigDTO;
import com.qunzhixinxi.hnqz.admin.api.model.input.DeptSubLimitAmountInput;
import com.qunzhixinxi.hnqz.admin.service.SysDeptRelationService;
import com.qunzhixinxi.hnqz.admin.service.WmDaAgentService;
import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntService;
@@ -40,139 +37,40 @@ import java.util.stream.Collectors;
@RestController
@AllArgsConstructor
-@RequestMapping("/sysdeptsub" )
+@RequestMapping("/sysdeptsub")
public class SysDeptSubController {
- private final SysDeptRelationService sysDeptRelationService;
- private final WmDaAgentService wmDaAgentService;
- private final WmDaDrugEntService wmDaDrugEntService;
- * 查询结算渠道(用于结算页面)
- * @return 结果
- @GetMapping("/get-settle-subject")
- public R getSettleSubejct() {
- Integer deptId = SecurityUtils.getUser().getDeptId();
- List<SysDeptSub> resultList = new ArrayList<>();
- // 原有结算渠道
- SysDeptSub sysDeptSub = new SysDeptSub();
- sysDeptSub.setDeptId(deptId);
- sysDeptSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
- List<SysDeptSub> subList = sysDeptSubService.list(Wrappers.query(sysDeptSub));
- if (CollUtil.isNotEmpty(subList)) {
- subList.forEach(sub -> sub.setSubjectName(sub.getSubjectLocation().getDescription()));
- resultList.addAll(subList);
- // MAH结算渠道-拼接上级药企作为渠道名称
- WmDaAgent daAgent = wmDaAgentService.getOne(Wrappers.<WmDaAgent>lambdaQuery()
- .eq(WmDaAgent::getDeptId, deptId));
- if(daAgent!= null) {
- if (daAgent.getMahSettleDeptId() != null) {
- // 查询上级药企
- List<SysDeptRelation> deptRelations = sysDeptRelationService.list(Wrappers.<SysDeptRelation>lambdaQuery()
- .eq(SysDeptRelation::getDescendant, deptId)
- .ne(SysDeptRelation::getAncestor, deptId)
- .ne(SysDeptRelation::getAncestor, 1));
- if (CollUtil.isNotEmpty(deptRelations)) {
- List<WmDaDrugEnt> drugEnts = wmDaDrugEntService.list(Wrappers.<WmDaDrugEnt>lambdaQuery()
- .in(WmDaDrugEnt::getDeptId, deptRelations.stream().map(SysDeptRelation::getAncestor).collect(Collectors.toSet())));
- drugEnts.forEach(drugEnt -> {
- SysDeptSub newDeptSub = new SysDeptSub();
- newDeptSub.setSubId(Integer.valueOf(drugEnt.getDeptId()));
- newDeptSub.setDeptId(Integer.valueOf(drugEnt.getDeptId()));
- newDeptSub.setSubjectLocation(SubjectLocation.MAH_SETTLE);
- newDeptSub.setSubjectType(String.valueOf(SubjectLocation.MAH_SETTLE.getGigType().getCode()));
- newDeptSub.setSubjectName(drugEnt.getEntname());
- resultList.add(newDeptSub);
+ private final SysDeptSubService sysDeptSubService;
+ private final SysDeptRelationService sysDeptRelationService;
+ private final WmDaAgentService wmDaAgentService;
+ private final WmDaDrugEntService wmDaDrugEntService;
+ * 修改限额
+ * @param input
+ * @return
+ @PostMapping("/updateSubLimitAmount")
+ public R updateSubLimitAmount(@RequestBody DeptSubLimitAmountInput input) {
+ if (CollectionUtils.isEmpty(input.getSubList())) {
+ return R.failed("参数异常");
+ return sysDeptSubService.updateSubLimitAmount(input);
- return R.ok(resultList);
- * 查询结算渠道列表-无参
- @GetMapping("/getSubSelect" )
- public R getSubSelect() {
- sysDeptSub.setDeptId(SecurityUtils.getUser().getDeptId());
- return R.ok(subList);
- * 查询结算渠道列表-带参
- * @param sysDeptSub
- @GetMapping("/getSubList" )
- public R getSubList(SysDeptSub sysDeptSub) {
- return R.ok(sysDeptSubService.list(Wrappers.query(sysDeptSub)));
- * 修改限额
- * @param input
- @PostMapping("/updateSubLimitAmount" )
- public R updateSubLimitAmount(@RequestBody DeptSubLimitAmountInput input) {
- if(CollectionUtils.isEmpty(input.getSubList())){
- return R.failed("参数异常");
- return sysDeptSubService.updateSubLimitAmount(input);
- * 结算管理配置
- * @param settleConfigDTO
- @SysLog("结算管理配置-保存")
- @PostMapping("/save-settle-config")
- public R<?> saveSettleConfig(@Valid @RequestBody SettleConfigDTO settleConfigDTO) {
- for (SettleConfigDTO.DeptSub deptSub : settleConfigDTO.getSubList()) {
- if (deptSub.getLimitAmount() == null || ArrayUtil.isEmpty(deptSub.getSubjectInvoiceCategory())
- || deptSub.getSubjectLocation() == null) {
- return R.failed("必填参数为空");
- DeptSubLimitAmountInput input = new DeptSubLimitAmountInput();
- input.setDeptId(settleConfigDTO.getDeptId());
- List<SysDeptSub> subList = new ArrayList<>();
- settleConfigDTO.getSubList().forEach(deptSub -> {
- SysDeptSub sysDeptSub =
- BeanUtil.copyProperties(deptSub, SysDeptSub.class, "subjectInvoiceCategory");
- sysDeptSub.setSubjectInvoiceCategory(String.join(StrUtil.COMMA, deptSub.getSubjectInvoiceCategory()));
- subList.add(sysDeptSub);
- input.setSubList(subList);
- sysDeptSubService.saveSettleConfig(input);
- return R.ok();
* 分页查询
- * @param page 分页对象
+ * @param page 分页对象
* @param sysDeptSub 部门管理
* @return
- @GetMapping("/page" )
- @PreAuthorize("@pms.hasPermission('admin_sysdeptsub_view')" )
+ @GetMapping("/page")
+ @PreAuthorize("@pms.hasPermission('admin_sysdeptsub_view')")
public R getSysDeptSubPage(Page page, SysDeptSub sysDeptSub) {
return R.ok(sysDeptSubService.page(page, Wrappers.query(sysDeptSub)));
@@ -180,47 +78,51 @@ public class SysDeptSubController {
* 通过id查询部门管理
* @param deptId id
* @return R
- @GetMapping("/{deptId}" )
- public R getById(@PathVariable("deptId" ) Integer deptId) {
+ @GetMapping("/{deptId}")
+ public R getById(@PathVariable("deptId") Integer deptId) {
return R.ok(sysDeptSubService.getById(deptId));
* 新增部门管理
- @SysLog("新增部门管理" )
+ @SysLog("新增部门管理")
@PostMapping
- @PreAuthorize("@pms.hasPermission('admin_sysdeptsub_add')" )
+ @PreAuthorize("@pms.hasPermission('admin_sysdeptsub_add')")
public R save(@RequestBody SysDeptSub sysDeptSub) {
return R.ok(sysDeptSubService.save(sysDeptSub));
* 修改部门管理
- @SysLog("修改部门管理" )
+ @SysLog("修改部门管理")
@PutMapping
- @PreAuthorize("@pms.hasPermission('admin_sysdeptsub_edit')" )
+ @PreAuthorize("@pms.hasPermission('admin_sysdeptsub_edit')")
public R updateById(@RequestBody SysDeptSub sysDeptSub) {
return R.ok(sysDeptSubService.updateById(sysDeptSub));
* 通过id删除部门管理
- @SysLog("通过id删除部门管理" )
- @DeleteMapping("/{deptId}" )
- @PreAuthorize("@pms.hasPermission('admin_sysdeptsub_del')" )
+ @SysLog("通过id删除部门管理")
+ @DeleteMapping("/{deptId}")
+ @PreAuthorize("@pms.hasPermission('admin_sysdeptsub_del')")
public R removeById(@PathVariable Integer deptId) {
return R.ok(sysDeptSubService.removeById(deptId));
@@ -87,21 +87,21 @@ public class SysDictController {
List<SysDictItem> list = sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getType, type));
- if (filterData && "subject_location".equals(type) && 1 != deptId) {
- List<SysDeptSub> l = deptSubService.list(Wrappers.<SysDeptSub>lambdaQuery().eq(SysDeptSub::getDeptId, deptId).eq(SysDeptSub::getEnableFlag, "1"));
- if (CollUtil.isNotEmpty(l)) {
- List<String> collect = l.stream().filter(sub -> sub.getSubjectLocation() != null).map(sub -> sub.getSubjectLocation().getType()).collect(Collectors.toList());
- if (CollUtil.isNotEmpty(collect)) {
- List<SysDictItem> items = list.stream().filter(item -> collect.contains(item.getValue())).collect(Collectors.toList());
- return R.ok(items);
- return R.ok(Collections.emptyList());
+ //Integer deptId = SecurityUtils.getUser().getDeptId();
+ //if (filterData && "subject_location".equals(type) && 1 != deptId) {
+ // List<SysDeptSub> l = deptSubService.list(Wrappers.<SysDeptSub>lambdaQuery().eq(SysDeptSub::getDeptId, deptId).eq(SysDeptSub::getEnableFlag, "1"));
+ // if (CollUtil.isNotEmpty(l)) {
+ // //List<String> collect = l.stream().filter(sub -> sub.getSubjectLocation() != null).map(sub -> sub.getSubjectLocation().getType()).collect(Collectors.toList());
+ // if (CollUtil.isNotEmpty(collect)) {
+ // List<SysDictItem> items = list.stream().filter(item -> collect.contains(item.getValue())).collect(Collectors.toList());
+ // return R.ok(items);
+ // return R.ok(Collections.emptyList());
return R.ok(list);
@@ -103,9 +103,9 @@ public class SysExportController {
wmScorePackage.setDrugsIds(stringList);
wmScorePackage.setTypeid("4");
if (sysDept.getLevel() == 4) {
- wmScorePackage.setLevel2Id(sysDept.getLevel3Id() + "");
+ wmScorePackage.setLevel2Id(sysDept.getLevel3Id() );
- wmScorePackage.setLevel1Id(sysDept.getLevel2Id() + "");
+ wmScorePackage.setLevel1Id(sysDept.getLevel2Id());
return R.ok(wmScorePackageService.selectWmScorePackageList(page, wmScorePackage));
@@ -134,11 +134,11 @@ public class SysExportController {
wmScorePackage.setAgentTypeId("2");
wmScorePackage.setUpdateUser(2);
wmScorePackage.setAgentTypeId("1");
+ wmScorePackage.setLevel1Id(sysDept.getLevel2Id() );
IPage pageAnswer = wmScorePackageService.getExportPackageTotalList(page, wmScorePackage);
List<WmScorePackage> list = pageAnswer.getRecords();
@@ -166,9 +166,9 @@ public class SysExportController {
@@ -585,7 +585,7 @@ public class SysExportController {
List<String> stringListDrug = new ArrayList<>();
if (null != wmTask.getDrugEntId() && !"".equals(wmTask.getDrugEntId())) {
- stringListDrug.add(wmTask.getDrugEntId());
+ stringListDrug.add(wmTask.getDrugEntId().toString());
if (null != sysDept) {
@@ -28,7 +28,6 @@ import com.qunzhixinxi.hnqz.admin.api.dto.CommonUserDTO;
import com.qunzhixinxi.hnqz.admin.api.model.input.UserCertificationInput;
import com.qunzhixinxi.hnqz.admin.api.model.excel.CommonUserExcelModel;
import com.qunzhixinxi.hnqz.admin.mapper.SysCsmUserRelationMapper;
import com.qunzhixinxi.hnqz.admin.mapper.SysUserMapper;
import com.qunzhixinxi.hnqz.admin.mapper.SysUserRoleMapper;
@@ -122,19 +121,6 @@ public class SysUserController {
return userService.getAuthInfo(input);
- * 用户管理-认证-确定
- * @return R
- @SysLog("用户管理-认证-确定")
- @PostMapping("/batchChannelCert")
- public R batchChannelCert(@RequestBody UserCertificationInput input) {
- //参数校验
- return userService.batchChannelCert(input);
* 获取指定用户全部信息
@@ -927,15 +913,15 @@ public class SysUserController {
public R<?> selectUserList(Page page, UserDTO userDTO) {
userDTO.setSubType(null);
- if (StrUtil.isNotBlank(userDTO.getSubjectLocation())) {
- String[] locationArr = Stream.of(SubjectLocation.values())
- .map(SubjectLocation::getType)
- .toArray(String[]::new);
- if (!ArrayUtil.containsAny(userDTO.getSubjectLocation().split(StrUtil.COMMA), locationArr)) {
- // 只接收已有的税源地类型值
- userDTO.setSubjectLocation(null);
+ //if (StrUtil.isNotBlank(userDTO.getSubjectLocation())) {
+ // //String[] locationArr = Stream.of(SubjectLocation.values())
+ // // .map(SubjectLocation::getType)
+ // // .toArray(String[]::new);
+ // if (!ArrayUtil.containsAny(userDTO.getSubjectLocation().split(StrUtil.COMMA), locationArr)) {
+ // // 只接收已有的税源地类型值
+ // userDTO.setSubjectLocation(null);
IPage<UserVO> userVosPage = userService.selectUserList(page, userDTO);
@@ -168,7 +168,7 @@ public class WmDaDrugEntController {
return R.failed("一代积分规则已分配");
if (null != wmDaDrugEnt) {
- wmTaskTypeEntRef.setDeptId(wmDaDrugEnt.getDeptId());
+ wmTaskTypeEntRef.setDeptId(wmDaDrugEnt.getDeptId().toString());
int isSave = wmTaskTypeEntRefMapper.insert(wmTaskTypeEntRef);
@@ -190,7 +190,7 @@ public class WmDaDrugEntController {
newOne.setCreateTime(LocalDateTime.now());
newOne.setStatus("0");
newOne.setBaseId(wmTaskType1.getId());
- newOne.setRuleId(wmTaskTypeEntRef.getAgentId());
+ newOne.setRuleId(wmTaskTypeEntRef.getAgentId().toString());
newOne.setParentId(wmTaskType1.getParentId());
wmTaskTypeMapper.insert(newOne);
@@ -231,7 +231,7 @@ public class WmDaDrugEntController {
SysDept sysDept = new SysDept();
sysDept.setDelFlag(wmDaDrugEnt.getEnableFlag());
sysDept.setName(wmDaDrugEnt.getEntname());
- sysDept.setDeptId(Integer.parseInt(wmDaDrugEnt.getDeptId()));
+ sysDept.setDeptId(wmDaDrugEnt.getDeptId());
@@ -271,7 +271,7 @@ public class WmDaDrugEntController {
sysDept.setFinancialReviewType(wmDaDrugEnt.getFinancialReviewType());
sysDeptMapper.updateByPrimaryKeySelective(sysDept);
SysUser sysUserCondition = new SysUser();
- sysUserCondition.setDeptId(Integer.parseInt(wmDaDrugEnt.getDeptId()));
+ sysUserCondition.setDeptId(wmDaDrugEnt.getDeptId());
List<SysUser> sysUserList = sysUserMapper.selectUserById(sysUserCondition);
// List<Integer> id1 = sysUserList.stream().map(p -> p.getUserId()).collect(Collectors.toList());
@@ -393,7 +393,7 @@ public class WmDaDrugEntController {
if (null != s.getDrugEntId() && !"null".equals(s.getDrugEntId()) && !"".equals(s.getDrugEntId())) {
UserInfo userInfo = userService.findUserInfo(s);
if (isZbOrDbUsers(userInfo.getRoles())) {
- list.add(Integer.parseInt(s.getDrugEntId()));
+ list.add(s.getDrugEntId());
@@ -435,7 +435,7 @@ public class WmDaDrugEntController {
- stringList.add(SecurityUtils.getUser().getDrugEntId());
+ stringList.add(SecurityUtils.getUser().getDrugEntId().toString());
if (stringList.size() > 0) {
return R.ok(wmDaDrugEntService.listByIds(stringList));
@@ -184,7 +184,7 @@ public class WmDaDrugEntDrugtableController {
WmDaDrugEnt drugEnt = new WmDaDrugEnt();
List<WmDaDrugEnt> daDrugEnts = wmDaDrugEntService.list(Wrappers.query(drugEnt));
if (CollectionUtils.isNotEmpty(daDrugEnts)) {
- wmDaDrugEntDrugtable.setDrugEntId(daDrugEnts.get(0).getId());
+ wmDaDrugEntDrugtable.setDrugEntId(daDrugEnts.get(0).getId().toString());
@@ -209,7 +209,7 @@ public class WmDaDrugEntDrugtableController {
@@ -37,7 +37,6 @@ import com.qunzhixinxi.hnqz.admin.api.constant.enums.DelEnum;
import com.qunzhixinxi.hnqz.admin.mapper.*;
import com.qunzhixinxi.hnqz.admin.api.feign.SysDeptRecharge;
import com.qunzhixinxi.hnqz.admin.api.feign.SysDeptRechargeRecord;
@@ -91,385 +90,385 @@ import java.util.stream.Stream;
@RequestMapping("/wmscorepackage")
public class WmScorePackageController {
- private final WmScorePackageService wmScorePackageService;
- private final WmScorePackageStatusService wmScorePackageStatusService;
- private final WmDaDrugEntDrugtableService wmDaDrugEntDrugtableService;
- private final WmScorePackageMapper wmScorePackageMapper;
- private final SysDeptService sysDeptService;
- private final SysUserService sysUserService;
- private final WmTaskService wmTaskService;
- private final WmTaskMapper wmTaskMapper;
- private final WmTaskRuleService wmTaskRuleService;
- private final WmScoreTaskTypeService wmScoreTaskTypeService;
- private final WmTaskTypeService wmTaskTypeService;
- private final WmScoreTaskTypeMapper wmScoreTaskTypeMapper;
- private final WmDaDrugEntMapper wmDaDrugEntMapper;
- private final WmDaAgentMapper wmDaAgentMapper;
- private final WmTeamService wmTeamService;
- private final SysDeptRechargeRecordMapper sysDeptRechargeRecordMapper;
- private final SysDeptRechargeMapper sysDeptRechargeMapper;
- private final WmBizReminderService wmBizReminderService;
- private final StringRedisTemplate redisTemplate;
- private final WmPkgQuizRelationService pkgQuizRelationService;
- private final SysDictItemService sysDictItemService;
- private final Sequence pkgSequence;
- @GetMapping(value = "/quiz/relation/list")
- public R<?> ListPkgQuizRel(@RequestParam Integer pkgId) {
- List<WmPkgQuizRelation> wmPkgQuizRelations = pkgQuizRelationService.listQuizRelationsByPkgIds(Collections.singletonList(pkgId));
- return R.ok(wmPkgQuizRelations);
- * 获取积分包号
- * @return 积分包号
- @GetMapping(value = "/sn")
- public R<String> getPkgSn() {
- return R.ok("PKG" + pkgSequence.nextNo());
- @PutMapping(value = "/p2p/amount")
- public R<?> saveP2pAmount(@RequestBody WmScorePackage wmScorePackage) {
- if (StrUtil.isBlank(wmScorePackage.getId()) || wmScorePackage.getP2pAmount() == null || wmScorePackage.getP2pDraft() == null) {
- return R.failed("参数错误");
- if (wmScorePackage.getP2pServiceAmount() == null) {
- wmScorePackage.setP2pServiceAmount(BigDecimal.ZERO);
- // 如果是草稿,放入缓存
- if (wmScorePackage.getP2pDraft()) {
- redisTemplate.opsForValue().set(String.format("scorepackage:p2p:amount:%s", wmScorePackage.getId()), wmScorePackage.getP2pAmount().toString(), 180, TimeUnit.DAYS);
- redisTemplate.opsForValue().set(String.format("scorepackage:p2p:service-amount:%s", wmScorePackage.getId()), wmScorePackage.getP2pServiceAmount().toString(), 180, TimeUnit.DAYS);
- redisTemplate.opsForValue().set(String.format("scorepackage:p2p:desc:%s", wmScorePackage.getId()), wmScorePackage.getDescription(), 180, TimeUnit.DAYS);
- WmScorePackage sp = new WmScorePackage();
- sp.setId(wmScorePackage.getId());
- sp.setP2pAmount(wmScorePackage.getP2pAmount());
- sp.setDescription(wmScorePackage.getDescription());
- sp.setP2pServiceAmount(wmScorePackage.getP2pServiceAmount());
- sp.setP2pTime(LocalDateTime.now());
- wmScorePackageService.updateById(sp);
- * 分页查询
- * @param wmScorePackage 积分包
- @GetMapping("/page")
- public R<?> getWmScorePackagePage(Page<WmScorePackage> page, WmScorePackage wmScorePackage) {
- OrderItem orderItem = new OrderItem();
- orderItem.setColumn("create_time");
- orderItem.setAsc(false);
- page.addOrder(orderItem);
- wmScorePackage.setDelFlag("0");
- wmScorePackage.setEnableFlag("0");
- String ruleId = wmScorePackage.getTaskRuleId();
- String pakcageName = wmScorePackage.getScoreName();
- wmScorePackage.setScoreName(null);
- if (SecurityUtils.getRoles().contains(3)) {
- wmScorePackage.setDrugEntId(SecurityUtils.getUser().getDrugEntId());
- } else if (SecurityUtils.getRoles().contains(4)) {
- if ("1".equals(wmScorePackage.getAgentTypeId())) {
- wmScorePackage.setDeptId(SecurityUtils.getUser().getDeptId() + "");
- wmScorePackage.setTaskRuleId(null);
- QueryWrapper<WmScorePackage> queryWrapper = Wrappers.query(wmScorePackage);
- if (null != pakcageName) {
- queryWrapper.like("score_name", pakcageName);
- if ("4".equals(wmScorePackage.getTypeid())) {
- if (null != ruleId) {
- WmTaskRule wmTaskRule = new WmTaskRule();
- if (null != wmScorePackage.getDrugEntId()) {
- wmTaskRule.setDrugentId(wmScorePackage.getDrugEntId());
- wmTaskRule.setRuleMonth(ruleId);
- List<WmTaskRule> wmTaskRuleList = wmTaskRuleService.list(Wrappers.query(wmTaskRule));
- List<String> stringList = new ArrayList<>();
- if (wmTaskRuleList.size() > 0) {
- for (WmTaskRule wmt : wmTaskRuleList) {
- stringList.add(wmt.getId());
- stringList.add("-1");
- queryWrapper.in(true, "task_rule_id", stringList);
- wmScorePackageService.page(page, queryWrapper);
- page.getRecords().forEach(r -> {
- if (r.getP2pAmount() != null) {
- r.setP2pDraft(false);
- String s = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:amount:%s", r.getId()));
- String s1 = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:service-amount:%s", r.getId()));
- String desc = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:desc:%s", r.getId()));
- if (StrUtil.isNotBlank(s)) {
- r.setP2pAmount(new BigDecimal(s));
- r.setP2pServiceAmount(new BigDecimal(s1));
- r.setDescription(desc);
- r.setP2pDraft(true);
- return R.ok(page);
- * @return 分页结果
- @GetMapping("/getWmScorePackagePageTask")
- public R<?> getWmScorePackagePageTask(Page<WmScorePackage> page, WmScorePackage wmScorePackage) {
- SysDept sysDept = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
- QueryWrapper<WmScorePackage> queryWrapper = Wrappers.query();
- queryWrapper.eq("del_flag", "0");
- queryWrapper.eq("enable_flag", "0");
- if (!SecurityUtils.getRoles().contains(2)) {
- queryWrapper.eq("drug_ent_id", SecurityUtils.getUser().getDrugEntId());
- if (null != wmScorePackage.getPackageFinishStatus()) {
- if ("1".equals(wmScorePackage.getPackageFinishStatus())) {
- queryWrapper.eq("package_audit_status", "1");
- if (SecurityUtils.getRoles().contains(4) || SecurityUtils.getRoles().contains(5)) {
- queryWrapper.eq("package_finish_status", "1");
- queryWrapper.eq("package_audit_status", "0");
- queryWrapper.eq("package_finish_status", "0");
- if (null != wmScorePackage.getScoreId()) {
- queryWrapper.like("score_id", wmScorePackage.getScoreId());
- if (null != wmScorePackage.getTaskRuleId()) {
- queryWrapper.eq("task_rule_id", wmScorePackage.getTaskRuleId());
- if (null != wmScorePackage.getScoreName()) {
- queryWrapper.like("score_name", wmScorePackage.getScoreName());
- if (null != wmScorePackage.getLevel1Id()) {
- queryWrapper.eq("level1_id", wmScorePackage.getLevel1Id());
- List<WmScorePackage> listExt = new ArrayList<>();
- WmDaDrugEnt wmDaDrugEnt = new WmDaDrugEnt();
- wmDaDrugEnt.setDeptId(String.valueOf(SecurityUtils.getUser().getDeptId()));
- WmDaDrugEnt wmDaDrugEnt1 = wmDaDrugEntMapper.selectDeptId(wmDaDrugEnt);
- WmDaAgent wmDaAgent = new WmDaAgent();
- wmDaAgent.setDeptId(String.valueOf(SecurityUtils.getUser().getDeptId()));
- WmDaAgent wmDaAgent1 = wmDaAgentMapper.selectDeptId(wmDaAgent);
- if (3 == sysDept.getLevel()) {
- if (null != wmScorePackage.getTypeid() && "4".equals(wmScorePackage.getTypeid())) {
- queryWrapper.eq("level1_id", wmDaDrugEnt1.getId());
- queryWrapper.eq("typeid", 4);
- wmScorePackage.setPackageFinishStatus("1");
- queryWrapper.eq("package_finish_status", 1);
- queryWrapper.eq("agent_type_id", 1);
- queryWrapper.eq("level1_id", sysDept.getLevel2Id());
- wmScorePackage.setAgentTypeId("1");
- listExt = wmScorePackageService.listWmScorePackageAndTaskExtOld(wmScorePackage);
- } else if (4 == sysDept.getLevel()) {
- queryWrapper.eq("agent_type_id", 2);
- queryWrapper.eq("level2_id", wmDaAgent1.getId());
- queryWrapper.ne("typeid", 2);
- wmScorePackage.setAgentTypeId("2");
- wmScorePackage.setTypeid("2");
- listExt = wmScorePackageService.listWmScorePackageAndTaskExt2Old(wmScorePackage);
- } else if (2 == sysDept.getLevel()) {
- queryWrapper.eq("typeid", 1);
- wmScorePackage.setTypeid("1");
- if (SecurityUtils.getRoles().contains(2)) {
- queryWrapper.eq("old_package", 1);
- Page<WmScorePackage> pageAnswer = wmScorePackageService.page(page, queryWrapper);
- List<WmScorePackage> list = pageAnswer.getRecords();
- for (WmScorePackage wmS :
- list) {
- for (WmScorePackage ext :
- listExt) {
- if (wmS.getId().equals(ext.getId())) {
- wmS.setYsh(ext.getYsh());
- wmS.setYtj(ext.getYtj());
- if (2 == sysDept.getLevel()) {
- wmS.setDsh(ext.getDsh());
- if (null == ext.getYtj() || null == ext.getScore()) {
- wmS.setDsh(0);
- if (ext.getYtj() >= ext.getScore()) {
- wmS.setDsh(100);
- wmS.setDsh(new Double(Math.ceil(100.0 * ext.getYtj() / ext.getScore())).intValue());
- wmS.setPackageFinishStatus("0");
- if ("1".equals(wmS.getPackageAuditStatus())) {
- wmS.setPackageFinishStatus("1");
- // 封装报告记录
- wmS.setReportMqName(CacheConstants.EXPORT_NBA_HISTORY_REPORT_CACHE);
- wmScorePackageService.getReportOpt(wmS);
- // 封装excel报告状态
- wmScorePackageService.getExcelReportOpt(wmS, CacheConstants.EXCEL_EXPORT_NBA_HISTORY_REPORT_CACHE);
- pageAnswer.setRecords(list);
- return R.ok(pageAnswer);
- @GetMapping("/getWmScorePageTask")
- public R<?> getWmScorePageTask(Page<WmScorePackage> page, WmScorePackage wmScorePackage) {
- if (null != wmScorePackage.getId()) {
- queryWrapper.like("id", wmScorePackage.getId());
- if (null != wmScorePackage.getSendPackageDeptId()) {
- queryWrapper.like("send_package_dept_id", wmScorePackage.getSendPackageDeptId());
- if (null != wmScorePackage.getPackageStatus()) {
- queryWrapper.like("package_status", wmScorePackage.getPackageStatus());
- queryWrapper.eq("dept_id", SecurityUtils.getUser().getDeptId());
- wmScorePackage.setDeptId(String.valueOf(SecurityUtils.getUser().getDeptId()));
- wmScorePackage.setTypeid(String.valueOf(1));
- wmScorePackageService.listWmScorePackageAndTaskExt(page, wmScorePackage);
- wmScorePackage.setTypeid(String.valueOf(2));
- wmScorePackageService.listWmScorePackageAndTaskExt2(page, wmScorePackage);
- queryWrapper.eq("typeid", 0);
- wmScorePackage.setTypeid(String.valueOf(0));
- wmScorePackage.setSendPackageDeptId(wmScorePackage.getSendPackageDeptId());
+ private final WmScorePackageService wmScorePackageService;
+ private final WmScorePackageStatusService wmScorePackageStatusService;
+ private final WmDaDrugEntDrugtableService wmDaDrugEntDrugtableService;
+ private final WmScorePackageMapper wmScorePackageMapper;
+ private final SysDeptService sysDeptService;
+ private final SysUserService sysUserService;
+ private final WmTaskService wmTaskService;
+ private final WmTaskMapper wmTaskMapper;
+ private final WmTaskRuleService wmTaskRuleService;
+ private final WmScoreTaskTypeService wmScoreTaskTypeService;
+ private final WmTaskTypeService wmTaskTypeService;
+ private final WmScoreTaskTypeMapper wmScoreTaskTypeMapper;
+ private final WmDaDrugEntMapper wmDaDrugEntMapper;
+ private final WmDaAgentMapper wmDaAgentMapper;
+ private final WmTeamService wmTeamService;
+ private final SysDeptRechargeRecordMapper sysDeptRechargeRecordMapper;
+ private final SysDeptRechargeMapper sysDeptRechargeMapper;
+ private final WmBizReminderService wmBizReminderService;
+ private final StringRedisTemplate redisTemplate;
+ private final WmPkgQuizRelationService pkgQuizRelationService;
+ private final SysDictItemService sysDictItemService;
+ private final Sequence pkgSequence;
+ @GetMapping(value = "/quiz/relation/list")
+ public R<?> ListPkgQuizRel(@RequestParam Integer pkgId) {
+ List<WmPkgQuizRelation> wmPkgQuizRelations = pkgQuizRelationService.listQuizRelationsByPkgIds(Collections.singletonList(pkgId));
+ return R.ok(wmPkgQuizRelations);
+ * 获取积分包号
+ * @return 积分包号
+ @GetMapping(value = "/sn")
+ public R<String> getPkgSn() {
+ return R.ok("PKG" + pkgSequence.nextNo());
+ @PutMapping(value = "/p2p/amount")
+ @Transactional(rollbackFor = Exception.class)
+ public R<?> saveP2pAmount(@RequestBody WmScorePackage wmScorePackage) {
+ if (StrUtil.isBlank(wmScorePackage.getId()) || wmScorePackage.getP2pAmount() == null || wmScorePackage.getP2pDraft() == null) {
+ return R.failed("参数错误");
+ if (wmScorePackage.getP2pServiceAmount() == null) {
+ wmScorePackage.setP2pServiceAmount(BigDecimal.ZERO);
+ // 如果是草稿,放入缓存
+ if (wmScorePackage.getP2pDraft()) {
+ redisTemplate.opsForValue().set(String.format("scorepackage:p2p:amount:%s", wmScorePackage.getId()), wmScorePackage.getP2pAmount().toString(), 180, TimeUnit.DAYS);
+ redisTemplate.opsForValue().set(String.format("scorepackage:p2p:service-amount:%s", wmScorePackage.getId()), wmScorePackage.getP2pServiceAmount().toString(), 180, TimeUnit.DAYS);
+ redisTemplate.opsForValue().set(String.format("scorepackage:p2p:desc:%s", wmScorePackage.getId()), wmScorePackage.getDescription(), 180, TimeUnit.DAYS);
+ return R.ok();
+ WmScorePackage sp = new WmScorePackage();
+ sp.setId(wmScorePackage.getId());
+ sp.setP2pAmount(wmScorePackage.getP2pAmount());
+ sp.setDescription(wmScorePackage.getDescription());
+ sp.setP2pServiceAmount(wmScorePackage.getP2pServiceAmount());
+ sp.setP2pTime(LocalDateTime.now());
+ wmScorePackageService.updateById(sp);
+ * 分页查询
+ * @param wmScorePackage 积分包
+ * @return R
+ public R<?> getWmScorePackagePage(Page<WmScorePackage> page, WmScorePackage wmScorePackage) {
+ OrderItem orderItem = new OrderItem();
+ orderItem.setColumn("create_time");
+ orderItem.setAsc(false);
+ page.addOrder(orderItem);
+ wmScorePackage.setDelFlag("0");
+ wmScorePackage.setEnableFlag("0");
+ String ruleId = wmScorePackage.getTaskRuleId();
+ String pakcageName = wmScorePackage.getScoreName();
+ wmScorePackage.setScoreName(null);
+ if (SecurityUtils.getRoles().contains(3)) {
+ wmScorePackage.setDrugEntId(SecurityUtils.getUser().getDrugEntId());
+ } else if (SecurityUtils.getRoles().contains(4)) {
+ if ("1".equals(wmScorePackage.getAgentTypeId())) {
+ wmScorePackage.setDeptId(SecurityUtils.getUser().getDeptId() + "");
+ wmScorePackage.setTaskRuleId(null);
+ QueryWrapper<WmScorePackage> queryWrapper = Wrappers.query(wmScorePackage);
+ if (null != pakcageName) {
+ queryWrapper.like("score_name", pakcageName);
+ if ("4".equals(wmScorePackage.getTypeid())) {
+ if (null != ruleId) {
+ WmTaskRule wmTaskRule = new WmTaskRule();
+ if (null != wmScorePackage.getDrugEntId()) {
+ wmTaskRule.setDrugentId(wmScorePackage.getDrugEntId());
+ wmTaskRule.setRuleMonth(ruleId);
+ } else {
+ List<WmTaskRule> wmTaskRuleList = wmTaskRuleService.list(Wrappers.query(wmTaskRule));
+ List<String> stringList = new ArrayList<>();
+ if (wmTaskRuleList.size() > 0) {
+ for (WmTaskRule wmt : wmTaskRuleList) {
+ stringList.add(wmt.getId());
+ stringList.add("-1");
+ queryWrapper.in(true, "task_rule_id", stringList);
+ wmScorePackageService.page(page, queryWrapper);
+ page.getRecords().forEach(r -> {
+ if (r.getP2pAmount() != null) {
+ r.setP2pDraft(false);
+ String s = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:amount:%s", r.getId()));
+ String s1 = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:service-amount:%s", r.getId()));
+ String desc = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:desc:%s", r.getId()));
+ if (StrUtil.isNotBlank(s)) {
+ r.setP2pAmount(new BigDecimal(s));
+ r.setP2pServiceAmount(new BigDecimal(s1));
+ r.setDescription(desc);
+ r.setP2pDraft(true);
+ });
+ return R.ok(page);
+ * @return 分页结果
+ @GetMapping("/getWmScorePackagePageTask")
+ public R<?> getWmScorePackagePageTask(Page<WmScorePackage> page, WmScorePackage wmScorePackage) {
+ SysDept sysDept = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
+ QueryWrapper<WmScorePackage> queryWrapper = Wrappers.query();
+ queryWrapper.eq("del_flag", "0");
+ queryWrapper.eq("enable_flag", "0");
+ if (!SecurityUtils.getRoles().contains(2)) {
+ queryWrapper.eq("drug_ent_id", SecurityUtils.getUser().getDrugEntId());
+ if (null != wmScorePackage.getPackageFinishStatus()) {
+ if ("1".equals(wmScorePackage.getPackageFinishStatus())) {
+ queryWrapper.eq("package_audit_status", "1");
+ if (SecurityUtils.getRoles().contains(4) || SecurityUtils.getRoles().contains(5)) {
+ queryWrapper.eq("package_finish_status", "1");
+ queryWrapper.eq("package_audit_status", "0");
+ queryWrapper.eq("package_finish_status", "0");
+ if (null != wmScorePackage.getScoreId()) {
+ queryWrapper.like("score_id", wmScorePackage.getScoreId());
+ if (null != wmScorePackage.getTaskRuleId()) {
+ queryWrapper.eq("task_rule_id", wmScorePackage.getTaskRuleId());
+ if (null != wmScorePackage.getScoreName()) {
+ queryWrapper.like("score_name", wmScorePackage.getScoreName());
+ if (null != wmScorePackage.getLevel1Id()) {
+ queryWrapper.eq("level1_id", wmScorePackage.getLevel1Id());
+ List<WmScorePackage> listExt = new ArrayList<>();
+ WmDaDrugEnt wmDaDrugEnt = new WmDaDrugEnt();
+ wmDaDrugEnt.setDeptId(SecurityUtils.getUser().getDeptId());
+ WmDaDrugEnt wmDaDrugEnt1 = wmDaDrugEntMapper.selectDeptId(wmDaDrugEnt);
+ WmDaAgent wmDaAgent = new WmDaAgent();
+ wmDaAgent.setDeptId(SecurityUtils.getUser().getDeptId());
+ WmDaAgent wmDaAgent1 = wmDaAgentMapper.selectDeptId(wmDaAgent);
+ if (3 == sysDept.getLevel()) {
+ if (null != wmScorePackage.getTypeid() && "4".equals(wmScorePackage.getTypeid())) {
+ queryWrapper.eq("level1_id", wmDaDrugEnt1.getId());
+ queryWrapper.eq("typeid", 4);
+ wmScorePackage.setPackageFinishStatus("1");
+ queryWrapper.eq("package_finish_status", 1);
+ queryWrapper.eq("agent_type_id", 1);
+ queryWrapper.eq("level1_id", sysDept.getLevel2Id());
+ wmScorePackage.setAgentTypeId("1");
+ listExt = wmScorePackageService.listWmScorePackageAndTaskExtOld(wmScorePackage);
+ } else if (4 == sysDept.getLevel()) {
+ queryWrapper.eq("agent_type_id", 2);
+ queryWrapper.eq("level2_id", wmDaAgent1.getId());
+ queryWrapper.ne("typeid", 2);
+ wmScorePackage.setAgentTypeId("2");
+ wmScorePackage.setTypeid("2");
+ listExt = wmScorePackageService.listWmScorePackageAndTaskExt2Old(wmScorePackage);
+ } else if (2 == sysDept.getLevel()) {
+ queryWrapper.eq("typeid", 1);
+ wmScorePackage.setTypeid("1");
+ if (SecurityUtils.getRoles().contains(2)) {
+ queryWrapper.eq("old_package", 1);
+ Page<WmScorePackage> pageAnswer = wmScorePackageService.page(page, queryWrapper);
+ List<WmScorePackage> list = pageAnswer.getRecords();
+ for (WmScorePackage wmS :
+ list) {
+ for (WmScorePackage ext :
+ listExt) {
+ if (wmS.getId().equals(ext.getId())) {
+ wmS.setYsh(ext.getYsh());
+ wmS.setYtj(ext.getYtj());
+ if (2 == sysDept.getLevel()) {
+ wmS.setDsh(ext.getDsh());
+ if (null == ext.getYtj() || null == ext.getScore()) {
+ wmS.setDsh(0);
+ if (ext.getYtj() >= ext.getScore()) {
+ wmS.setDsh(100);
+ wmS.setDsh(new Double(Math.ceil(100.0 * ext.getYtj() / ext.getScore())).intValue());
+ break;
+ wmS.setPackageFinishStatus("0");
+ if ("1".equals(wmS.getPackageAuditStatus())) {
+ wmS.setPackageFinishStatus("1");
+ // 封装报告记录
+ wmS.setReportMqName(CacheConstants.EXPORT_NBA_HISTORY_REPORT_CACHE);
+ wmScorePackageService.getReportOpt(wmS);
+ // 封装excel报告状态
+ wmScorePackageService.getExcelReportOpt(wmS, CacheConstants.EXCEL_EXPORT_NBA_HISTORY_REPORT_CACHE);
+ pageAnswer.setRecords(list);
+ return R.ok(pageAnswer);
+ @GetMapping("/getWmScorePageTask")
+ public R<?> getWmScorePageTask(Page<WmScorePackage> page, WmScorePackage wmScorePackage) {
+ if (null != wmScorePackage.getId()) {
+ queryWrapper.like("id", wmScorePackage.getId());
+ if (null != wmScorePackage.getSendPackageDeptId()) {
+ queryWrapper.like("send_package_dept_id", wmScorePackage.getSendPackageDeptId());
+ if (null != wmScorePackage.getPackageStatus()) {
+ queryWrapper.like("package_status", wmScorePackage.getPackageStatus());
+ queryWrapper.eq("dept_id", SecurityUtils.getUser().getDeptId());
+ wmScorePackage.setDeptId(String.valueOf(SecurityUtils.getUser().getDeptId()));
+ wmScorePackage.setTypeid(String.valueOf(1));
+ wmScorePackageService.listWmScorePackageAndTaskExt(page, wmScorePackage);
+ wmScorePackage.setTypeid(String.valueOf(2));
+ wmScorePackageService.listWmScorePackageAndTaskExt2(page, wmScorePackage);
+ queryWrapper.eq("typeid", 0);
+ wmScorePackage.setTypeid(String.valueOf(0));
+ wmScorePackage.setSendPackageDeptId(wmScorePackage.getSendPackageDeptId());
// for (WmScorePackage ext : page.getRecords()) {
// List<WmScoreTaskType> taskTypelist = wmScoreTaskTypeMapper.getScoreTaskTypeByScoreId(ext.getId());
@@ -704,3354 +703,3354 @@ public class WmScorePackageController {
//
// });
- List<WmScorePackage> wmList = page.getRecords();
- List<Future<WmScorePackage>> futureList = new ArrayList<>(wmList.size());
- for (WmScorePackage wmS : wmList) {
- Future<WmScorePackage> future = wmScorePackageService.finishRate(wmS);
- futureList.add(future);
- List<WmScorePackage> finalRecords = new ArrayList<>(wmList.size());
- try {
- for (Future<WmScorePackage> future : futureList) {
- WmScorePackage sPackage = future.get();
- if (sPackage.getP2pAmount() != null) {
- sPackage.setP2pDraft(false);
- String s = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:amount:%s", sPackage.getId()));
- String s1 = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:service-amount:%s", sPackage.getId()));
- String desc = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:desc:%s", sPackage.getId()));
- sPackage.setP2pAmount(new BigDecimal(s));
- sPackage.setP2pServiceAmount(new BigDecimal(s1));
- sPackage.setDescription(desc);
- sPackage.setP2pDraft(true);
- finalRecords.add(sPackage);
- } catch (ExecutionException | InterruptedException e) {
- log.error("获取分页信息失败", e);
- return R.failed("获取分页信息失败");
- @GetMapping("/getWmScorePackageTask")
- public R<?> getWmScorePackageTask(Page<?> page, WmScorePackage wmScorePackage) {
- if (!SecurityUtils.getRoles().contains(2) && !SecurityUtils.getRoles().contains(1)) {
- if (SecurityUtils.getRoles().contains(4)) {
- SysDept sysDept1 = new SysDept();
- sysDept1.setDeptId(SecurityUtils.getUser().getDeptId());
- SysDept sysDept = sysDeptService.selectDeptId(sysDept1);
- if (sysDept.getLevel() == 3) {
- listExt = wmScorePackageService.listWmScorePackageAndTaskExt(wmScorePackage);
- } else if (sysDept.getLevel() == 4) {
- listExt = wmScorePackageService.listWmScorePackageAndTaskExt2(wmScorePackage);
- } else if (sysDept.getLevel() == 2) {
- if (SecurityUtils.getRoles().contains(2) || SecurityUtils.getRoles().contains(1)) {
- int ytj = 0;
- int ywc = 0;
- int dqf = 0;
- ywc += wmS.getScore();
- if (null != wmS.getYsh()) {
- //TODO
- //dqf+=wmS.getYsh();
- if (wmS.getYtj() > wmS.getScore()) {
- dqf += wmS.getScore();
- dqf += wmS.getYtj();
- if (null != wmS.getYtj()) {
- ytj += wmS.getScore();
- ytj += wmS.getYtj();
- Map<String, Object> map = new HashMap<>();
- map.put("ytj", ytj);
- map.put("ywc", ywc);
- map.put("dqf", dqf);
- return R.ok(map);
- @GetMapping("/getListRule")
- public R<?> getListRule(Page<WmScorePackage> page, WmScorePackage wmScorePackage) {
- if (null != sysDept) {
- WmDaAgent wmDaAgent = wmDaAgentService.getById(sysDept.getLevel2Id());
- wmScorePackage.setLevel1Id(wmDaAgent.getId());
- List<Integer> list = new ArrayList<>();
- list.add(2);
- list.add(3);
- list.add(4);
- wmScorePackage.setSendPackageDeptId(SecurityUtils.getUser().getDeptId() + "");
- Page<WmScorePackage> pageAnswer = wmScorePackageService.page(page, Wrappers.query(wmScorePackage)
- .lambda()
- .in(WmScorePackage::getTypeid, list));
- List<WmScorePackage> listExt = wmScorePackageService.listWmScorePackageAndTaskLevel3(wmScorePackage);
- List<WmScorePackage> listWmScorePackage = pageAnswer.getRecords();
- listWmScorePackage) {
- wmS.setYwctt(0);
- wmS.setYwctt(100);
- wmS.setYwctt(new Double(Math.ceil(100.0 * ext.getYtj() / ext.getScore())).intValue());
- pageAnswer.setRecords(listWmScorePackage);
- if (4 == sysDept.getLevel()) {
- WmDaAgent wmDaAgent = wmDaAgentService.getById(sysDept.getLevel3Id());
- wmScorePackage.setLevel2Id(wmDaAgent.getId());
- List<WmScorePackage> listExt = wmScorePackageService.listWmScorePackageAndTaskLevel1(wmScorePackage);
- wmS.setYwctt(ext.getDsh());
- if (!(ext.getYtj() > ext.getScore())) {
- sysDept.setDeptId(sysDept.getDeptId());
- return R.ok(wmScorePackageService.page(page, Wrappers.query(wmScorePackage)));
- @GetMapping("/getTotalData")
- public R<?> getTotalData(WmScorePackage wmScorePackage) {
- List<WmScorePackage> list = wmScorePackageService.list(Wrappers.query(wmScorePackage).lambda());
- List<WmScorePackage> newList = new ArrayList<>();
- for (WmScorePackage wmS : list) {
- if ("2".equals(wmS.getTypeid()) || "3".equals(wmS.getTypeid()) || "4".equals(wmS.getTypeid())) {
- if (SecurityUtils.getUser().getDeptId().toString().equals(wmS.getDeptId())) {
- newList.add(wmS);
- return R.ok(newList);
- return R.ok(wmScorePackageService.list(Wrappers.query(wmScorePackage)
- .in(WmScorePackage::getTypeid, list)));
- return R.ok(wmScorePackageService.pageList(Wrappers.query(wmScorePackage)));
- * 通过id查询积分包
- * @param id id
- @GetMapping("/{id}")
- public R<?> getById(@PathVariable("id") Integer id) {
- return R.ok(wmScorePackageService.getById(id));
- * 新增积分包
- @SysLog("新增积分包")
- @PostMapping
- public R<?> save(@RequestBody WmScorePackage wmScorePackage) {
- if (wmScorePackage.getScore() <= 0) {
- return R.failed("积分包分值必须大于0");
- if (null != wmScorePackage.getScoreId() && !"".equals(wmScorePackage.getScoreId())) {
- WmScorePackage wmScorePackage1 = new WmScorePackage();
- wmScorePackage1.setDelFlag("0");
- wmScorePackage1.setScoreId(wmScorePackage.getScoreId());
- List<WmScorePackage> wmScorePackageList = wmScorePackageService.list(Wrappers.query(wmScorePackage1));
- if (wmScorePackageList.size() > 0) {
- return R.failed("积分包ID已存在");
- wmScorePackage.setIsConduct("0");
- if ("1".equals(wmScorePackage.getTypeid())) {
- WmDaAgent wmDaAgent = wmDaAgentService.getById(wmScorePackage.getLevel1Id());
- wmScorePackage.setDeptId(wmDaAgent.getDeptId() + "");
- } else if ("2".equals(wmScorePackage.getTypeid())) {
- if (null != wmScorePackage.getLevel2Id()) {
- WmDaAgent wmDaAgent = wmDaAgentService.getById(wmScorePackage.getLevel2Id());
- WmDaAgent wmDaAgent1 = wmDaAgentService.getById(sysDept.getLevel2Id());
- wmScorePackage.setLevel1Id(wmDaAgent1.getId());
- } else if ("3".equals(wmScorePackage.getTypeid())) {
- if (null != wmScorePackage.getXxdbId()) {
- SysUser sysUser = sysUserService.getById(wmScorePackage.getXxdbId());
- if (null != sysUser.getDeptId()) {
- wmScorePackage.setDeptId(sysUser.getDeptId() + "");
- sysDept1.setDeptId(sysUser.getDeptId());
- wmScorePackage.setLevel1Id(sysDept.getLevel2Id() == null || sysDept.getLevel2Id() == 0 ? null : sysDept
- .getLevel2Id() + "");
- wmScorePackage.setLevel2Id(sysDept.getLevel3Id() == null || sysDept.getLevel3Id() == 0 ? null : sysDept
- .getLevel3Id() + "");
- wmScorePackage.setPackageStatus("2");
- } else if ("4".equals(wmScorePackage.getTypeid())) {
- wmScorePackage.setLevel1Id(sysDept.getLevel2Id() == null || sysDept.getLevel2Id() == 0 ? null : sysDept.getLevel2Id() + "");
- wmScorePackage.setLevel2Id(sysDept.getLevel3Id() == null || sysDept.getLevel3Id() == 0 ? null : sysDept.getLevel3Id() + "");
- if (null != wmScorePackage.getScoreName() && !"".equals(wmScorePackage.getScoreName())) {
- wmScorePackage1.setScoreName(wmScorePackage.getScoreName());
- wmScorePackage1.setDeptId(wmScorePackage.getDeptId());
- return R.failed("积分包名称已存在");
- wmScorePackage.setCreateTime(LocalDateTime.now());
- wmScorePackage.setPackageFinishStatus("0");
- wmScorePackage.setPackageAuditStatus("0");
- boolean isAnswer = wmScorePackageService.save(wmScorePackage);
- if (isAnswer) {
- WmScorePackage queryWm = new WmScorePackage();
- queryWm.setAgentTypeId("1");
- queryWm.setTypeid("1");
- queryWm.setDrugEntId(SecurityUtils.getUser().getDrugEntId());
- queryWm.setLevel1Id(sysDept.getLevel2Id() + "");
- queryWm.setTaskRuleId(wmScorePackage.getTaskRuleId());
- queryWm.setDeptId(SecurityUtils.getUser().getDeptId() + "");
- queryWm.setAgentTypeId("2");
- queryWm.setTypeid("2");
- queryWm.setId("-1");
- List<WmScorePackage> wmScorePackageList = wmScorePackageService.list(Wrappers.query(queryWm));
- for (WmScorePackage wms : wmScorePackageList) {
- wms.setIsConduct("1");
- wmScorePackageService.updateBatchById(wmScorePackageList);
- * 修改积分包
- @SysLog("修改积分包")
- @PutMapping
- public R<?> updateById(@RequestBody WmScorePackage wmScorePackage) {
- WmScorePackage oldData = wmScorePackageService.getById(wmScorePackage.getId());
- if (StringUtils.isNotEmpty(wmScorePackage.getScorePackageName())
- && !oldData.getScorePackageName().equals(wmScorePackage.getScorePackageName())) {
- wmScorePackage1.setScorePackageName(wmScorePackage.getScorePackageName());
- List<WmScorePackage> wmScorePackageList = wmScorePackageService.listWmScorePackages(wmScorePackage1);
- if (wmScorePackageList.size() > 1) {
- if ("4".equals(wmScorePackage.getPackageStatus())) {
- WmTask wmTask = new WmTask();
- wmTask.setScorePackageId(wmScorePackage.getId());
- List<WmTask> wmTaskList = wmTaskService.list(Wrappers.query(wmTask));
- for (WmTask wmt : wmTaskList) {
- wmt.setEnableFlag("1");
- wmTaskService.updateBatchById(wmTaskList);
- return R.ok(wmScorePackageService.updateById(wmScorePackage));
- * @param wmScorePackageVO 积分包
- @SysLog("修改积分包折扣和实际结算金额")
- @PostMapping(value = "/updateByIdWithType")
- public R<?> updateByIdWithType(@RequestBody @Valid WmScorePackageVO wmScorePackageVO) {
- return wmScorePackageService.updateByIdWithType(wmScorePackageVO);
- * 通过id删除积分包
- @SysLog("通过id删除积分包")
- @DeleteMapping("/{id}")
- public R<?> removeById(@PathVariable Integer id) {
- return R.ok(wmScorePackageService.removeById(id));
- * 获取药企列表
- * @return 角色列表
- @GetMapping("/list")
- public R<?> listWmScorePackage(WmScorePackage wmScorePackage) {
- List<WmScorePackage> list = wmScorePackageService.list(Wrappers.query(wmScorePackage));
- List<Map<String, String>> answerList = new ArrayList<>();
- if (list.size() > 0) {
- for (WmScorePackage sysUser : list) {
- Map<String, String> map = new HashMap<>();
- map.put("id", sysUser.getId() + "");
- if (null == sysUser.getScoreId() || "".equals(sysUser.getScoreId().trim())) {
- map.put("scoreId", "-");
- map.put("scoreId", sysUser.getScoreId());
- if (null == sysUser.getScoreName() || "".equals(sysUser.getScoreName().trim())) {
- map.put("scoreName", "-");
- map.put("scoreName", sysUser.getScoreName() + "");
- answerList.add(map);
- return R.ok(answerList);
- @GetMapping("/listWmScorePackageAndTask")
- public R<?> listWmScorePackageAndTask(WmScorePackage wmScorePackage) {
- return R.ok(wmScorePackageService.listWmScorePackageAndTask(wmScorePackage));
- @GetMapping("/packageIsZZ")
- public R<?> packageIsZZ(WmScorePackage wmScorePackage) {
- @GetMapping("/getPlatTotalData")
- public R<?> getPlatTotalData(Page<?> page, WmScorePackage wmScorePackage, String[] dates) {
- if (null != dates && dates.length > 0) {
- // 将时间戳转为当前时间
- wmScorePackage.setDelFlag(dates[0].substring(0, 10));
- wmScorePackage.setEnableFlag(dates[1].substring(0, 10));
- return R.ok(wmScorePackageService.getPlatTotalData(page, wmScorePackage));
- @GetMapping("/listNoDel")
- public R<?> listWmScorePackageNoDel(WmScorePackage wmScorePackage) {
- if (CollectionUtils.isNotEmpty(list)) {
- for (WmScorePackage scorePackage : list) {
- map.put("id", scorePackage.getId() + "");
- if (StringUtils.isEmpty(scorePackage.getScoreId())) {
- map.put("scoreId", scorePackage.getScoreId());
- if (StringUtils.isEmpty(scorePackage.getScorePackageName())) {
- map.put("scoreName", scorePackage.getScorePackageName());
- * @return 积分包列表
- @GetMapping("/selectLists")
- public R<?> selectLists(WmScorePackage wmScorePackage) {
- wmScorePackage.getRelationScoreId();
- return R.ok(wmScorePackageService.selectLists(wmScorePackage));
- * 查看分配积分信息 二期 业务平台
- @PostMapping("/selectWmScorePackage")
- public R<?> selectWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
- return R.ok(wmScorePackageService.selectWmScorePackage(wmScorePackage));
- } catch (Exception e) {
- e.printStackTrace();
- return R.failed();
- * 获取企业大包详细信息
- * @param id 积分包id
- * @return {@link R}<{@link ?}> 积分包详情
- @GetMapping("/get-big-package-detail")
- public R<?> getBigPackageDetail(String id) {
- WmScorePackage wmScorePackage = wmScorePackageMapper.selectById(id);
- // 关联积分包
- if (StrUtil.isBlank(wmScorePackage.getRelationScoreId())) {
- wmScorePackage.setRelationScoreId("-1");
- wmScorePackage.setRelationScoreName("无");
- WmScorePackage relationPackage = wmScorePackageMapper.selectById(wmScorePackage.getRelationScoreId());
- if (relationPackage != null) {
- wmScorePackage.setRelationScoreName(relationPackage.getScorePackageName());
- // 关联服务企业
- if (StrUtil.isNotBlank(wmScorePackage.getRelatedService())) {
- SysDept serviceDept = sysDeptService.getById(wmScorePackage.getRelatedService());
- if (serviceDept != null) {
- wmScorePackage.setRelatedServiceName(serviceDept.getName());
- // 接包对象
- if (StrUtil.isNotBlank(wmScorePackage.getAcceptSug())) {
- // 此处暂认为drugEnt和agent不会出现相同的id
- WmDaAgent daAgent = wmDaAgentMapper.selectById(wmScorePackage.getAcceptSug());
- if (daAgent == null) {
- WmDaDrugEnt daDrugEnt = wmDaDrugEntMapper.selectById(wmScorePackage.getAcceptSug());
- if (daDrugEnt != null) {
- wmScorePackage.setAcceptSug(daDrugEnt.getEntname());
- wmScorePackage.setAcceptSugName(daAgent.getGsmc());
- // 可分配积分值
- List<WmScorePackage> scorePackagekfpjf =
- wmScorePackageService.getScorePackagekfpjf(
- null,
- new String[]{"0", "1", "2"},
- new String[]{id});
- if (CollUtil.isNotEmpty(scorePackagekfpjf)) {
- wmScorePackage.setKfpjf(scorePackagekfpjf.get(0).getKfpjf());
- // 推广药品
- if (ArrayUtil.isNotEmpty(wmScorePackage.getDrugtable())) {
- List<WmDaDrugEntDrugtable> drugtables = wmDaDrugEntDrugtableService.listByIds(Stream.of(wmScorePackage.getDrugtable()).collect(Collectors.toSet()));
- if (CollUtil.isNotEmpty(drugtables)) {
- String[] drugtableNames = drugtables.stream().map(WmDaDrugEntDrugtable::getDrugname).toArray(String[]::new);
- wmScorePackage.setDrugtableName(drugtableNames);
- // 积分包关联的有效任务类型
- WmScoreTaskType wmScoreTaskType = new WmScoreTaskType();
- wmScoreTaskType.setScoreId("-1".equals(wmScorePackage.getRelationScoreId()) ? wmScorePackage.getId() : wmScorePackage.getRelationScoreId());
- List<WmScoreTaskType> taskTypeList = wmScoreTaskTypeMapper.listWmScoreTaskType(wmScoreTaskType);
- Set<String> taskTypeSet = taskTypeList.stream().map(WmScoreTaskType::getTaskTypeId).collect(Collectors.toSet());
- wmScorePackage.setTaskTypeSet(taskTypeSet);
- // 查询关联的试卷
- List<WmPkgQuizRelation> quizRelations = pkgQuizRelationService.listQuizRelationsByPkgIds(Collections.singletonList(Integer.parseInt(id)));
- if (CollUtil.isNotEmpty(quizRelations)){
- List<Integer> quizIds = quizRelations.stream().map(WmPkgQuizRelation::getQuizId).collect(Collectors.toList());
- List<Integer> relIds = quizRelations.stream().map(WmPkgQuizRelation::getRelationId).collect(Collectors.toList());
- wmScorePackage.setQuizIds(quizIds);
- wmScorePackage.setQuizRelationIds(relIds);
- wmScorePackage.setQuizNames(quizRelations.stream().map(WmPkgQuizRelation::getTitle).collect(Collectors.toList()));
- wmScorePackage.setQuizRelations(quizRelations);
- return R.ok(wmScorePackage);
- * BC-企业承接任务
- * @param current 当前页
- * @param size 每页大小
- * @param scorePackageName 积分包名称
- * @param acceptSug 接包对象
- * @param allocationDate 分配日期
- * @param endLabelDate 结束标签日期
- * @return {@link R}<{@link ?}> 结果
- @GetMapping("/selectWmScorePackageListsForBC")
- public R<?> selectWmScorePackageListForBC(@RequestParam(value = "current") Integer current,
- @RequestParam(value = "size") Integer size,
- @RequestParam(value = "deptId") Integer deptId,
- @RequestParam(value = "scorePackageName", required = false) String scorePackageName,
- @RequestParam(value = "acceptSug", required = false) String acceptSug,
- @RequestParam(value = "allocationDate", required = false) LocalDate allocationDate,
- @RequestParam(value = "endLabelDate", required = false) LocalDate endLabelDate) {
- Page<WmScorePackage> pageAnswer = wmScorePackageService.selectWmScorePackageLists(new Page<>(current, size), deptId,
- scorePackageName, acceptSug, allocationDate, endLabelDate);
- //根据积分包id查询计算完成积分值 已付积分值
- List<WmScorePackage> wmList = pageAnswer.getRecords();
- WmScorePackage wmScorePackage = future.get();
- if (wmScorePackage.getP2pAmount() != null) {
- wmScorePackage.setP2pDraft(false);
- String s = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:amount:%s", wmScorePackage.getId()));
- String s1 = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:service-amount:%s", wmScorePackage.getId()));
- String desc = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:desc:%s", wmScorePackage.getId()));
- wmScorePackage.setP2pAmount(new BigDecimal(s));
- wmScorePackage.setP2pServiceAmount(new BigDecimal(s1));
- wmScorePackage.setDescription(desc);
- wmScorePackage.setP2pDraft(true);
- finalRecords.add(wmScorePackage);
- pageAnswer.setRecords(finalRecords);
- * 分页查询积分管理信息 二期 业务平台
- @GetMapping("/selectWmScorePackageLists")
- public R<?> selectWmScorePackageList(@RequestParam(value = "current") Integer current,
- return this.selectWmScorePackageListForBC(current, size, deptId, scorePackageName, acceptSug, allocationDate, endLabelDate);
- * 获取关联积分包名称 二期 业务平台
- @GetMapping("/lists")
- public R<?> listWmScorePackages(WmScorePackage wmScorePackage) {
- // 当前企业deptId
- String deptId = wmScorePackage.getDeptId();
- if (StrUtil.isBlank(deptId)) {
- deptId = String.valueOf(SecurityUtils.getUser().getDeptId());
- wmScorePackage.setDeptId(deptId);
- SysDept dept = sysDeptService.getById(deptId);
- List<Map<String, Object>> answerList = new ArrayList<>();
- if (dept.getLevel() == 3) {
- for (WmScorePackage wmScorePackage1 : list) {
- Map<String, Object> map1 = new HashMap<>();
- map1.put("relationScoreId", wmScorePackage1.getId());
- map1.put("scorePackageName", wmScorePackage1.getScorePackageName());
- answerList.add(map1);
- * 根据上级药企获取关联积分包 二期 业务平台(企业承接新增积分包的)
- @GetMapping("/selectRelationScoreId")
- public R<?> selectRelationScoreId(WmScorePackage wmScorePackage) {
- SysDept selfId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
- SysDept sysDept = sysDeptService.getById(wmScorePackage.getRelatedService());
- //获取关联积分包
- if (sysDept.getLevel() == 2 && selfId.getLevel() != 2) {
- wmScorePackage.setSendPackageDeptId(wmScorePackage.getRelatedService());
- List<WmScorePackage> list = wmScorePackageService.selectByReRelatedService(wmScorePackage);
- if (wmScorePackage1.getKfpjf() == null || wmScorePackage1.getKfpjf() <= 0) {
- // 过滤掉可分配积分值为0的积分包
- map1.put("relationScoreName", wmScorePackage1.getScorePackageName());
- map1.put("drugProducerList", wmScorePackage1.getDrugProducerList());
- map1.put("drugtable", wmScorePackage1.getDrugtable());
- map1.put("id", wmScorePackage1.getId());
- } else if (SecurityUtils.getRoles().contains(3)) {
- Map<String, Object> map2 = new HashMap<>();
- map2.put("id", "-1");
- map2.put("relationScoreName", "无");
- answerList.add(map2);
- } else if (sysDept.getLevel() == 3) {
- wmScorePackage.setDeptId(wmScorePackage.getRelatedService());
- Map<String, Object> map3 = new HashMap<>();
- map3.put("id", wmScorePackage1.getId());
- map3.put("drugProducerList", wmScorePackage1.getDrugProducerList());
- map3.put("drugtable", wmScorePackage1.getDrugtable());
- map3.put("relationScoreName", wmScorePackage1.getScorePackageName());
- answerList.add(map3);
- Map<String, Object> map4 = new HashMap<>();
- map4.put("id", "-1");
- map4.put("relationScoreName", "无");
- answerList.add(map4);
- } else if (selfId.getLevel() == 2) {
- Map<String, Object> map5 = new HashMap<>();
- map5.put("id", "-1");
- map5.put("relationScoreName", "无");
- answerList.add(map5);
- * 获取可分配积分 二期 业务平台
- @GetMapping("/selectKfpjf")
- public R<?> selectKfpjf(WmScorePackage wmScorePackage) {
- SysDept wmId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
- WmDaAgent anId = wmDaAgentService.selectByDeptId(wmId.getDeptId());
- //获取接包对象和可分配积分
- List wmDaDrugEnts = new ArrayList();
- if ("-1".equals(wmScorePackage.getId()) && wmId.getLevel() == 3) {
- map2.put("kfpjf", "");
- List<WmDaAgent> list = wmDaAgentService.listAgentByDeptRelation(Integer.parseInt(anId.getDeptId()));
- for (int i = 0; i < list.size(); i++) {
- if (Integer.parseInt(list.get(i).getEnableFlag()) == 0) {
- wmDaDrugEnts.add(list.get(i));
- } else if ("-1".equals(wmScorePackage.getId()) && wmId.getDeptId()
- .equals(SecurityUtils.getUser().getDeptId())) {
- WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(wmId.getDeptId());
- List<WmDaAgent> list = wmDaAgentService.selectWmDaAgentByDeptId(wmDaDrugEnt.getDeptId());
- List<WmDaAgent> list = wmDaAgentService.selectWmDaAgentByRelationIds(wmId.getDeptId());
- map2.put("acceptSug", wmDaDrugEnts);
- if (SecurityUtils.getUser().getDeptId().equals(Integer.valueOf(wmScorePackage1.getDeptId()))) {
- wmScoreTaskType.setScoreId(wmScorePackage1.getId());
- wmScorePackage1.setWmScoreTaskTypeList(wmScoreTaskTypeService.listWmScoreTaskTypes(wmScoreTaskType));
- map2.put("kfpjf", wmScorePackage1.getKfpjf());
- //获取数据
- if (wmId.getLevel() == 3) {
- Set<String> taskTypeSet = taskTypeList.stream()
- .map(WmScoreTaskType::getTaskTypeId)
- .collect(Collectors.toSet());
- map1.put("scoreId", wmScorePackage1.getScoreId());
- map1.put("kfpjf", wmScorePackage1.getKfpjf());
- map1.put("belongDate", wmScorePackage1.getBelongDate());
- map1.put("packsgeType1", wmScorePackage1.getPackageType1());
- map1.put("wmScoreTaskTypeList", wmScorePackage.getTaskTypeSet());
- map1.put("wmScoreTaskTypeList1", wmScorePackage1.getWmScoreTaskTypeList());
- stringList.add(wmScorePackage1.getScoreId());
- * 新增积分包(大包)
- * 满足以下任一条件,则可以发包
- * 1.存在积分充值配置,并且 发包积分 < 积分充值分配的积分
- * 2.关联了上级积分包
- * @param wmScorePackage 积分包信息
- * @return 新增结果
- @SysLog("新增积分包(大包)")
- @PostMapping("/saves")
- public R<?> saves(@RequestBody WmScorePackage wmScorePackage) {
- log.info("新增积分包(大包)入参:{}", wmScorePackage);
- HnqzUser operator = SecurityUtils.getUser();
- LocalDateTime now = LocalDateTime.now();
- List<Integer> roles = SecurityUtils.getRoles();
- Integer deptId = operator.getDeptId();
- Integer userId = operator.getId();
- String relPkgId = wmScorePackage.getRelationScoreId();
- boolean relatedScoreId = StrUtil.isNotBlank(relPkgId) && Integer.parseInt(relPkgId) > 0;
- SysDeptRecharge deptRecharge = null;
- // 校验积分值
- // 校验积分包名称是否存在
- if (StrUtil.isNotBlank(wmScorePackage.getScorePackageName())) {
- int existed = wmScorePackageService.count(Wrappers.<WmScorePackage>lambdaQuery()
- .eq(WmScorePackage::getDelFlag, "0")
- .eq(WmScorePackage::getScorePackageName, wmScorePackage.getScorePackageName())
- .eq(WmScorePackage::getDeptId, wmScorePackage.getDeptId()));
- if (existed != 0) {
- if (!relatedScoreId) {
- // 校验 发包积分 < 积分充值分配的积分 则可以发包
- deptRecharge = sysDeptRechargeMapper.selectOne(Wrappers.<SysDeptRecharge>lambdaQuery().eq(SysDeptRecharge::getDeptId, deptId));
- if (deptRecharge == null) {
- log.error("未配置积分充值信息");
- throw new BizException("积分余额:0,积分不足");
- int limitScore = deptRecharge.getScore() + deptRecharge.getOverdrawScore();
- if (wmScorePackage.getScore() > limitScore) {
- log.error("已分配积分不足,发包积分={},剩余积分={},透支额度={}", wmScorePackage.getScore(), deptRecharge.getScore(), limitScore);
- throw new BizException(String.format("积分余额:%s,积分不足", deptRecharge.getScore()));
- // 校验上级可分配积分值
- new String[]{wmScorePackage.getRelationScoreId()});
- int kfpjf = scorePackagekfpjf.get(0).getKfpjf();
- if (wmScorePackage.getScore() > kfpjf) {
- log.error("可分配积分值不足");
- throw new BizException("可分配积分值不足");
- wmScorePackage.setPackageType1("1");
- wmScorePackage.setPackageIsConduct("0");
- wmScorePackage.setDrugEntId("");
- wmScorePackage.setCreateUser(userId);
- wmScorePackage.setCreateTime(now);
- wmScorePackage.setUpdateTime(now);
- wmScorePackage.setSendPackageDeptId(deptId.toString());
- wmScorePackage.setAllocationDate(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN).format(now));
- if (wmScorePackage.getEndTime() == null) {
- // 默认截止日期为一年后
- wmScorePackage.setEndTime(now.plusYears(1).toLocalDate());
- // 关联上级推广药品企业(兼容历史)
- if (StringUtils.isEmpty(relPkgId)) {
- wmScorePackage.setDrugProducerList(null);
- } else if (StringUtils.isNotEmpty(relPkgId) && ArrayUtils.isEmpty(wmScorePackage.getDrugtable())) {
- // 关联上级推广药品
- WmScorePackage relateSp = wmScorePackageService.getById(relPkgId);
- if (relateSp != null) {
- wmScorePackage.setDrugtable(relateSp.getDrugtable());
- SysDept sysDeptRelatedService = sysDeptService.getById(Integer.valueOf(wmScorePackage.getRelatedService()));
- if (StrUtil.isBlank(wmScorePackage.getTypeid())) {
- WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(deptId);
- if (wmDaDrugEnt != null) {
- if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug().equals(wmDaDrugEnt.getId())) {
- WmDaAgent wmDaAgent = wmDaAgentService.getById(wmScorePackage.getAcceptSug());
- SysDept sysDepts = sysDeptService.getById(Integer.valueOf(wmDaAgent.getDeptId()));
- if (sysDepts.getLevel() == 3) {
- } else if (sysDepts.getLevel() == 4) {
- wmScorePackage.setDeptId(wmDaAgent.getDeptId());
- wmScorePackage.setKfpjf(wmScorePackage.getScore());
- } else if (wmDaDrugEnt.getId().equals(wmScorePackage.getAcceptSug())) {
- wmScorePackage.setDeptId(deptId.toString());
- if (sysDeptRelatedService.getLevel() == 2) {
- WmDaDrugEnt wmDaDrugEnts = wmDaDrugEntService.selectByDeptId(Integer.valueOf(wmScorePackage.getRelatedService()));
- if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug().equals(wmDaDrugEnts.getId())) {
- } else if (wmScorePackage.getAcceptSug().equals(wmDaDrugEnt.getId())) {
- } else if (sysDeptRelatedService.getLevel() == 3) {
- WmDaAgent wmDaAgent1 = wmDaAgentService.selectByDeptId(Integer.valueOf(wmScorePackage.getRelatedService()));
- if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug().equals(wmDaAgent1.getId())) {
- } else if (wmDaAgent1.getId().equals(wmScorePackage.getAcceptSug())) {
- //药企规则ID
- SysDept sysDeptRuleId = sysDeptService.getById(deptId);
- Integer deptLevel = sysDeptRuleId.getLevel();
- if (deptLevel == 2) {
- WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(sysDeptRuleId.getDeptId());
- if (wmScorePackage.getAcceptSug().equals(wmDaDrugEnt.getId())) {
- wmScorePackage.setRuleId(wmScorePackage.getAcceptSug());
- wmScorePackage.setDrugEntId(wmDaDrugEnt.getId());
- } else if (!wmScorePackage.getAcceptSug().equals(wmDaDrugEnt.getId())) {
- WmTaskType wmTaskType = new WmTaskType();
- wmTaskType.setRuleId(wmDaDrugEnt.getId() + wmScorePackage.getAcceptSug());
- List<WmTaskType> wmTaskTypeList = wmTaskTypeService.selectByRuleId(wmTaskType);
- if (CollUtil.isNotEmpty(wmTaskTypeList)) {
- wmScorePackage.setRuleId(wmDaDrugEnt.getId() + wmScorePackage.getAcceptSug());
- log.error("请药企给下级cso分配积分规则");
- return R.failed("请药企给下级cso分配积分规则");
- } else if (deptLevel == 3) {
- //一级cso规则ID
- .eq(WmDaAgent::getEnableFlag, EnableEnum.ENABLE.val())
- .eq(WmDaAgent::getDelFlag, DelEnum.NOT_DEL.val())
- .eq(WmDaAgent::getDeptId, String.valueOf(sysDeptRuleId.getDeptId())));
- if (StringUtils.isNotBlank(wmScorePackage.getRelationScoreId())) {
- // 关联了积分包的情况
- WmScorePackage relationScorePackage = wmScorePackageService.getById(wmScorePackage.getRelationScoreId());
- if (relationScorePackage != null) {
- wmScorePackage.setRuleId(relationScorePackage.getRuleId());
- wmScorePackage.setDrugEntId(relationScorePackage.getDrugEntId());
- log.error("cso没有分配积分规则");
- return R.failed("cso没有分配积分规则");
- // 没有关联积分包的情况
- List<WmTaskType> taskTypeList = wmTaskTypeService.list(Wrappers.<WmTaskType>lambdaQuery()
- .eq(WmTaskType::getRuleId, daAgent.getId()));
- if (CollectionUtil.isNotEmpty(taskTypeList)) {
- wmScorePackage.setRuleId(daAgent.getId());
- // 保存积分包
- String typeId = "";
- if (roles.contains(4) || roles.contains(3)) {
- typeId = wmScorePackage.getDeptId().equals(deptId.toString()) ? "0" : "1";
- typeId = wmScorePackage.getDeptId().equals(deptId.toString()) ? "1" : "2";
- wmScorePackage.setTypeid(typeId);
- // 发包成功 更新 上级包
- if ((roles.contains(4) || roles.contains(3)) && deptLevel == 3) {
- WmScorePackage relPkg = wmScorePackageService.getById(relPkgId);
- // 是当前操作人所在企业的的关联包
- if (relPkg != null && deptId.toString().equals(relPkg.getDeptId())) {
- relPkg.setKfpjf((int) Math.ceil(relPkg.getKfpjf() - wmScorePackage.getScore()));
- // 判断积分包是否被发放 (原有外包业务逻辑,不知道为什么)
- int count = wmScorePackageService.count(Wrappers.<WmScorePackage>lambdaQuery()
- .ne(WmScorePackage::getId, wmScorePackage.getId())
- .eq(WmScorePackage::getId, relPkgId)
- .eq(WmScorePackage::getEnableFlag, "0")
- .notIn(WmScorePackage::getTypeid, 3, 4));
- relPkg.setPackageIsConduct(count == 0 ? "0" : "1");
- wmScorePackageService.updateById(relPkg);
- // 失败了
- else {
- return R.failed("下发积分包失败");
- List<WmScoreTaskType> taskTypeList = wmScorePackage.getWmScoreTaskTypeList();
- if (CollUtil.isNotEmpty(taskTypeList)) {
- if (StrUtil.isBlank(relPkgId) || (StrUtil.isNotBlank(relPkgId) && deptLevel == 3)) {
- List<WmScoreTaskType> scoreTaskTypes = taskTypeList.stream().map(taskType -> {
- wmScoreTaskType.setScoreId(wmScorePackage.getId());
- wmScoreTaskType.setType("1");
- wmScoreTaskType.setTaskTypeId(taskType.getTaskTypeId());
- return wmScoreTaskType;
- wmScoreTaskTypeService.deleteByScoreId(wmScorePackage.getId());
- wmScoreTaskTypeService.batchInsertType(scoreTaskTypes);
- // 更新积分充值信息
- int currentScore = deptRecharge.getScore() - wmScorePackage.getScore();
- int updateRecharge = sysDeptRechargeMapper.update(null, Wrappers.<SysDeptRecharge>lambdaUpdate()
- .eq(SysDeptRecharge::getId, deptRecharge.getId())
- .eq(SysDeptRecharge::getVersion, deptRecharge.getVersion())
- .set(SysDeptRecharge::getScore, currentScore)
- .set(SysDeptRecharge::getVersion, deptRecharge.getVersion() + 1)
- .set(SysDeptRecharge::getUpdateTime, now)
- .set(SysDeptRecharge::getUpdateUser, userId));
- if (updateRecharge <= 0) {
- log.warn("更新积分充值信息失败");
- throw new RuntimeException("操作失败,请重试");
- // 更新积分充值记录
- SysDeptRechargeRecord rechargeRecord = new SysDeptRechargeRecord();
- rechargeRecord.setDeptId(deptId);
- rechargeRecord.setChangeScore(-wmScorePackage.getScore());
- rechargeRecord.setRechargeId(deptRecharge.getId());
- rechargeRecord.setPackageId(wmScorePackage.getId());
- rechargeRecord.setPackageType(RechargeRecordPackageType.TO_ENTERPRISE);
- rechargeRecord.setType(RechargeRecordType.SEND_PACKAGE_DEPT);
- rechargeRecord.setCurrentScore(currentScore);
- rechargeRecord.setCreateUser(userId);
- rechargeRecord.setCreateTime(now);
- sysDeptRechargeRecordMapper.insert(rechargeRecord);
- // 保存关联的试卷
- if (CollUtil.isNotEmpty(wmScorePackage.getQuizIds())) {
- pkgQuizRelationService.createPkgQuizzes(wmScorePackage.getQuizIds(), Integer.parseInt(wmScorePackage.getId()));
- // 判断是否有关联关系
- if (CollUtil.isNotEmpty(wmScorePackage.getQuizRelationIds())) {
- pkgQuizRelationService.copyQuizRelations(wmScorePackage.getQuizRelationIds(), Integer.parseInt(wmScorePackage.getId()));
- * 终止积分包(大包)
- @SysLog("终止积分包(大包)")
- @PostMapping("/stopWmScorePackage")
- public R<?> stopWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
- log.info("终止积分包(大包)入参:{}", wmScorePackage);
- if (StrUtil.isBlank(wmScorePackage.getId()) || !StrUtil.equalsAny(wmScorePackage.getEnableType(), "1", "2")) {
- String cacheKey = CacheConstants.TERMINATE_PACKAGE_KEY + wmScorePackage.getId();
- Boolean absent = redisTemplate.opsForValue().setIfAbsent(cacheKey, JSONUtil.toJsonStr(wmScorePackage), 3L, TimeUnit.SECONDS);
- if (Boolean.FALSE.equals(absent)) {
- return R.failed("正在处理");
- return R.ok(wmScorePackageService.terminatePackageForDept(wmScorePackage.getId(),
- UpmsType.TerminatePackageType.getByEnableType(wmScorePackage.getEnableType())));
- * 终止积分包 new 终止 二期 业务平台
- @SysLog("终止积分包")
- @PostMapping("/updateStatusByIds")
- public R<?> updateStatusByIds(@RequestBody WmScorePackage wmScorePackage) {
- wmScorePackage.setUpdateUser(SecurityUtils.getUser().getId());
- wmScorePackage.setUpdateTime(LocalDateTime.now());
- if (null != wmScorePackage.getRelationScoreId() && !"".equals(wmScorePackage.getRelationScoreId())) {
- wmScorePackage1.setRelationScoreId(wmScorePackage.getRelationScoreId());
- if (null != wmScorePackage.getScorePackageName() && !"".equals(wmScorePackage.getScorePackageName())) {
- wmScorePackage1.setEnableFlag("0");
- WmScorePackage wmId = wmScorePackageService.getById(wmScorePackage.getId());
- if (wmId.getId().equals(wms.getRelationScoreId())) {
- return R.failed("积分包已被分派,请联系下属CSO终止关联积分包");
- } else if (null != wms.getRelationScoreId() && "".equals(wms.getRelationScoreId())) {
- wmScorePackage.setEnableFlag("1");
- wmScorePackage.setPackageFinishStatus("2");
- List<WmScorePackage> wmScorePackages = wmScorePackageService.selectRelationScoreId(wmId.getId());
- if (wmScorePackages.size() > 0) {
- for (WmScorePackage wmScorePackage3 : wmScorePackages) {
- if (wmId.getRelationScoreId().equals(wmScorePackage3.getRelationScoreId())) {
- wms.setPackageIsConduct("1");
- wms.setPackageIsConduct("0");
- if (SecurityUtils.getRoles().contains(4) || SecurityUtils.getRoles().contains(3)) {
- queryWm.setEnableFlag("0");
- for (WmScorePackage wmScorePackage2 : wmScorePackageList) {
- if (wmId.getId().equals(wmScorePackage2.getRelationScoreId())) {
- } else if (wmScorePackage2.getId().equals(wmId.getRelationScoreId())) {
- for (WmScorePackage wmScorePackage1 : wmScorePackages) {
- if (wmId.getRelationScoreId().equals(wmScorePackage1.getRelationScoreId())) {
- wmScorePackage2.setPackageIsConduct("1");
- wmScorePackage2.setPackageIsConduct("0");
- wmScorePackage2.setKfpjf(new Double(Math.ceil(wmScorePackage2.getKfpjf() + wmId.getScore())).intValue());
- } else if (null == wmScorePackage.getRelationScoreId() || "".equals(wmScorePackage.getRelationScoreId())) {
- * 修改积分包(二期)
- * @return 更新结果
- @SysLog("修改积分包(大包)")
- @PostMapping("/updateByIds")
- public R<?> updateByIds(@RequestBody WmScorePackage wmScorePackage) {
- log.info("修改积分包(大包)入参:{}", wmScorePackage);
- // 校验修改后的积分包值 不能小于 已下发的下级包积分包值
- List<WmScorePackage> subPackages = wmScorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
- .eq(WmScorePackage::getRelationScoreId, wmScorePackage.getId())
- .ne(WmScorePackage::getScorePackageStatus, ScorePackageStatusEnum.TERMINATED.val()));
- if (CollUtil.isNotEmpty(subPackages)) {
- int subPackgesScore = subPackages.stream().mapToInt(WmScorePackage::getScore).sum();
- if (wmScorePackage.getScore() < subPackgesScore) {
- return R.failed(String.format("该积分包已分配%s积分,修改后积分包值需大于该值", subPackgesScore));
- SysDept sysDeptDrugEntId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
- WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(sysDeptDrugEntId.getDeptId());
- if (null != wmDaDrugEnt) {
- wmScorePackage.setLevel2Id("");
- wmScorePackage.setLevel1Id(wmScorePackage.getAcceptSug());
- wmScorePackage.setLevel1Id("");
- wmScorePackage.setLevel2Id(wmScorePackage.getAcceptSug());
- if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug().equals(wmDaAgent.getId())) {
- if (SecurityUtils.getRoles().contains(3) || SecurityUtils.getRoles().contains(4)) {
- SysDept sysDeptRuleId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
- if (sysDeptRuleId.getLevel() == 2) {
- WmDaDrugEnt wmDaDrugEntRuleId = wmDaDrugEntService.selectByDeptId(sysDeptRuleId.getDeptId());
- if (wmScorePackage.getAcceptSug().equals(wmDaDrugEntRuleId.getId())) {
- wmScorePackage.setDrugEntId(wmDaDrugEntRuleId.getId());
- } else if (!wmScorePackage.getAcceptSug().equals(wmDaDrugEntRuleId.getId())) {
- wmScorePackage.setRuleId(wmDaDrugEntRuleId.getId() + wmScorePackage.getAcceptSug());
- } else if (sysDeptRuleId.getLevel() == 3) {
- if (sysDept.getLevel() == 3) {//判断是cso
- } else if (sysDept.getLevel() == 2) {//判断是药企
- queryWm.setScorePackageName(wmId.getScorePackageName());//获取当前包的scoreId
- WmScorePackage wmIds = wmScorePackageService.getById(wmScorePackage.getId());
- if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug()
- .equals(wmDaDrugEnt.getId())) {
- wmScorePackage.setKfpjf(wmScorePackage.getScore() - wmIds.getScore() + wmIds.getKfpjf());
- } else if (wmScorePackage.getAcceptSug().equals(wmDaAgent.getId())) {
- wmScorePackage.setDeptId(String.valueOf(wmDaAgent.getDeptId()));
- SysDept sysDept5 = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
- SysDept sysDept6 = sysDeptService.getById(Integer.valueOf(wmScorePackage.getDeptId()));
- if (sysDept5.getLevel() == 2 && sysDept6.getLevel() == 2 && wmScorePackage.getDeptId()
- .equals(String.valueOf(sysDept5.getDeptId()))) {
- wmScorePackage.setTypeid("0");
- } else if (sysDept5.getLevel() == 2) {
- } else if (sysDept5.getLevel() == 3 && sysDept6.getLevel() == 3 && wmScorePackage.getDeptId()
- } else if (sysDept5.getLevel() == 3) {
- if (wms.getId().equals(wmScorePackage.getRelationScoreId())) {//判断是否有scoreId与当前关联积分包匹配
- List<WmScorePackage> wmScorePackagess = wmScorePackageService.selectRelationScoreId(wmId.getId());
- if (wmScorePackagess.size() > 0) {
- for (WmScorePackage wmScorePackage13 : wmScorePackagess) {
- if (wmScorePackage.getRelationScoreId().equals(wmScorePackage13.getId())) {
- if (!wmScorePackage.getRelationScoreId().equals(wmId.getRelationScoreId())) {
- if (wmScorePackage.getScore() < wms.getKfpjf() + wmId.getScore()) {
- wms.setKfpjf(new Double(Math.ceil(wms.getKfpjf() - wmScorePackage.getScore())).intValue());
- } else if (wmScorePackage.getScore() > wms.getKfpjf() + wmId.getScore()) {
- return R.failed("可分配积分不足");
- } else if (wmScorePackage.getScore() < wms.getKfpjf() + wmId.getScore()) {
- wms.setKfpjf(new Double(Math.ceil(wms.getKfpjf() + wmId.getScore() - wmScorePackage.getScore()))
- .intValue());
- wmId.setScore(wmScorePackage.getScore());
- } else if (wms.getKfpjf() != null && !wmScorePackage.getRelationScoreId()
- .equals("") && wmScorePackage.getScore() > wms.getKfpjf() + wmId.getScore()) {
- } else if ("".equals(wmScorePackage.getRelationScoreId()) && wms.getId()
- .equals(wmId.getRelationScoreId())) {//判断关联积分包是否为无
- wms.setKfpjf(wmId.getScore() + wms.getKfpjf());
- } else if (wms.getId().equals(wmId.getRelationScoreId())) {
- wms.setKfpjf(new Double(Math.ceil(wms.getKfpjf() + wmId.getScore())).intValue());
- //判断是否进行中
- if (null != wmScorePackage1.getRelationScoreId() && wmScorePackage1.getRelationScoreId()
- .equals(wmId.getRelationScoreId())) {
- if (CollUtil.isNotEmpty(wmScorePackage.getWmScoreTaskTypeList())) {
- // 如果存在taskTypeId=39 则同时增加应收账款回款-A类、B类、C类任务类型(39/40/41)
- if (wmScorePackage.getWmScoreTaskTypeList().stream().anyMatch(wmTaskTypeTree -> "39".equals(wmTaskTypeTree.getTaskTypeId()))) {
- WmScoreTaskType addTaskType40 = new WmScoreTaskType();
- addTaskType40.setScoreId(wmScorePackage.getId());
- addTaskType40.setType("1");
- addTaskType40.setTaskTypeId("40");
- WmScoreTaskType addTaskType41 = new WmScoreTaskType();
- addTaskType41.setScoreId(wmScorePackage.getId());
- addTaskType41.setType("1");
- addTaskType41.setTaskTypeId("41");
- wmScorePackage.getWmScoreTaskTypeList().add(addTaskType40);
- wmScorePackage.getWmScoreTaskTypeList().add(addTaskType41);
- // 如果存在taskTypeId=42 则同时增加手术跟台-一级/手术跟台-二级/手术跟台-三级任务类型(42/43/44)
- if (wmScorePackage.getWmScoreTaskTypeList().stream().anyMatch(wmTaskTypeTree -> "42".equals(wmTaskTypeTree.getTaskTypeId()))) {
- WmScoreTaskType addTaskType43 = new WmScoreTaskType();
- addTaskType43.setScoreId(wmScorePackage.getId());
- addTaskType43.setType("1");
- addTaskType43.setTaskTypeId("43");
- WmScoreTaskType addTaskType44 = new WmScoreTaskType();
- addTaskType44.setScoreId(wmScorePackage.getId());
- addTaskType44.setType("1");
- addTaskType44.setTaskTypeId("44");
- wmScorePackage.getWmScoreTaskTypeList().add(addTaskType43);
- wmScorePackage.getWmScoreTaskTypeList().add(addTaskType44);
- // 如果存在taskTypeId=47 47,库存调研 48,竞品调研 49,培训 50,使用情况调查
- if (wmScorePackage.getWmScoreTaskTypeList().stream().anyMatch(wmTaskTypeTree -> "47".equals(wmTaskTypeTree.getTaskTypeId()))) {
- WmScoreTaskType addTaskTypeTree48 = new WmScoreTaskType();
- addTaskTypeTree48.setTaskTypeId("48");
- addTaskTypeTree48.setType("1");
- WmScoreTaskType addTaskTypeTree49 = new WmScoreTaskType();
- addTaskTypeTree49.setTaskTypeId("49");
- addTaskTypeTree49.setType("1");
- WmScoreTaskType addTaskTypeTree50 = new WmScoreTaskType();
- addTaskTypeTree50.setTaskTypeId("50");
- addTaskTypeTree50.setType("1");
- wmScorePackage.getWmScoreTaskTypeList().add(addTaskTypeTree48);
- wmScorePackage.getWmScoreTaskTypeList().add(addTaskTypeTree49);
- wmScorePackage.getWmScoreTaskTypeList().add(addTaskTypeTree50);
- List<WmScoreTaskType> wmScoreTaskTypess = new ArrayList<>();
- for (WmScoreTaskType wmScoreTaskTypes : wmScorePackage.getWmScoreTaskTypeList()) {
- //将积分表id和前端传的tasktypeId赋值给wmScoreTaskTypess
- if ("".equals(wmScorePackage.getRelationScoreId())) {
- wmScoreTaskType.setTaskTypeId(wmScoreTaskTypes.getTaskTypeId());
- wmScoreTaskTypess.add(wmScoreTaskType);
- wmScoreTaskTypeService.batchInsertType(wmScoreTaskTypess);
- // 查询原积分包值
- int oldPackageScore = wmScorePackageService.getById(wmScorePackage.getId()).getScore();
- // 屏蔽推广药品企业
- wmScorePackageService.updateById(wmScorePackage);
- Integer userId = SecurityUtils.getUser().getId();
- // 如果是通过积分充值的积分发的包,则回收积分
- SysDeptRechargeRecord rechargeRecord = sysDeptRechargeRecordMapper.selectOne(Wrappers.<SysDeptRechargeRecord>lambdaQuery()
- .eq(SysDeptRechargeRecord::getPackageId, wmScorePackage.getId())
- .in(SysDeptRechargeRecord::getType, RechargeRecordType.SEND_PACKAGE_DEPT, RechargeRecordType.SEND_PACKAGE_PERSONAL));
- boolean relatedScoreId = StrUtil.isNotBlank(wmScorePackage.getRelationScoreId()) && Integer.parseInt(wmScorePackage.getRelationScoreId()) > 0;
- // 积分值相比修改前的变动(相对于积分余额,增加则为负-消耗,减少则为正-回收)
- int changeScore = oldPackageScore - wmScorePackage.getScore();
- // 没有关联上级包的情况
- log.info("修改积分包,更新积分配置信息");
- SysDeptRecharge deptRecharge = sysDeptRechargeMapper.selectOne(Wrappers.<SysDeptRecharge>lambdaQuery()
- .eq(SysDeptRecharge::getDeptId, deptId));
- log.warn("未配置积分充值信息");
- throw new RuntimeException("积分余额:0。积分不足");
- int currentScore = deptRecharge.getScore() + changeScore;
- if (changeScore < 0 && Math.abs(changeScore) > limitScore) {
- log.warn("已分配积分不足,修改积分={},剩余积分={},透支额度={}",
- changeScore, deptRecharge.getScore(), deptRecharge.getOverdrawScore());
- throw new RuntimeException(String.format("积分余额:%s。积分不足", deptRecharge.getScore()));
- log.warn("更新大包积分充值信息失败");
- SysDeptRechargeRecord newRechargeRecord = new SysDeptRechargeRecord();
- newRechargeRecord.setRechargeId(deptRecharge.getId());
- newRechargeRecord.setChangeScore(changeScore);
- newRechargeRecord.setCurrentScore(currentScore);
- newRechargeRecord.setType(RechargeRecordType.RECOVERY);
- newRechargeRecord.setDeptId(deptRecharge.getDeptId());
- newRechargeRecord.setRelationDeptId(rechargeRecord != null ? rechargeRecord.getRelationDeptId() : null);
- newRechargeRecord.setPackageType(RechargeRecordPackageType.TO_ENTERPRISE);
- newRechargeRecord.setPackageId(wmScorePackage.getId());
- newRechargeRecord.setCreateUser(userId);
- sysDeptRechargeRecordMapper.insert(newRechargeRecord);
- // 关联了上级包的情况
- if (changeScore < 0) {
- // 变动积分后比原先多,则校验上级可分配积分值
- List<WmScorePackage> scorePackagekfpjf = wmScorePackageService.getScorePackagekfpjf(null, null, new String[]{"0", "1", "2"},
- if (Math.abs(changeScore) > kfpjf) {
- throw new RuntimeException("可分配积分值不足");
- * 查询关联积分包列表
- * @return 列表
- @GetMapping("/getRelationScoreList")
- public R<?> getRelationScoreList(WmScorePackage wmScorePackage) {
- return wmScorePackageService.getRelationScoreList(wmScorePackage);
- * 查询接单对象范围
- * @return {@link R}<{@link ?}>
- @GetMapping("/list-package-user-scope")
- public R<?> listPackageUserScope() {
- Integer sendDeptId = SecurityUtils.getUser().getDeptId();
- QueryWrapper<WmScorePackage> queryWrapper = Wrappers.<WmScorePackage>query()
- .select("package_user_scope")
- .and(wrapper ->
- wrapper.eq("package_type1", PackageTypeEnum.TYPE1_SCOTE_PACKAGE.val())
- .eq("package_type2", PackageTypeEnum.TYPE2_TASK_PACKAGE.val())
- .or(wrapper2 -> wrapper2.eq("package_type1", PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val())
- .eq("package_type2", PackageTypeEnum.TYPE2_SETTLE_PACKAGE.val())))
- .eq("send_package_dept_id", sendDeptId)
- .in("typeid", "3", "4", "5");
- List<WmScorePackage> packages = wmScorePackageService.list(queryWrapper);
- if (CollUtil.isEmpty(packages)) {
- List<String> pacakgeUserScores = packages.stream()
- .map(WmScorePackage::getPackageUserScope)
- .distinct().sorted().collect(Collectors.toList());
- List<Map<String, String>> result = new ArrayList<>();
- Map<String, String> val1 = new HashMap<>();
- val1.put("id", "1");
- val1.put("name", "仅内部可见");
- Map<String, String> val2 = new HashMap<>();
- val2.put("id", "2");
- val2.put("name", "全部可见");
- result.add(val1);
- result.add(val2);
- // 查询团队名称
- List<WmTeam> teams = wmTeamService.listByIds(pacakgeUserScores);
- List<Map<String, String>> teamNameList = teams.stream().map(t -> {
- Map<String, String> teamNameMap = new HashMap<>(2);
- teamNameMap.put("id", String.valueOf(t.getId()));
- teamNameMap.put("name", t.getName());
- return teamNameMap;
- result.addAll(teamNameList);
- return R.ok(result);
- * 分配积分列表查询--派工平台
- * @param acceptUser 接单对象,模糊查询
- @GetMapping("/getScorePackagePageForBC")
- public R<?> getScorePackagePageForBC(@RequestParam(value = "current") Integer current,
- Integer userId,
- @RequestParam(value = "packageType1") Integer packageType1,
- @RequestParam(value = "packageType2") Integer packageType2,
- @RequestParam(value = "scorePackageStatus", required = false) Integer scorePackageStatus,
- @RequestParam(value = "typeid", required = false) String typeId,
- @RequestParam(value = "monthStart", required = false) String monthStart,
- @RequestParam(value = "monthEnd", required = false) String monthEnd,
- @RequestParam(value = "acceptUser", required = false) String acceptUser,
- @RequestParam(value = "relationScoreId", required = false) String relationScoreId,
- @RequestParam(value = "toApproval", required = false) Boolean toApproval,
- @RequestParam(value = "packageUserScope", required = false) String packageUserScope,
- String sourceType
- ) {
- LocalDateTime start = null;
- LocalDateTime end = null;
- if (StrUtil.isNotEmpty(monthStart) && StrUtil.isNotEmpty(monthEnd)) {
- start = LocalDateTime.of(LocalDate.parse(monthStart + "-01", DatePattern.NORM_DATE_FORMATTER), LocalTime.MIN);
- LocalDate e = LocalDate.parse(monthEnd + "-01", DatePattern.NORM_DATE_FORMATTER);
- end = LocalDateTime.of(e.with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
- .eq("p.package_type1", packageType1)
- .eq("p.package_type2", packageType2)
- .eq(scorePackageStatus != null, "p.score_package_status", scorePackageStatus)
- .eq("p.send_package_dept_id", deptId)
- .between(start != null && end != null, "p.create_time", start, end);
- if (StrUtil.isNotBlank(scorePackageName)) {
- queryWrapper.and(wrapper -> wrapper.like("p.score_package_name", scorePackageName).or().like("p.pkg_sn", scorePackageName));
- if (StringUtil.isEmpty(typeId)) {
- queryWrapper.in("p.typeid", "3", "4", "5");
- List<String> split = StrUtil.split(typeId, StrUtil.COMMA);
- queryWrapper.in("p.typeid", split);
- // 接单对象范围筛选
- if (StrUtil.isNotBlank(packageUserScope)) {
- queryWrapper.eq("p.package_user_scope", packageUserScope);
- // 用于问问的系统来源
- if (StrUtil.isNotBlank(sourceType)) {
- queryWrapper.eq("p.source_type", sourceType);
- if (userId != null) {
- boolean onePersonScorePackageFlag = PackageTypeEnum.TYPE1_SCOTE_PACKAGE.val().equals(String.valueOf(packageType1))
- && PackageTypeEnum.TYPE2_TASK_PACKAGE.val().equals(String.valueOf(packageType2));
- boolean multiPersonScorePackageFlag = PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val().equals(String.valueOf(packageType1))
- && PackageTypeEnum.TYPE2_SETTLE_PACKAGE.val().equals(String.valueOf(packageType2));
- if (onePersonScorePackageFlag || multiPersonScorePackageFlag) {
- // 如果是个人承接-按积分值/多人承接-按积分值,判断当前用户是否配置了团队负责人
- List<WmTeam> teamList = wmTeamService.list(Wrappers.<WmTeam>lambdaQuery()
- .eq(WmTeam::getDeptId, deptId)
- .eq(WmTeam::getEnableFlag, EnableEnum.ENABLE.val())
- .eq(WmTeam::getDelFlag, DelEnum.NOT_DEL.val())
- .apply("FIND_IN_SET({0}, leader)", String.valueOf(userId)));
- if (CollectionUtil.isNotEmpty(teamList)) {
- // 如果配置了,则只查询所在团队下发的积分包
- List<String> teamIdList = teamList.stream().map(wmTeam -> String.valueOf(wmTeam.getId())).collect(Collectors.toList());
- queryWrapper.in("p.package_user_scope", teamIdList);
- Page<WmScorePackage> wmScorePackagePage = wmScorePackageMapper.listScorePackage(new Page<>(current, size),
- queryWrapper.orderByDesc("p.create_time"), acceptUser, relationScoreId, toApproval);
- List<WmScorePackage> pageRecords = wmScorePackagePage.getRecords();
- if (CollUtil.isNotEmpty(pageRecords)) {
- Set<String> packageIds = pageRecords.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
- // 任务统计
- List<WmTask> taskList = wmTaskMapper.selectList(Wrappers.<WmTask>lambdaQuery()
- .eq(WmTask::getRealFlag, "0")
- .eq(WmTask::getEnableFlag, "0")
- .eq(WmTask::getDelFlag, "0")
- .in(WmTask::getScorePackageId, packageIds)
- Map<String, List<WmTask>> taskGoupMap = taskList.stream().collect(Collectors.groupingBy(WmTask::getScorePackageId));
- // 领取积分包记录
- List<WmScorePackageStatus> scorePackageStatusList = wmScorePackageStatusService.list(Wrappers.<WmScorePackageStatus>lambdaQuery()
- .in(WmScorePackageStatus::getPackageId, packageIds)
- Map<String, List<WmScorePackageStatus>> packageStatusGroupMap = scorePackageStatusList.stream()
- .collect(Collectors.groupingBy(WmScorePackageStatus::getPackageId));
- //获取上级包
- Set<String> parentPackageIds = pageRecords.stream().map(WmScorePackage::getRelationScoreId).collect(Collectors.toSet());
- List<WmScorePackage> parentPackages = wmScorePackageMapper.selectList(Wrappers.<WmScorePackage>lambdaQuery()
- .in(WmScorePackage::getId, parentPackageIds));
- Map<String, WmScorePackage> parentPackageNameMap = parentPackages.stream()
- .collect(Collectors.toMap(WmScorePackage::getId, Function.identity()));
- // 类型标签
- List<SysDictItem> dictItems = sysDictItemService.list(Wrappers.<SysDictItem>lambdaQuery()
- .in(SysDictItem::getType, "package_type1", "package_type2"));
- Map<String, List<SysDictItem>> dictItemMap = dictItems.stream().collect(Collectors.groupingBy(SysDictItem::getType));
- List<SysDictItem> packageType1List = dictItemMap.get("package_type1");
- List<SysDictItem> packageType2List = dictItemMap.get("package_type2");
- //// 结算记录
- //List<WmScorePackageSettleNote> noteList = settleNoteMapper.selectList(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
- // .in(WmScorePackageSettleNote::getPackageId, packageIds));
- //Map<String, List<WmScorePackageSettleNote>> noteMap = noteList.stream()
- // .collect(Collectors.groupingBy(WmScorePackageSettleNote::getPackageId));
- // 有效任务类型
- List<WmScoreTaskType> taskTypeList = wmScoreTaskTypeMapper.getScoreTaskTypeByScoreId(String.join(",", packageIds));
- Map<String, List<WmScoreTaskType>> taskTypeMap = taskTypeList.stream().collect(Collectors.groupingBy(WmScoreTaskType::getScoreId));
- //for (int i = 0; i < pageRecords.size(); i++) {
- // WmScorePackage wmScorePackage = pageRecords.get(i);
- //
- // List<WmTask> tasks = taskGoupMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
- // List<WmScorePackageStatus> statuses = packageStatusGroupMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
- // List<WmScorePackageSettleNote> notes = noteMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
- // List<WmScoreTaskType> scoreTaskTypes = taskTypeMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
- // wmScorePackageService.buildScorePackageSync(wmScorePackage, packageType1, packageType2, tasks, statuses,
- // packageType1List, packageType2List, parentPackageNameMap, notes, scoreTaskTypes);
- //}
- return R.ok(wmScorePackagePage);
- @GetMapping("/getScorePackagePage")
- public R<?> getScorePackagePage(@RequestParam(value = "current") Integer current,
- return this.getScorePackagePageForBC(current, size, sendDeptId, userId, packageType1, packageType2, scorePackageName, scorePackageStatus,
- typeId, monthStart, monthEnd, acceptUser, relationScoreId, toApproval, packageUserScope, sourceType);
- * 积分包列表-其他(用于MAH结算:药企查询下级提交的) 用于BC
- @GetMapping("/getScorePackagePageForMahForBC")
- public R getScorePackagePageForMahForBC(@RequestParam(value = "current") Integer current,
- @RequestParam(value = "toApproval", required = false) Boolean toApproval
- .eq("p.mah_settle_dept_id", deptId)
- .in("p.mah_settle_step", UpmsType.MahSettleStep.BUSINESS.getType(), UpmsType.MahSettleStep.FINANCE.getType())
- queryWrapper.orderByDesc("p.settlement_date"), acceptUser, relationScoreId, toApproval);
- // 个人承接-其他 标记已读提醒
- wmBizReminderService.markRead(UpmsType.BizReminderType.ASSIGN_POINTS_OTHER_REMINDER, deptId);
- * 积分包列表-其他(用于MAH结算:药企查询下级提交的)
- @GetMapping("/getScorePackagePageForMah")
- public R getScorePackagePageForMah(@RequestParam(value = "current") Integer current,
- return this.getScorePackagePageForMahForBC(current, size, sendDeptId, packageType1, packageType2, scorePackageName,
- scorePackageStatus, typeId, monthStart, monthEnd, acceptUser, relationScoreId, toApproval);
- * 个人承接积分值导出-用于BC
- @ResponseExcel(name = "exportPackageSettle", sheet = "个人承接积分值导出")
- @SysLog("个人承接积分值导出-用于BC")
- @GetMapping("/export-score-package-for-bc")
- public List<WmScorePackageExcelModel> exportScorePackageForBC(
- @RequestParam(value = "packageUserScope", required = false) String packageUserScope
- long startMillis = System.currentTimeMillis();
- List<WmScorePackage> scorePackageList = wmScorePackageMapper.listScorePackage(
- log.info("积分包列表-不分页sql耗时:{}", System.currentTimeMillis() - startMillis);
- if (CollUtil.isEmpty(scorePackageList)) {
- return Collections.emptyList();
- long buildStartMillis = System.currentTimeMillis();
- Set<String> packageIds = scorePackageList.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
- Set<String> parentPackageIds = scorePackageList.stream().map(WmScorePackage::getRelationScoreId).collect(Collectors.toSet());
- List<WmScorePackageExcelModel> excelModelList = new ArrayList<>(scorePackageList.size());
- for (int i = 0; i < scorePackageList.size(); i++) {
- WmScorePackage wmScorePackage = scorePackageList.get(i);
- log.info("====> 积分包SN:{}", wmScorePackage.getPackageSn());
- List<WmTask> tasks = taskGoupMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
- List<WmScorePackageStatus> statuses = packageStatusGroupMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
- //List<WmScorePackageSettleNote> notes = noteMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
- //List<WmScoreTaskType> scoreTaskTypes = taskTypeMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
- //wmScorePackageService.buildScorePackageSync(wmScorePackage, packageType1, packageType2, tasks, statuses,
- WmScorePackageExcelModel excelModel = BeanUtil.copyProperties(wmScorePackage, WmScorePackageExcelModel.class);
- if (StrUtil.isNotBlank(wmScorePackage.getScorePackageStatus())) {
- excelModel.setScorePackageStatus(Objects.requireNonNull(ScorePackageStatusEnum.getByVal(wmScorePackage.getScorePackageStatus())).getDesc());
- if (CollUtil.isNotEmpty(wmScorePackage.getUserList())) {
- excelModel.setUserNames(String.join(",", wmScorePackage.getUserList()));
- String typeid = wmScorePackage.getTypeid();
- if (StrUtil.isNotBlank(typeid)) {
- excelModel.setTypeidName("3".equals(typeid) ? "全职学术信息沟通专员" :
- "4".equals(typeid) ? "兼职学术信息沟通专员" : "5".equals(typeid) ? "招商经理" : typeid);
- excelModel.setNumber(String.valueOf(i+1));
- if (wmScorePackage.getYshtt() != null) {
- excelModel.setFinishRate(String.valueOf(wmScorePackage.getYshtt()));
- excelModel.setPayScore(wmScorePackage.getShtg());
- if (wmScorePackage.getShtgtt() != null) {
- excelModel.setPayRate(String.valueOf(wmScorePackage.getShtgtt()));
- excelModelList.add(excelModel);
- log.info("build积分包耗时:{}", System.currentTimeMillis() - buildStartMillis);
- return excelModelList;
- * 个人承接积分值导出
- @SysLog("个人承接积分值导出")
- @GetMapping("/export-score-package")
- public List<WmScorePackageExcelModel> exportScorePackage(
- return this.exportScorePackageForBC(packageType1, packageType2, sendDeptId, userId, scorePackageName,
- scorePackageStatus, typeId, monthStart, monthEnd, acceptUser, relationScoreId, toApproval, packageUserScope);
- * 个人承接积分值-其他导出-用于BC
- @ResponseExcel(name = "exportPackageSettle", sheet = "个人承接积分值-其他导出")
- @SysLog("个人承接积分值-其他导出-用于BC")
- @GetMapping("/export-score-package-mah-for-bc")
- public List<WmScorePackageExcelModel> exportPackageSettleForMahForBC(
- log.info("MAH积分包列表sql耗时:{}", System.currentTimeMillis() - startMillis);
- // 结算记录
- * 个人承接积分值-其他导出
- @SysLog("个人承接积分值-其他导出")
- @GetMapping("/export-score-package-mah")
- public List<WmScorePackageExcelModel> exportPackageSettleForMah(
- return this.exportPackageSettleForMahForBC(packageType1, packageType2, sendDeptId, scorePackageName, scorePackageStatus,
- typeId, monthStart, monthEnd, acceptUser, relationScoreId, toApproval);
- * 积分包列表(结算包管理列表、无团队限制)
- * @param packageType1 多个逗号分隔
- @GetMapping("/page-settle-package")
- public R<?> pageSettlePackage(@RequestParam(value = "current") Integer current,
- @RequestParam(value = "packageType1") String packageType1,
- @RequestParam(value = "monthEnd", required = false) String monthEnd
- LambdaQueryWrapper<WmScorePackage> queryWrapper = Wrappers.<WmScorePackage>lambdaQuery()
- .eq(WmScorePackage::getPackageType2, packageType2)
- .like(StrUtil.isNotEmpty(scorePackageName), WmScorePackage::getScorePackageName, scorePackageName)
- .eq(scorePackageStatus != null, WmScorePackage::getScorePackageStatus, scorePackageStatus)
- .eq(WmScorePackage::getSendPackageDeptId, sendDeptId)
- .between(start != null && end != null, WmScorePackage::getCreateTime, start, end);
- List<String> packageType1List = StrUtil.split(packageType1, StrUtil.COMMA);
- if (StrUtil.contains(packageType1, StrUtil.COMMA)) {
- queryWrapper.in(WmScorePackage::getPackageType1, packageType1List);
- queryWrapper.eq(WmScorePackage::getPackageType1, packageType1);
- queryWrapper.in(WmScorePackage::getTypeid, "3", "4");
- queryWrapper.in(WmScorePackage::getTypeid, split);
- queryWrapper.ne(WmScorePackage::getLocation, SubjectLocation.MAH_SETTLE);
- Page<WmScorePackage> wmScorePackagePage = wmScorePackageMapper.selectPage(new Page<>(current, size), queryWrapper
- .orderByDesc(WmScorePackage::getCreateTime));
+ List<WmScorePackage> wmList = page.getRecords();
+ List<Future<WmScorePackage>> futureList = new ArrayList<>(wmList.size());
+ for (WmScorePackage wmS : wmList) {
+ Future<WmScorePackage> future = wmScorePackageService.finishRate(wmS);
+ futureList.add(future);
+ List<WmScorePackage> finalRecords = new ArrayList<>(wmList.size());
+ try {
+ for (Future<WmScorePackage> future : futureList) {
+ WmScorePackage sPackage = future.get();
+ if (sPackage.getP2pAmount() != null) {
+ sPackage.setP2pDraft(false);
+ String s = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:amount:%s", sPackage.getId()));
+ String s1 = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:service-amount:%s", sPackage.getId()));
+ String desc = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:desc:%s", sPackage.getId()));
+ sPackage.setP2pAmount(new BigDecimal(s));
+ sPackage.setP2pServiceAmount(new BigDecimal(s1));
+ sPackage.setDescription(desc);
+ sPackage.setP2pDraft(true);
+ finalRecords.add(sPackage);
+ } catch (ExecutionException | InterruptedException e) {
+ log.error("获取分页信息失败", e);
+ return R.failed("获取分页信息失败");
+ @GetMapping("/getWmScorePackageTask")
+ public R<?> getWmScorePackageTask(Page<?> page, WmScorePackage wmScorePackage) {
+ if (!SecurityUtils.getRoles().contains(2) && !SecurityUtils.getRoles().contains(1)) {
+ if (SecurityUtils.getRoles().contains(4)) {
+ SysDept sysDept1 = new SysDept();
+ sysDept1.setDeptId(SecurityUtils.getUser().getDeptId());
+ SysDept sysDept = sysDeptService.selectDeptId(sysDept1);
+ if (sysDept.getLevel() == 3) {
+ listExt = wmScorePackageService.listWmScorePackageAndTaskExt(wmScorePackage);
+ } else if (sysDept.getLevel() == 4) {
+ wmScorePackage.setLevel2Id(sysDept.getLevel3Id());
+ listExt = wmScorePackageService.listWmScorePackageAndTaskExt2(wmScorePackage);
+ } else if (sysDept.getLevel() == 2) {
+ if (SecurityUtils.getRoles().contains(2) || SecurityUtils.getRoles().contains(1)) {
+ int ytj = 0;
+ int ywc = 0;
+ int dqf = 0;
+ ywc += wmS.getScore();
+ if (null != wmS.getYsh()) {
+ //TODO
+ //dqf+=wmS.getYsh();
+ if (wmS.getYtj() > wmS.getScore()) {
+ dqf += wmS.getScore();
+ dqf += wmS.getYtj();
+ if (null != wmS.getYtj()) {
+ ytj += wmS.getScore();
+ ytj += wmS.getYtj();
+ Map<String, Object> map = new HashMap<>();
+ map.put("ytj", ytj);
+ map.put("ywc", ywc);
+ map.put("dqf", dqf);
+ return R.ok(map);
+ @GetMapping("/getListRule")
+ public R<?> getListRule(Page<WmScorePackage> page, WmScorePackage wmScorePackage) {
+ if (null != sysDept) {
+ WmDaAgent wmDaAgent = wmDaAgentService.getById(sysDept.getLevel2Id());
+ wmScorePackage.setLevel1Id(wmDaAgent.getId());
+ List<Integer> list = new ArrayList<>();
+ list.add(2);
+ list.add(3);
+ list.add(4);
+ wmScorePackage.setSendPackageDeptId(SecurityUtils.getUser().getDeptId() + "");
+ Page<WmScorePackage> pageAnswer = wmScorePackageService.page(page, Wrappers.query(wmScorePackage)
+ .lambda()
+ .in(WmScorePackage::getTypeid, list));
+ List<WmScorePackage> listExt = wmScorePackageService.listWmScorePackageAndTaskLevel3(wmScorePackage);
+ List<WmScorePackage> listWmScorePackage = pageAnswer.getRecords();
+ listWmScorePackage) {
+ wmS.setYwctt(0);
+ wmS.setYwctt(100);
+ wmS.setYwctt(new Double(Math.ceil(100.0 * ext.getYtj() / ext.getScore())).intValue());
+ pageAnswer.setRecords(listWmScorePackage);
+ if (4 == sysDept.getLevel()) {
+ WmDaAgent wmDaAgent = wmDaAgentService.getById(sysDept.getLevel3Id());
+ wmScorePackage.setLevel2Id(wmDaAgent.getId());
+ List<WmScorePackage> listExt = wmScorePackageService.listWmScorePackageAndTaskLevel1(wmScorePackage);
+ wmS.setYwctt(ext.getDsh());
+ if (!(ext.getYtj() > ext.getScore())) {
+ sysDept.setDeptId(sysDept.getDeptId());
+ return R.ok(wmScorePackageService.page(page, Wrappers.query(wmScorePackage)));
+ @GetMapping("/getTotalData")
+ public R<?> getTotalData(WmScorePackage wmScorePackage) {
+ List<WmScorePackage> list = wmScorePackageService.list(Wrappers.query(wmScorePackage).lambda());
+ List<WmScorePackage> newList = new ArrayList<>();
+ for (WmScorePackage wmS : list) {
+ if ("2".equals(wmS.getTypeid()) || "3".equals(wmS.getTypeid()) || "4".equals(wmS.getTypeid())) {
+ if (SecurityUtils.getUser().getDeptId().toString().equals(wmS.getDeptId())) {
+ newList.add(wmS);
+ return R.ok(newList);
+ return R.ok(wmScorePackageService.list(Wrappers.query(wmScorePackage)
+ .in(WmScorePackage::getTypeid, list)));
+ return R.ok(wmScorePackageService.pageList(Wrappers.query(wmScorePackage)));
+ * 通过id查询积分包
+ * @param id id
+ @GetMapping("/{id}")
+ public R<?> getById(@PathVariable("id") Integer id) {
+ return R.ok(wmScorePackageService.getById(id));
+ * 新增积分包
+ @SysLog("新增积分包")
+ @PostMapping
+ public R<?> save(@RequestBody WmScorePackage wmScorePackage) {
+ if (wmScorePackage.getScore() <= 0) {
+ return R.failed("积分包分值必须大于0");
+ if (null != wmScorePackage.getScoreId() && !"".equals(wmScorePackage.getScoreId())) {
+ WmScorePackage wmScorePackage1 = new WmScorePackage();
+ wmScorePackage1.setDelFlag("0");
+ wmScorePackage1.setScoreId(wmScorePackage.getScoreId());
+ List<WmScorePackage> wmScorePackageList = wmScorePackageService.list(Wrappers.query(wmScorePackage1));
+ if (wmScorePackageList.size() > 0) {
+ return R.failed("积分包ID已存在");
+ wmScorePackage.setIsConduct("0");
+ if ("1".equals(wmScorePackage.getTypeid())) {
+ WmDaAgent wmDaAgent = wmDaAgentService.getById(wmScorePackage.getLevel1Id());
+ wmScorePackage.setDeptId(wmDaAgent.getDeptId() + "");
+ } else if ("2".equals(wmScorePackage.getTypeid())) {
+ if (null != wmScorePackage.getLevel2Id()) {
+ WmDaAgent wmDaAgent = wmDaAgentService.getById(wmScorePackage.getLevel2Id());
+ WmDaAgent wmDaAgent1 = wmDaAgentService.getById(sysDept.getLevel2Id());
+ wmScorePackage.setLevel1Id(wmDaAgent1.getId());
+ } else if ("3".equals(wmScorePackage.getTypeid())) {
+ if (null != wmScorePackage.getXxdbId()) {
+ SysUser sysUser = sysUserService.getById(wmScorePackage.getXxdbId());
+ if (null != sysUser.getDeptId()) {
+ wmScorePackage.setDeptId(sysUser.getDeptId() + "");
+ sysDept1.setDeptId(sysUser.getDeptId());
+ wmScorePackage.setLevel1Id(sysDept.getLevel2Id() == null || sysDept.getLevel2Id() == 0 ? null : sysDept
+ .getLevel2Id());
+ wmScorePackage.setLevel2Id(sysDept.getLevel3Id() == null || sysDept.getLevel3Id() == 0 ? null : sysDept
+ .getLevel3Id());
+ wmScorePackage.setPackageStatus("2");
+ } else if ("4".equals(wmScorePackage.getTypeid())) {
+ wmScorePackage.setLevel1Id(sysDept.getLevel2Id() == null || sysDept.getLevel2Id() == 0 ? null : sysDept.getLevel2Id());
+ wmScorePackage.setLevel2Id(sysDept.getLevel3Id() == null || sysDept.getLevel3Id() == 0 ? null : sysDept.getLevel3Id());
+ if (null != wmScorePackage.getScoreName() && !"".equals(wmScorePackage.getScoreName())) {
+ wmScorePackage1.setScoreName(wmScorePackage.getScoreName());
+ wmScorePackage1.setDeptId(wmScorePackage.getDeptId());
+ return R.failed("积分包名称已存在");
+ wmScorePackage.setCreateTime(LocalDateTime.now());
+ wmScorePackage.setPackageFinishStatus("0");
+ wmScorePackage.setPackageAuditStatus("0");
+ boolean isAnswer = wmScorePackageService.save(wmScorePackage);
+ if (isAnswer) {
+ WmScorePackage queryWm = new WmScorePackage();
+ queryWm.setAgentTypeId("1");
+ queryWm.setTypeid("1");
+ queryWm.setDrugEntId(SecurityUtils.getUser().getDrugEntId());
+ queryWm.setLevel1Id(sysDept.getLevel2Id());
+ queryWm.setTaskRuleId(wmScorePackage.getTaskRuleId());
+ queryWm.setDeptId(SecurityUtils.getUser().getDeptId() + "");
+ queryWm.setAgentTypeId("2");
+ queryWm.setTypeid("2");
+ queryWm.setId("-1");
+ List<WmScorePackage> wmScorePackageList = wmScorePackageService.list(Wrappers.query(queryWm));
+ for (WmScorePackage wms : wmScorePackageList) {
+ wms.setIsConduct("1");
+ wmScorePackageService.updateBatchById(wmScorePackageList);
+ * 修改积分包
+ @SysLog("修改积分包")
+ @PutMapping
+ public R<?> updateById(@RequestBody WmScorePackage wmScorePackage) {
+ WmScorePackage oldData = wmScorePackageService.getById(wmScorePackage.getId());
+ if (StringUtils.isNotEmpty(wmScorePackage.getScorePackageName())
+ && !oldData.getScorePackageName().equals(wmScorePackage.getScorePackageName())) {
+ wmScorePackage1.setScorePackageName(wmScorePackage.getScorePackageName());
+ List<WmScorePackage> wmScorePackageList = wmScorePackageService.listWmScorePackages(wmScorePackage1);
+ if (wmScorePackageList.size() > 1) {
+ if ("4".equals(wmScorePackage.getPackageStatus())) {
+ WmTask wmTask = new WmTask();
+ wmTask.setScorePackageId(wmScorePackage.getId());
+ List<WmTask> wmTaskList = wmTaskService.list(Wrappers.query(wmTask));
+ for (WmTask wmt : wmTaskList) {
+ wmt.setEnableFlag("1");
+ wmTaskService.updateBatchById(wmTaskList);
+ return R.ok(wmScorePackageService.updateById(wmScorePackage));
+ * @param wmScorePackageVO 积分包
+ @SysLog("修改积分包折扣和实际结算金额")
+ @PostMapping(value = "/updateByIdWithType")
+ public R<?> updateByIdWithType(@RequestBody @Valid WmScorePackageVO wmScorePackageVO) {
+ return wmScorePackageService.updateByIdWithType(wmScorePackageVO);
+ * 通过id删除积分包
+ @SysLog("通过id删除积分包")
+ @DeleteMapping("/{id}")
+ public R<?> removeById(@PathVariable Integer id) {
+ return R.ok(wmScorePackageService.removeById(id));
+ * 获取药企列表
+ * @return 角色列表
+ @GetMapping("/list")
+ public R<?> listWmScorePackage(WmScorePackage wmScorePackage) {
+ List<WmScorePackage> list = wmScorePackageService.list(Wrappers.query(wmScorePackage));
+ List<Map<String, String>> answerList = new ArrayList<>();
+ if (list.size() > 0) {
+ for (WmScorePackage sysUser : list) {
+ Map<String, String> map = new HashMap<>();
+ map.put("id", sysUser.getId() + "");
+ if (null == sysUser.getScoreId() || "".equals(sysUser.getScoreId().trim())) {
+ map.put("scoreId", "-");
+ map.put("scoreId", sysUser.getScoreId());
+ if (null == sysUser.getScoreName() || "".equals(sysUser.getScoreName().trim())) {
+ map.put("scoreName", "-");
+ map.put("scoreName", sysUser.getScoreName() + "");
+ answerList.add(map);
+ return R.ok(answerList);
+ @GetMapping("/listWmScorePackageAndTask")
+ public R<?> listWmScorePackageAndTask(WmScorePackage wmScorePackage) {
+ return R.ok(wmScorePackageService.listWmScorePackageAndTask(wmScorePackage));
+ @GetMapping("/packageIsZZ")
+ public R<?> packageIsZZ(WmScorePackage wmScorePackage) {
+ @GetMapping("/getPlatTotalData")
+ public R<?> getPlatTotalData(Page<?> page, WmScorePackage wmScorePackage, String[] dates) {
+ if (null != dates && dates.length > 0) {
+ // 将时间戳转为当前时间
+ wmScorePackage.setDelFlag(dates[0].substring(0, 10));
+ wmScorePackage.setEnableFlag(dates[1].substring(0, 10));
+ return R.ok(wmScorePackageService.getPlatTotalData(page, wmScorePackage));
+ @GetMapping("/listNoDel")
+ public R<?> listWmScorePackageNoDel(WmScorePackage wmScorePackage) {
+ if (CollectionUtils.isNotEmpty(list)) {
+ for (WmScorePackage scorePackage : list) {
+ map.put("id", scorePackage.getId() + "");
+ if (StringUtils.isEmpty(scorePackage.getScoreId())) {
+ map.put("scoreId", scorePackage.getScoreId());
+ if (StringUtils.isEmpty(scorePackage.getScorePackageName())) {
+ map.put("scoreName", scorePackage.getScorePackageName());
+ * @return 积分包列表
+ @GetMapping("/selectLists")
+ public R<?> selectLists(WmScorePackage wmScorePackage) {
+ wmScorePackage.getRelationScoreId();
+ return R.ok(wmScorePackageService.selectLists(wmScorePackage));
+ * 查看分配积分信息 二期 业务平台
+ @PostMapping("/selectWmScorePackage")
+ public R<?> selectWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
+ return R.ok(wmScorePackageService.selectWmScorePackage(wmScorePackage));
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.failed();
+ * 获取企业大包详细信息
+ * @param id 积分包id
+ * @return {@link R}<{@link ?}> 积分包详情
+ @GetMapping("/get-big-package-detail")
+ public R<?> getBigPackageDetail(String id) {
+ WmScorePackage wmScorePackage = wmScorePackageMapper.selectById(id);
+ // 关联积分包
+ if (StrUtil.isBlank(wmScorePackage.getRelationScoreId())) {
+ wmScorePackage.setRelationScoreId("-1");
+ wmScorePackage.setRelationScoreName("无");
+ WmScorePackage relationPackage = wmScorePackageMapper.selectById(wmScorePackage.getRelationScoreId());
+ if (relationPackage != null) {
+ wmScorePackage.setRelationScoreName(relationPackage.getScorePackageName());
+ // 关联服务企业
+ if (StrUtil.isNotBlank(wmScorePackage.getRelatedService())) {
+ SysDept serviceDept = sysDeptService.getById(wmScorePackage.getRelatedService());
+ if (serviceDept != null) {
+ wmScorePackage.setRelatedServiceName(serviceDept.getName());
+ // 接包对象
+ if (StrUtil.isNotBlank(wmScorePackage.getAcceptSug())) {
+ // 此处暂认为drugEnt和agent不会出现相同的id
+ WmDaAgent daAgent = wmDaAgentMapper.selectById(wmScorePackage.getAcceptSug());
+ if (daAgent == null) {
+ WmDaDrugEnt daDrugEnt = wmDaDrugEntMapper.selectById(wmScorePackage.getAcceptSug());
+ if (daDrugEnt != null) {
+ wmScorePackage.setAcceptSug(daDrugEnt.getEntname());
+ wmScorePackage.setAcceptSugName(daAgent.getGsmc());
+ // 可分配积分值
+ List<WmScorePackage> scorePackagekfpjf =
+ wmScorePackageService.getScorePackagekfpjf(
+ null,
+ new String[]{"0", "1", "2"},
+ new String[]{id});
+ if (CollUtil.isNotEmpty(scorePackagekfpjf)) {
+ wmScorePackage.setKfpjf(scorePackagekfpjf.get(0).getKfpjf());
+ // 推广药品
+ if (ArrayUtil.isNotEmpty(wmScorePackage.getDrugtable())) {
+ List<WmDaDrugEntDrugtable> drugtables = wmDaDrugEntDrugtableService.listByIds(Stream.of(wmScorePackage.getDrugtable()).collect(Collectors.toSet()));
+ if (CollUtil.isNotEmpty(drugtables)) {
+ String[] drugtableNames = drugtables.stream().map(WmDaDrugEntDrugtable::getDrugname).toArray(String[]::new);
+ wmScorePackage.setDrugtableName(drugtableNames);
+ // 积分包关联的有效任务类型
+ WmScoreTaskType wmScoreTaskType = new WmScoreTaskType();
+ wmScoreTaskType.setScoreId("-1".equals(wmScorePackage.getRelationScoreId()) ? wmScorePackage.getId() : wmScorePackage.getRelationScoreId());
+ List<WmScoreTaskType> taskTypeList = wmScoreTaskTypeMapper.listWmScoreTaskType(wmScoreTaskType);
+ Set<String> taskTypeSet = taskTypeList.stream().map(WmScoreTaskType::getTaskTypeId).collect(Collectors.toSet());
+ wmScorePackage.setTaskTypeSet(taskTypeSet);
+ // 查询关联的试卷
+ List<WmPkgQuizRelation> quizRelations = pkgQuizRelationService.listQuizRelationsByPkgIds(Collections.singletonList(Integer.parseInt(id)));
+ if (CollUtil.isNotEmpty(quizRelations)) {
+ List<Integer> quizIds = quizRelations.stream().map(WmPkgQuizRelation::getQuizId).collect(Collectors.toList());
+ List<Integer> relIds = quizRelations.stream().map(WmPkgQuizRelation::getRelationId).collect(Collectors.toList());
+ wmScorePackage.setQuizIds(quizIds);
+ wmScorePackage.setQuizRelationIds(relIds);
+ wmScorePackage.setQuizNames(quizRelations.stream().map(WmPkgQuizRelation::getTitle).collect(Collectors.toList()));
+ wmScorePackage.setQuizRelations(quizRelations);
+ return R.ok(wmScorePackage);
+ * BC-企业承接任务
+ * @param current 当前页
+ * @param size 每页大小
+ * @param scorePackageName 积分包名称
+ * @param acceptSug 接包对象
+ * @param allocationDate 分配日期
+ * @param endLabelDate 结束标签日期
+ * @return {@link R}<{@link ?}> 结果
+ @GetMapping("/selectWmScorePackageListsForBC")
+ public R<?> selectWmScorePackageListForBC(@RequestParam(value = "current") Integer current,
+ @RequestParam(value = "size") Integer size,
+ @RequestParam(value = "deptId") Integer deptId,
+ @RequestParam(value = "scorePackageName", required = false) String scorePackageName,
+ @RequestParam(value = "acceptSug", required = false) String acceptSug,
+ @RequestParam(value = "allocationDate", required = false) LocalDate allocationDate,
+ @RequestParam(value = "endLabelDate", required = false) LocalDate endLabelDate) {
+ Page<WmScorePackage> pageAnswer = wmScorePackageService.selectWmScorePackageLists(new Page<>(current, size), deptId,
+ scorePackageName, acceptSug, allocationDate, endLabelDate);
+ //根据积分包id查询计算完成积分值 已付积分值
+ List<WmScorePackage> wmList = pageAnswer.getRecords();
+ WmScorePackage wmScorePackage = future.get();
+ if (wmScorePackage.getP2pAmount() != null) {
+ wmScorePackage.setP2pDraft(false);
+ String s = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:amount:%s", wmScorePackage.getId()));
+ String s1 = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:service-amount:%s", wmScorePackage.getId()));
+ String desc = redisTemplate.opsForValue().get(String.format("scorepackage:p2p:desc:%s", wmScorePackage.getId()));
+ wmScorePackage.setP2pAmount(new BigDecimal(s));
+ wmScorePackage.setP2pServiceAmount(new BigDecimal(s1));
+ wmScorePackage.setDescription(desc);
+ wmScorePackage.setP2pDraft(true);
+ finalRecords.add(wmScorePackage);
+ pageAnswer.setRecords(finalRecords);
+ * 分页查询积分管理信息 二期 业务平台
+ @GetMapping("/selectWmScorePackageLists")
+ public R<?> selectWmScorePackageList(@RequestParam(value = "current") Integer current,
+ Integer deptId = SecurityUtils.getUser().getDeptId();
+ return this.selectWmScorePackageListForBC(current, size, deptId, scorePackageName, acceptSug, allocationDate, endLabelDate);
+ * 获取关联积分包名称 二期 业务平台
+ @GetMapping("/lists")
+ public R<?> listWmScorePackages(WmScorePackage wmScorePackage) {
+ // 当前企业deptId
+ String deptId = wmScorePackage.getDeptId();
+ if (StrUtil.isBlank(deptId)) {
+ deptId = String.valueOf(SecurityUtils.getUser().getDeptId());
+ wmScorePackage.setDeptId(deptId);
+ SysDept dept = sysDeptService.getById(deptId);
+ List<Map<String, Object>> answerList = new ArrayList<>();
+ if (dept.getLevel() == 3) {
+ for (WmScorePackage wmScorePackage1 : list) {
+ Map<String, Object> map1 = new HashMap<>();
+ map1.put("relationScoreId", wmScorePackage1.getId());
+ map1.put("scorePackageName", wmScorePackage1.getScorePackageName());
+ answerList.add(map1);
+ * 根据上级药企获取关联积分包 二期 业务平台(企业承接新增积分包的)
+ @GetMapping("/selectRelationScoreId")
+ public R<?> selectRelationScoreId(WmScorePackage wmScorePackage) {
+ SysDept selfId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
+ SysDept sysDept = sysDeptService.getById(wmScorePackage.getRelatedService());
+ //获取关联积分包
+ if (sysDept.getLevel() == 2 && selfId.getLevel() != 2) {
+ wmScorePackage.setSendPackageDeptId(wmScorePackage.getRelatedService());
+ List<WmScorePackage> list = wmScorePackageService.selectByReRelatedService(wmScorePackage);
+ if (wmScorePackage1.getKfpjf() == null || wmScorePackage1.getKfpjf() <= 0) {
+ // 过滤掉可分配积分值为0的积分包
+ continue;
+ map1.put("relationScoreName", wmScorePackage1.getScorePackageName());
+ map1.put("drugProducerList", wmScorePackage1.getDrugProducerList());
+ map1.put("drugtable", wmScorePackage1.getDrugtable());
+ map1.put("id", wmScorePackage1.getId());
+ } else if (SecurityUtils.getRoles().contains(3)) {
+ Map<String, Object> map2 = new HashMap<>();
+ map2.put("id", "-1");
+ map2.put("relationScoreName", "无");
+ answerList.add(map2);
+ } else if (sysDept.getLevel() == 3) {
+ wmScorePackage.setDeptId(wmScorePackage.getRelatedService());
+ Map<String, Object> map3 = new HashMap<>();
+ map3.put("id", wmScorePackage1.getId());
+ map3.put("drugProducerList", wmScorePackage1.getDrugProducerList());
+ map3.put("drugtable", wmScorePackage1.getDrugtable());
+ map3.put("relationScoreName", wmScorePackage1.getScorePackageName());
+ answerList.add(map3);
+ Map<String, Object> map4 = new HashMap<>();
+ map4.put("id", "-1");
+ map4.put("relationScoreName", "无");
+ answerList.add(map4);
+ } else if (selfId.getLevel() == 2) {
+ Map<String, Object> map5 = new HashMap<>();
+ map5.put("id", "-1");
+ map5.put("relationScoreName", "无");
+ answerList.add(map5);
+ * 获取可分配积分 二期 业务平台
+ @GetMapping("/selectKfpjf")
+ public R<?> selectKfpjf(WmScorePackage wmScorePackage) {
+ SysDept wmId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
+ WmDaAgent anId = wmDaAgentService.selectByDeptId(wmId.getDeptId());
+ //获取接包对象和可分配积分
+ List wmDaDrugEnts = new ArrayList();
+ if ("-1".equals(wmScorePackage.getId()) && wmId.getLevel() == 3) {
+ map2.put("kfpjf", "");
+ List<WmDaAgent> list = wmDaAgentService.listAgentByDeptRelation(anId.getDeptId());
+ for (int i = 0; i < list.size(); i++) {
+ if (Integer.parseInt(list.get(i).getEnableFlag()) == 0) {
+ wmDaDrugEnts.add(list.get(i));
+ } else if ("-1".equals(wmScorePackage.getId()) && wmId.getDeptId()
+ .equals(SecurityUtils.getUser().getDeptId())) {
+ WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(wmId.getDeptId());
+ List<WmDaAgent> list = wmDaAgentService.selectWmDaAgentByDeptId(wmDaDrugEnt.getDeptId().toString());
+ List<WmDaAgent> list = wmDaAgentService.selectWmDaAgentByRelationIds(wmId.getDeptId());
+ map2.put("acceptSug", wmDaDrugEnts);
+ if (SecurityUtils.getUser().getDeptId().equals(Integer.valueOf(wmScorePackage1.getDeptId()))) {
+ wmScoreTaskType.setScoreId(wmScorePackage1.getId());
+ wmScorePackage1.setWmScoreTaskTypeList(wmScoreTaskTypeService.listWmScoreTaskTypes(wmScoreTaskType));
+ map2.put("kfpjf", wmScorePackage1.getKfpjf());
+ //获取数据
+ if (wmId.getLevel() == 3) {
+ Set<String> taskTypeSet = taskTypeList.stream()
+ .map(WmScoreTaskType::getTaskTypeId)
+ .collect(Collectors.toSet());
+ map1.put("scoreId", wmScorePackage1.getScoreId());
+ map1.put("kfpjf", wmScorePackage1.getKfpjf());
+ map1.put("belongDate", wmScorePackage1.getBelongDate());
+ map1.put("packsgeType1", wmScorePackage1.getPackageType1());
+ map1.put("wmScoreTaskTypeList", wmScorePackage.getTaskTypeSet());
+ map1.put("wmScoreTaskTypeList1", wmScorePackage1.getWmScoreTaskTypeList());
+ stringList.add(wmScorePackage1.getScoreId());
+ * 新增积分包(大包)
+ * <p>
+ * 满足以下任一条件,则可以发包
+ * 1.存在积分充值配置,并且 发包积分 < 积分充值分配的积分
+ * 2.关联了上级积分包
+ * @param wmScorePackage 积分包信息
+ * @return 新增结果
+ @SysLog("新增积分包(大包)")
+ @PostMapping("/saves")
+ public R<?> saves(@RequestBody WmScorePackage wmScorePackage) {
+ log.info("新增积分包(大包)入参:{}", wmScorePackage);
+ HnqzUser operator = SecurityUtils.getUser();
+ LocalDateTime now = LocalDateTime.now();
+ List<Integer> roles = SecurityUtils.getRoles();
+ Integer deptId = operator.getDeptId();
+ Integer userId = operator.getId();
+ String relPkgId = wmScorePackage.getRelationScoreId();
+ boolean relatedScoreId = StrUtil.isNotBlank(relPkgId) && Integer.parseInt(relPkgId) > 0;
+ SysDeptRecharge deptRecharge = null;
+ // 校验积分值
+ // 校验积分包名称是否存在
+ if (StrUtil.isNotBlank(wmScorePackage.getScorePackageName())) {
+ int existed = wmScorePackageService.count(Wrappers.<WmScorePackage>lambdaQuery()
+ .eq(WmScorePackage::getDelFlag, "0")
+ .eq(WmScorePackage::getScorePackageName, wmScorePackage.getScorePackageName())
+ .eq(WmScorePackage::getDeptId, wmScorePackage.getDeptId()));
+ if (existed != 0) {
+ if (!relatedScoreId) {
+ // 校验 发包积分 < 积分充值分配的积分 则可以发包
+ deptRecharge = sysDeptRechargeMapper.selectOne(Wrappers.<SysDeptRecharge>lambdaQuery().eq(SysDeptRecharge::getDeptId, deptId));
+ if (deptRecharge == null) {
+ log.error("未配置积分充值信息");
+ throw new BizException("积分余额:0,积分不足");
+ int limitScore = deptRecharge.getScore() + deptRecharge.getOverdrawScore();
+ if (wmScorePackage.getScore() > limitScore) {
+ log.error("已分配积分不足,发包积分={},剩余积分={},透支额度={}", wmScorePackage.getScore(), deptRecharge.getScore(), limitScore);
+ throw new BizException(String.format("积分余额:%s,积分不足", deptRecharge.getScore()));
+ // 校验上级可分配积分值
+ new String[]{wmScorePackage.getRelationScoreId()});
+ int kfpjf = scorePackagekfpjf.get(0).getKfpjf();
+ if (wmScorePackage.getScore() > kfpjf) {
+ log.error("可分配积分值不足");
+ throw new BizException("可分配积分值不足");
+ wmScorePackage.setPackageType1("1");
+ wmScorePackage.setPackageIsConduct("0");
+ wmScorePackage.setDrugEntId(null);
+ wmScorePackage.setCreateUser(userId);
+ wmScorePackage.setCreateTime(now);
+ wmScorePackage.setUpdateTime(now);
+ wmScorePackage.setSendPackageDeptId(deptId.toString());
+ wmScorePackage.setAllocationDate(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN).format(now));
+ if (wmScorePackage.getEndTime() == null) {
+ // 默认截止日期为一年后
+ wmScorePackage.setEndTime(now.plusYears(1).toLocalDate());
+ // 关联上级推广药品企业(兼容历史)
+ if (StringUtils.isEmpty(relPkgId)) {
+ wmScorePackage.setDrugProducerList(null);
+ } else if (StringUtils.isNotEmpty(relPkgId) && ArrayUtils.isEmpty(wmScorePackage.getDrugtable())) {
+ // 关联上级推广药品
+ WmScorePackage relateSp = wmScorePackageService.getById(relPkgId);
+ if (relateSp != null) {
+ wmScorePackage.setDrugtable(relateSp.getDrugtable());
+ SysDept sysDeptRelatedService = sysDeptService.getById(Integer.valueOf(wmScorePackage.getRelatedService()));
+ if (StrUtil.isBlank(wmScorePackage.getTypeid())) {
+ WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(deptId);
+ if (wmDaDrugEnt != null) {
+ if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug().equals(wmDaDrugEnt.getId())) {
+ WmDaAgent wmDaAgent = wmDaAgentService.getById(wmScorePackage.getAcceptSug());
+ SysDept sysDepts = sysDeptService.getById(Integer.valueOf(wmDaAgent.getDeptId()));
+ if (sysDepts.getLevel() == 3) {
+ } else if (sysDepts.getLevel() == 4) {
+ wmScorePackage.setDeptId(wmDaAgent.getDeptId().toString());
+ wmScorePackage.setKfpjf(wmScorePackage.getScore());
+ } else if (wmDaDrugEnt.getId().equals(wmScorePackage.getAcceptSug())) {
+ wmScorePackage.setDeptId(deptId.toString());
+ if (sysDeptRelatedService.getLevel() == 2) {
+ WmDaDrugEnt wmDaDrugEnts = wmDaDrugEntService.selectByDeptId(Integer.valueOf(wmScorePackage.getRelatedService()));
+ if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug().equals(wmDaDrugEnts.getId())) {
+ } else if (wmScorePackage.getAcceptSug().equals(wmDaDrugEnt.getId())) {
+ } else if (sysDeptRelatedService.getLevel() == 3) {
+ WmDaAgent wmDaAgent1 = wmDaAgentService.selectByDeptId(Integer.valueOf(wmScorePackage.getRelatedService()));
+ if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug().equals(wmDaAgent1.getId())) {
+ } else if (wmDaAgent1.getId().equals(wmScorePackage.getAcceptSug())) {
+ //药企规则ID
+ SysDept sysDeptRuleId = sysDeptService.getById(deptId);
+ Integer deptLevel = sysDeptRuleId.getLevel();
+ if (deptLevel == 2) {
+ WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(sysDeptRuleId.getDeptId());
+ if (wmScorePackage.getAcceptSug().equals(wmDaDrugEnt.getId())) {
+ wmScorePackage.setRuleId(wmScorePackage.getAcceptSug());
+ wmScorePackage.setDrugEntId(wmDaDrugEnt.getId());
+ } else if (!wmScorePackage.getAcceptSug().equals(wmDaDrugEnt.getId())) {
+ WmTaskType wmTaskType = new WmTaskType();
+ wmTaskType.setRuleId(wmDaDrugEnt.getId() + wmScorePackage.getAcceptSug());
+ List<WmTaskType> wmTaskTypeList = wmTaskTypeService.selectByRuleId(wmTaskType);
+ if (CollUtil.isNotEmpty(wmTaskTypeList)) {
+ wmScorePackage.setRuleId(wmDaDrugEnt.getId() + wmScorePackage.getAcceptSug());
+ log.error("请药企给下级cso分配积分规则");
+ return R.failed("请药企给下级cso分配积分规则");
+ } else if (deptLevel == 3) {
+ //一级cso规则ID
+ WmDaAgent daAgent = wmDaAgentService.getOne(Wrappers.<WmDaAgent>lambdaQuery()
+ .eq(WmDaAgent::getEnableFlag, EnableEnum.ENABLE.val())
+ .eq(WmDaAgent::getDelFlag, DelEnum.NOT_DEL.val())
+ .eq(WmDaAgent::getDeptId, String.valueOf(sysDeptRuleId.getDeptId())));
+ if (StringUtils.isNotBlank(wmScorePackage.getRelationScoreId())) {
+ // 关联了积分包的情况
+ WmScorePackage relationScorePackage = wmScorePackageService.getById(wmScorePackage.getRelationScoreId());
+ if (relationScorePackage != null) {
+ wmScorePackage.setRuleId(relationScorePackage.getRuleId());
+ wmScorePackage.setDrugEntId(relationScorePackage.getDrugEntId());
+ log.error("cso没有分配积分规则");
+ return R.failed("cso没有分配积分规则");
+ // 没有关联积分包的情况
+ List<WmTaskType> taskTypeList = wmTaskTypeService.list(Wrappers.<WmTaskType>lambdaQuery()
+ .eq(WmTaskType::getRuleId, daAgent.getId()));
+ if (CollectionUtil.isNotEmpty(taskTypeList)) {
+ wmScorePackage.setRuleId(daAgent.getId().toString());
+ // 保存积分包
+ String typeId = "";
+ if (roles.contains(4) || roles.contains(3)) {
+ typeId = wmScorePackage.getDeptId().equals(deptId.toString()) ? "0" : "1";
+ typeId = wmScorePackage.getDeptId().equals(deptId.toString()) ? "1" : "2";
+ wmScorePackage.setTypeid(typeId);
+ // 发包成功 更新 上级包
+ if ((roles.contains(4) || roles.contains(3)) && deptLevel == 3) {
+ WmScorePackage relPkg = wmScorePackageService.getById(relPkgId);
+ // 是当前操作人所在企业的的关联包
+ if (relPkg != null && deptId.toString().equals(relPkg.getDeptId())) {
+ relPkg.setKfpjf((int) Math.ceil(relPkg.getKfpjf() - wmScorePackage.getScore()));
+ // 判断积分包是否被发放 (原有外包业务逻辑,不知道为什么)
+ int count = wmScorePackageService.count(Wrappers.<WmScorePackage>lambdaQuery()
+ .ne(WmScorePackage::getId, wmScorePackage.getId())
+ .eq(WmScorePackage::getId, relPkgId)
+ .eq(WmScorePackage::getEnableFlag, "0")
+ .notIn(WmScorePackage::getTypeid, 3, 4));
+ relPkg.setPackageIsConduct(count == 0 ? "0" : "1");
+ wmScorePackageService.updateById(relPkg);
+ // 失败了
+ else {
+ return R.failed("下发积分包失败");
+ List<WmScoreTaskType> taskTypeList = wmScorePackage.getWmScoreTaskTypeList();
+ if (CollUtil.isNotEmpty(taskTypeList)) {
+ if (StrUtil.isBlank(relPkgId) || (StrUtil.isNotBlank(relPkgId) && deptLevel == 3)) {
+ List<WmScoreTaskType> scoreTaskTypes = taskTypeList.stream().map(taskType -> {
+ wmScoreTaskType.setScoreId(wmScorePackage.getId());
+ wmScoreTaskType.setType("1");
+ wmScoreTaskType.setTaskTypeId(taskType.getTaskTypeId());
+ return wmScoreTaskType;
+ }).collect(Collectors.toList());
+ wmScoreTaskTypeService.deleteByScoreId(wmScorePackage.getId());
+ wmScoreTaskTypeService.batchInsertType(scoreTaskTypes);
+ // 更新积分充值信息
+ int currentScore = deptRecharge.getScore() - wmScorePackage.getScore();
+ int updateRecharge = sysDeptRechargeMapper.update(null, Wrappers.<SysDeptRecharge>lambdaUpdate()
+ .eq(SysDeptRecharge::getId, deptRecharge.getId())
+ .eq(SysDeptRecharge::getVersion, deptRecharge.getVersion())
+ .set(SysDeptRecharge::getScore, currentScore)
+ .set(SysDeptRecharge::getVersion, deptRecharge.getVersion() + 1)
+ .set(SysDeptRecharge::getUpdateTime, now)
+ .set(SysDeptRecharge::getUpdateUser, userId));
+ if (updateRecharge <= 0) {
+ log.warn("更新积分充值信息失败");
+ throw new RuntimeException("操作失败,请重试");
+ // 更新积分充值记录
+ SysDeptRechargeRecord rechargeRecord = new SysDeptRechargeRecord();
+ rechargeRecord.setDeptId(deptId);
+ rechargeRecord.setChangeScore(-wmScorePackage.getScore());
+ rechargeRecord.setRechargeId(deptRecharge.getId());
+ rechargeRecord.setPackageId(wmScorePackage.getId());
+ rechargeRecord.setPackageType(RechargeRecordPackageType.TO_ENTERPRISE);
+ rechargeRecord.setType(RechargeRecordType.SEND_PACKAGE_DEPT);
+ rechargeRecord.setCurrentScore(currentScore);
+ rechargeRecord.setCreateUser(userId);
+ rechargeRecord.setCreateTime(now);
+ sysDeptRechargeRecordMapper.insert(rechargeRecord);
+ // 保存关联的试卷
+ if (CollUtil.isNotEmpty(wmScorePackage.getQuizIds())) {
+ pkgQuizRelationService.createPkgQuizzes(wmScorePackage.getQuizIds(), Integer.parseInt(wmScorePackage.getId()));
+ // 判断是否有关联关系
+ if (CollUtil.isNotEmpty(wmScorePackage.getQuizRelationIds())) {
+ pkgQuizRelationService.copyQuizRelations(wmScorePackage.getQuizRelationIds(), Integer.parseInt(wmScorePackage.getId()));
+ * 终止积分包(大包)
+ @SysLog("终止积分包(大包)")
+ @PostMapping("/stopWmScorePackage")
+ public R<?> stopWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
+ log.info("终止积分包(大包)入参:{}", wmScorePackage);
+ if (StrUtil.isBlank(wmScorePackage.getId()) || !StrUtil.equalsAny(wmScorePackage.getEnableType(), "1", "2")) {
+ String cacheKey = CacheConstants.TERMINATE_PACKAGE_KEY + wmScorePackage.getId();
+ Boolean absent = redisTemplate.opsForValue().setIfAbsent(cacheKey, JSONUtil.toJsonStr(wmScorePackage), 3L, TimeUnit.SECONDS);
+ if (Boolean.FALSE.equals(absent)) {
+ return R.failed("正在处理");
+ return R.ok(wmScorePackageService.terminatePackageForDept(wmScorePackage.getId(),
+ UpmsType.TerminatePackageType.getByEnableType(wmScorePackage.getEnableType())));
+ * 终止积分包 new 终止 二期 业务平台
+ @SysLog("终止积分包")
+ @PostMapping("/updateStatusByIds")
+ public R<?> updateStatusByIds(@RequestBody WmScorePackage wmScorePackage) {
+ wmScorePackage.setUpdateUser(SecurityUtils.getUser().getId());
+ wmScorePackage.setUpdateTime(LocalDateTime.now());
+ if (null != wmScorePackage.getRelationScoreId() && !"".equals(wmScorePackage.getRelationScoreId())) {
+ wmScorePackage1.setRelationScoreId(wmScorePackage.getRelationScoreId());
+ if (null != wmScorePackage.getScorePackageName() && !"".equals(wmScorePackage.getScorePackageName())) {
+ wmScorePackage1.setEnableFlag("0");
+ WmScorePackage wmId = wmScorePackageService.getById(wmScorePackage.getId());
+ if (wmId.getId().equals(wms.getRelationScoreId())) {
+ return R.failed("积分包已被分派,请联系下属CSO终止关联积分包");
+ } else if (null != wms.getRelationScoreId() && "".equals(wms.getRelationScoreId())) {
+ wmScorePackage.setEnableFlag("1");
+ wmScorePackage.setPackageFinishStatus("2");
+ List<WmScorePackage> wmScorePackages = wmScorePackageService.selectRelationScoreId(wmId.getId());
+ if (wmScorePackages.size() > 0) {
+ for (WmScorePackage wmScorePackage3 : wmScorePackages) {
+ if (wmId.getRelationScoreId().equals(wmScorePackage3.getRelationScoreId())) {
+ wms.setPackageIsConduct("1");
+ wms.setPackageIsConduct("0");
+ if (SecurityUtils.getRoles().contains(4) || SecurityUtils.getRoles().contains(3)) {
+ queryWm.setEnableFlag("0");
+ for (WmScorePackage wmScorePackage2 : wmScorePackageList) {
+ if (wmId.getId().equals(wmScorePackage2.getRelationScoreId())) {
+ } else if (wmScorePackage2.getId().equals(wmId.getRelationScoreId())) {
+ for (WmScorePackage wmScorePackage1 : wmScorePackages) {
+ if (wmId.getRelationScoreId().equals(wmScorePackage1.getRelationScoreId())) {
+ wmScorePackage2.setPackageIsConduct("1");
+ wmScorePackage2.setPackageIsConduct("0");
+ wmScorePackage2.setKfpjf(new Double(Math.ceil(wmScorePackage2.getKfpjf() + wmId.getScore())).intValue());
+ } else if (null == wmScorePackage.getRelationScoreId() || "".equals(wmScorePackage.getRelationScoreId())) {
+ * 修改积分包(二期)
+ * @return 更新结果
+ @SysLog("修改积分包(大包)")
+ @PostMapping("/updateByIds")
+ public R<?> updateByIds(@RequestBody WmScorePackage wmScorePackage) {
+ log.info("修改积分包(大包)入参:{}", wmScorePackage);
+ // 校验修改后的积分包值 不能小于 已下发的下级包积分包值
+ List<WmScorePackage> subPackages = wmScorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
+ .eq(WmScorePackage::getRelationScoreId, wmScorePackage.getId())
+ .ne(WmScorePackage::getScorePackageStatus, ScorePackageStatusEnum.TERMINATED.val()));
+ if (CollUtil.isNotEmpty(subPackages)) {
+ int subPackgesScore = subPackages.stream().mapToInt(WmScorePackage::getScore).sum();
+ if (wmScorePackage.getScore() < subPackgesScore) {
+ return R.failed(String.format("该积分包已分配%s积分,修改后积分包值需大于该值", subPackgesScore));
+ SysDept sysDeptDrugEntId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
+ WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(sysDeptDrugEntId.getDeptId());
+ if (null != wmDaDrugEnt) {
+ wmScorePackage.setLevel2Id(null);
+ wmScorePackage.setLevel1Id(Integer.parseInt(wmScorePackage.getAcceptSug()));
+ wmScorePackage.setLevel1Id(null);
+ wmScorePackage.setLevel2Id(Integer.parseInt(wmScorePackage.getAcceptSug()));
+ if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug().equals(wmDaAgent.getId())) {
+ if (SecurityUtils.getRoles().contains(3) || SecurityUtils.getRoles().contains(4)) {
+ SysDept sysDeptRuleId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
+ if (sysDeptRuleId.getLevel() == 2) {
+ WmDaDrugEnt wmDaDrugEntRuleId = wmDaDrugEntService.selectByDeptId(sysDeptRuleId.getDeptId());
+ if (wmScorePackage.getAcceptSug().equals(wmDaDrugEntRuleId.getId())) {
+ wmScorePackage.setDrugEntId(wmDaDrugEntRuleId.getId());
+ } else if (!wmScorePackage.getAcceptSug().equals(wmDaDrugEntRuleId.getId())) {
+ wmScorePackage.setRuleId(wmDaDrugEntRuleId.getId() + wmScorePackage.getAcceptSug());
+ } else if (sysDeptRuleId.getLevel() == 3) {
+ if (sysDept.getLevel() == 3) {//判断是cso
+ } else if (sysDept.getLevel() == 2) {//判断是药企
+ queryWm.setScorePackageName(wmId.getScorePackageName());//获取当前包的scoreId
+ WmScorePackage wmIds = wmScorePackageService.getById(wmScorePackage.getId());
+ if (null != wmScorePackage.getAcceptSug() && !wmScorePackage.getAcceptSug()
+ .equals(wmDaDrugEnt.getId())) {
+ wmScorePackage.setKfpjf(wmScorePackage.getScore() - wmIds.getScore() + wmIds.getKfpjf());
+ } else if (wmScorePackage.getAcceptSug().equals(wmDaAgent.getId())) {
+ wmScorePackage.setDeptId(String.valueOf(wmDaAgent.getDeptId()));
+ SysDept sysDept5 = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
+ SysDept sysDept6 = sysDeptService.getById(Integer.valueOf(wmScorePackage.getDeptId()));
+ if (sysDept5.getLevel() == 2 && sysDept6.getLevel() == 2 && wmScorePackage.getDeptId()
+ .equals(String.valueOf(sysDept5.getDeptId()))) {
+ wmScorePackage.setTypeid("0");
+ } else if (sysDept5.getLevel() == 2) {
+ } else if (sysDept5.getLevel() == 3 && sysDept6.getLevel() == 3 && wmScorePackage.getDeptId()
+ } else if (sysDept5.getLevel() == 3) {
+ if (wms.getId().equals(wmScorePackage.getRelationScoreId())) {//判断是否有scoreId与当前关联积分包匹配
+ List<WmScorePackage> wmScorePackagess = wmScorePackageService.selectRelationScoreId(wmId.getId());
+ if (wmScorePackagess.size() > 0) {
+ for (WmScorePackage wmScorePackage13 : wmScorePackagess) {
+ if (wmScorePackage.getRelationScoreId().equals(wmScorePackage13.getId())) {
+ if (!wmScorePackage.getRelationScoreId().equals(wmId.getRelationScoreId())) {
+ if (wmScorePackage.getScore() < wms.getKfpjf() + wmId.getScore()) {
+ wms.setKfpjf(new Double(Math.ceil(wms.getKfpjf() - wmScorePackage.getScore())).intValue());
+ } else if (wmScorePackage.getScore() > wms.getKfpjf() + wmId.getScore()) {
+ return R.failed("可分配积分不足");
+ } else if (wmScorePackage.getScore() < wms.getKfpjf() + wmId.getScore()) {
+ wms.setKfpjf(new Double(Math.ceil(wms.getKfpjf() + wmId.getScore() - wmScorePackage.getScore()))
+ .intValue());
+ wmId.setScore(wmScorePackage.getScore());
+ } else if (wms.getKfpjf() != null && !wmScorePackage.getRelationScoreId()
+ .equals("") && wmScorePackage.getScore() > wms.getKfpjf() + wmId.getScore()) {
+ } else if ("".equals(wmScorePackage.getRelationScoreId()) && wms.getId()
+ .equals(wmId.getRelationScoreId())) {//判断关联积分包是否为无
+ wms.setKfpjf(wmId.getScore() + wms.getKfpjf());
+ } else if (wms.getId().equals(wmId.getRelationScoreId())) {
+ wms.setKfpjf(new Double(Math.ceil(wms.getKfpjf() + wmId.getScore())).intValue());
+ //判断是否进行中
+ if (null != wmScorePackage1.getRelationScoreId() && wmScorePackage1.getRelationScoreId()
+ .equals(wmId.getRelationScoreId())) {
+ if (CollUtil.isNotEmpty(wmScorePackage.getWmScoreTaskTypeList())) {
+ // 如果存在taskTypeId=39 则同时增加应收账款回款-A类、B类、C类任务类型(39/40/41)
+ if (wmScorePackage.getWmScoreTaskTypeList().stream().anyMatch(wmTaskTypeTree -> "39".equals(wmTaskTypeTree.getTaskTypeId()))) {
+ WmScoreTaskType addTaskType40 = new WmScoreTaskType();
+ addTaskType40.setScoreId(wmScorePackage.getId());
+ addTaskType40.setType("1");
+ addTaskType40.setTaskTypeId("40");
+ WmScoreTaskType addTaskType41 = new WmScoreTaskType();
+ addTaskType41.setScoreId(wmScorePackage.getId());
+ addTaskType41.setType("1");
+ addTaskType41.setTaskTypeId("41");
+ wmScorePackage.getWmScoreTaskTypeList().add(addTaskType40);
+ wmScorePackage.getWmScoreTaskTypeList().add(addTaskType41);
+ // 如果存在taskTypeId=42 则同时增加手术跟台-一级/手术跟台-二级/手术跟台-三级任务类型(42/43/44)
+ if (wmScorePackage.getWmScoreTaskTypeList().stream().anyMatch(wmTaskTypeTree -> "42".equals(wmTaskTypeTree.getTaskTypeId()))) {
+ WmScoreTaskType addTaskType43 = new WmScoreTaskType();
+ addTaskType43.setScoreId(wmScorePackage.getId());
+ addTaskType43.setType("1");
+ addTaskType43.setTaskTypeId("43");
+ WmScoreTaskType addTaskType44 = new WmScoreTaskType();
+ addTaskType44.setScoreId(wmScorePackage.getId());
+ addTaskType44.setType("1");
+ addTaskType44.setTaskTypeId("44");
+ wmScorePackage.getWmScoreTaskTypeList().add(addTaskType43);
+ wmScorePackage.getWmScoreTaskTypeList().add(addTaskType44);
+ // 如果存在taskTypeId=47 47,库存调研 48,竞品调研 49,培训 50,使用情况调查
+ if (wmScorePackage.getWmScoreTaskTypeList().stream().anyMatch(wmTaskTypeTree -> "47".equals(wmTaskTypeTree.getTaskTypeId()))) {
+ WmScoreTaskType addTaskTypeTree48 = new WmScoreTaskType();
+ addTaskTypeTree48.setTaskTypeId("48");
+ addTaskTypeTree48.setType("1");
+ WmScoreTaskType addTaskTypeTree49 = new WmScoreTaskType();
+ addTaskTypeTree49.setTaskTypeId("49");
+ addTaskTypeTree49.setType("1");
+ WmScoreTaskType addTaskTypeTree50 = new WmScoreTaskType();
+ addTaskTypeTree50.setTaskTypeId("50");
+ addTaskTypeTree50.setType("1");
+ wmScorePackage.getWmScoreTaskTypeList().add(addTaskTypeTree48);
+ wmScorePackage.getWmScoreTaskTypeList().add(addTaskTypeTree49);
+ wmScorePackage.getWmScoreTaskTypeList().add(addTaskTypeTree50);
+ List<WmScoreTaskType> wmScoreTaskTypess = new ArrayList<>();
+ for (WmScoreTaskType wmScoreTaskTypes : wmScorePackage.getWmScoreTaskTypeList()) {
+ //将积分表id和前端传的tasktypeId赋值给wmScoreTaskTypess
+ if ("".equals(wmScorePackage.getRelationScoreId())) {
+ wmScoreTaskType.setTaskTypeId(wmScoreTaskTypes.getTaskTypeId());
+ wmScoreTaskTypess.add(wmScoreTaskType);
+ wmScoreTaskTypeService.batchInsertType(wmScoreTaskTypess);
+ // 查询原积分包值
+ int oldPackageScore = wmScorePackageService.getById(wmScorePackage.getId()).getScore();
+ // 屏蔽推广药品企业
+ wmScorePackageService.updateById(wmScorePackage);
+ Integer userId = SecurityUtils.getUser().getId();
+ // 如果是通过积分充值的积分发的包,则回收积分
+ SysDeptRechargeRecord rechargeRecord = sysDeptRechargeRecordMapper.selectOne(Wrappers.<SysDeptRechargeRecord>lambdaQuery()
+ .eq(SysDeptRechargeRecord::getPackageId, wmScorePackage.getId())
+ .in(SysDeptRechargeRecord::getType, RechargeRecordType.SEND_PACKAGE_DEPT, RechargeRecordType.SEND_PACKAGE_PERSONAL));
+ boolean relatedScoreId = StrUtil.isNotBlank(wmScorePackage.getRelationScoreId()) && Integer.parseInt(wmScorePackage.getRelationScoreId()) > 0;
+ // 积分值相比修改前的变动(相对于积分余额,增加则为负-消耗,减少则为正-回收)
+ int changeScore = oldPackageScore - wmScorePackage.getScore();
+ // 没有关联上级包的情况
+ log.info("修改积分包,更新积分配置信息");
+ SysDeptRecharge deptRecharge = sysDeptRechargeMapper.selectOne(Wrappers.<SysDeptRecharge>lambdaQuery()
+ .eq(SysDeptRecharge::getDeptId, deptId));
+ log.warn("未配置积分充值信息");
+ throw new RuntimeException("积分余额:0。积分不足");
+ int currentScore = deptRecharge.getScore() + changeScore;
+ if (changeScore < 0 && Math.abs(changeScore) > limitScore) {
+ log.warn("已分配积分不足,修改积分={},剩余积分={},透支额度={}",
+ changeScore, deptRecharge.getScore(), deptRecharge.getOverdrawScore());
+ throw new RuntimeException(String.format("积分余额:%s。积分不足", deptRecharge.getScore()));
+ log.warn("更新大包积分充值信息失败");
+ SysDeptRechargeRecord newRechargeRecord = new SysDeptRechargeRecord();
+ newRechargeRecord.setRechargeId(deptRecharge.getId());
+ newRechargeRecord.setChangeScore(changeScore);
+ newRechargeRecord.setCurrentScore(currentScore);
+ newRechargeRecord.setType(RechargeRecordType.RECOVERY);
+ newRechargeRecord.setDeptId(deptRecharge.getDeptId());
+ newRechargeRecord.setRelationDeptId(rechargeRecord != null ? rechargeRecord.getRelationDeptId() : null);
+ newRechargeRecord.setPackageType(RechargeRecordPackageType.TO_ENTERPRISE);
+ newRechargeRecord.setPackageId(wmScorePackage.getId());
+ newRechargeRecord.setCreateUser(userId);
+ sysDeptRechargeRecordMapper.insert(newRechargeRecord);
+ // 关联了上级包的情况
+ if (changeScore < 0) {
+ // 变动积分后比原先多,则校验上级可分配积分值
+ List<WmScorePackage> scorePackagekfpjf = wmScorePackageService.getScorePackagekfpjf(null, null, new String[]{"0", "1", "2"},
+ if (Math.abs(changeScore) > kfpjf) {
+ throw new RuntimeException("可分配积分值不足");
+ return R.ok(Boolean.TRUE);
+ * 查询关联积分包列表
+ * @return 列表
+ @GetMapping("/getRelationScoreList")
+ public R<?> getRelationScoreList(WmScorePackage wmScorePackage) {
+ return wmScorePackageService.getRelationScoreList(wmScorePackage);
+ * 查询接单对象范围
+ * @return {@link R}<{@link ?}>
+ @GetMapping("/list-package-user-scope")
+ public R<?> listPackageUserScope() {
+ Integer sendDeptId = SecurityUtils.getUser().getDeptId();
+ QueryWrapper<WmScorePackage> queryWrapper = Wrappers.<WmScorePackage>query()
+ .select("package_user_scope")
+ .and(wrapper ->
+ wrapper.eq("package_type1", PackageTypeEnum.TYPE1_SCOTE_PACKAGE.val())
+ .eq("package_type2", PackageTypeEnum.TYPE2_TASK_PACKAGE.val())
+ .or(wrapper2 -> wrapper2.eq("package_type1", PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val())
+ .eq("package_type2", PackageTypeEnum.TYPE2_SETTLE_PACKAGE.val())))
+ .eq("send_package_dept_id", sendDeptId)
+ .in("typeid", "3", "4", "5");
+ List<WmScorePackage> packages = wmScorePackageService.list(queryWrapper);
+ if (CollUtil.isEmpty(packages)) {
+ return R.ok(Collections.emptyList());
+ List<String> pacakgeUserScores = packages.stream()
+ .map(WmScorePackage::getPackageUserScope)
+ .distinct().sorted().collect(Collectors.toList());
+ List<Map<String, String>> result = new ArrayList<>();
+ Map<String, String> val1 = new HashMap<>();
+ val1.put("id", "1");
+ val1.put("name", "仅内部可见");
+ Map<String, String> val2 = new HashMap<>();
+ val2.put("id", "2");
+ val2.put("name", "全部可见");
+ result.add(val1);
+ result.add(val2);
+ // 查询团队名称
+ List<WmTeam> teams = wmTeamService.listByIds(pacakgeUserScores);
+ List<Map<String, String>> teamNameList = teams.stream().map(t -> {
+ Map<String, String> teamNameMap = new HashMap<>(2);
+ teamNameMap.put("id", String.valueOf(t.getId()));
+ teamNameMap.put("name", t.getName());
+ return teamNameMap;
+ result.addAll(teamNameList);
+ return R.ok(result);
+ * 分配积分列表查询--派工平台
+ * @param acceptUser 接单对象,模糊查询
+ @GetMapping("/getScorePackagePageForBC")
+ public R<?> getScorePackagePageForBC(@RequestParam(value = "current") Integer current,
+ Integer userId,
+ @RequestParam(value = "packageType1") Integer packageType1,
+ @RequestParam(value = "packageType2") Integer packageType2,
+ @RequestParam(value = "scorePackageStatus", required = false) Integer scorePackageStatus,
+ @RequestParam(value = "typeid", required = false) String typeId,
+ @RequestParam(value = "monthStart", required = false) String monthStart,
+ @RequestParam(value = "monthEnd", required = false) String monthEnd,
+ @RequestParam(value = "acceptUser", required = false) String acceptUser,
+ @RequestParam(value = "relationScoreId", required = false) String relationScoreId,
+ @RequestParam(value = "toApproval", required = false) Boolean toApproval,
+ @RequestParam(value = "packageUserScope", required = false) String packageUserScope,
+ String sourceType
+ ) {
+ LocalDateTime start = null;
+ LocalDateTime end = null;
+ if (StrUtil.isNotEmpty(monthStart) && StrUtil.isNotEmpty(monthEnd)) {
+ start = LocalDateTime.of(LocalDate.parse(monthStart + "-01", DatePattern.NORM_DATE_FORMATTER), LocalTime.MIN);
+ LocalDate e = LocalDate.parse(monthEnd + "-01", DatePattern.NORM_DATE_FORMATTER);
+ end = LocalDateTime.of(e.with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
+ .eq("p.package_type1", packageType1)
+ .eq("p.package_type2", packageType2)
+ .eq(scorePackageStatus != null, "p.score_package_status", scorePackageStatus)
+ .eq("p.send_package_dept_id", deptId)
+ .between(start != null && end != null, "p.create_time", start, end);
+ if (StrUtil.isNotBlank(scorePackageName)) {
+ queryWrapper.and(wrapper -> wrapper.like("p.score_package_name", scorePackageName).or().like("p.pkg_sn", scorePackageName));
+ if (StringUtil.isEmpty(typeId)) {
+ queryWrapper.in("p.typeid", "3", "4", "5");
+ List<String> split = StrUtil.split(typeId, StrUtil.COMMA);
+ queryWrapper.in("p.typeid", split);
+ // 接单对象范围筛选
+ if (StrUtil.isNotBlank(packageUserScope)) {
+ queryWrapper.eq("p.package_user_scope", packageUserScope);
+ // 用于问问的系统来源
+ if (StrUtil.isNotBlank(sourceType)) {
+ queryWrapper.eq("p.source_type", sourceType);
+ if (userId != null) {
+ boolean onePersonScorePackageFlag = PackageTypeEnum.TYPE1_SCOTE_PACKAGE.val().equals(String.valueOf(packageType1))
+ && PackageTypeEnum.TYPE2_TASK_PACKAGE.val().equals(String.valueOf(packageType2));
+ boolean multiPersonScorePackageFlag = PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val().equals(String.valueOf(packageType1))
+ && PackageTypeEnum.TYPE2_SETTLE_PACKAGE.val().equals(String.valueOf(packageType2));
+ if (onePersonScorePackageFlag || multiPersonScorePackageFlag) {
+ // 如果是个人承接-按积分值/多人承接-按积分值,判断当前用户是否配置了团队负责人
+ List<WmTeam> teamList = wmTeamService.list(Wrappers.<WmTeam>lambdaQuery()
+ .eq(WmTeam::getDeptId, deptId)
+ .eq(WmTeam::getEnableFlag, EnableEnum.ENABLE.val())
+ .eq(WmTeam::getDelFlag, DelEnum.NOT_DEL.val())
+ .apply("FIND_IN_SET({0}, leader)", String.valueOf(userId)));
+ if (CollectionUtil.isNotEmpty(teamList)) {
+ // 如果配置了,则只查询所在团队下发的积分包
+ List<String> teamIdList = teamList.stream().map(wmTeam -> String.valueOf(wmTeam.getId())).collect(Collectors.toList());
+ queryWrapper.in("p.package_user_scope", teamIdList);
+ Page<WmScorePackage> wmScorePackagePage = wmScorePackageMapper.listScorePackage(new Page<>(current, size),
+ queryWrapper.orderByDesc("p.create_time"), acceptUser, relationScoreId, toApproval);
+ List<WmScorePackage> pageRecords = wmScorePackagePage.getRecords();
+ if (CollUtil.isNotEmpty(pageRecords)) {
+ Set<String> packageIds = pageRecords.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
+ // 任务统计
+ List<WmTask> taskList = wmTaskMapper.selectList(Wrappers.<WmTask>lambdaQuery()
+ .eq(WmTask::getRealFlag, "0")
+ .eq(WmTask::getEnableFlag, "0")
+ .eq(WmTask::getDelFlag, "0")
+ .in(WmTask::getScorePackageId, packageIds)
+ );
+ Map<String, List<WmTask>> taskGoupMap = taskList.stream().collect(Collectors.groupingBy(WmTask::getScorePackageId));
+ // 领取积分包记录
+ List<WmScorePackageStatus> scorePackageStatusList = wmScorePackageStatusService.list(Wrappers.<WmScorePackageStatus>lambdaQuery()
+ .in(WmScorePackageStatus::getPackageId, packageIds)
+ Map<String, List<WmScorePackageStatus>> packageStatusGroupMap = scorePackageStatusList.stream()
+ .collect(Collectors.groupingBy(WmScorePackageStatus::getPackageId));
+ //获取上级包
+ Set<String> parentPackageIds = pageRecords.stream().map(WmScorePackage::getRelationScoreId).collect(Collectors.toSet());
+ List<WmScorePackage> parentPackages = wmScorePackageMapper.selectList(Wrappers.<WmScorePackage>lambdaQuery()
+ .in(WmScorePackage::getId, parentPackageIds));
+ Map<String, WmScorePackage> parentPackageNameMap = parentPackages.stream()
+ .collect(Collectors.toMap(WmScorePackage::getId, Function.identity()));
+ // 类型标签
+ List<SysDictItem> dictItems = sysDictItemService.list(Wrappers.<SysDictItem>lambdaQuery()
+ .in(SysDictItem::getType, "package_type1", "package_type2"));
+ Map<String, List<SysDictItem>> dictItemMap = dictItems.stream().collect(Collectors.groupingBy(SysDictItem::getType));
+ List<SysDictItem> packageType1List = dictItemMap.get("package_type1");
+ List<SysDictItem> packageType2List = dictItemMap.get("package_type2");
+ // todo
+ //// 结算记录
+ //List<WmScorePackageSettleNote> noteList = settleNoteMapper.selectList(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
+ // .in(WmScorePackageSettleNote::getPackageId, packageIds));
+ //Map<String, List<WmScorePackageSettleNote>> noteMap = noteList.stream()
+ // .collect(Collectors.groupingBy(WmScorePackageSettleNote::getPackageId));
+ // 有效任务类型
+ List<WmScoreTaskType> taskTypeList = wmScoreTaskTypeMapper.getScoreTaskTypeByScoreId(String.join(",", packageIds));
+ Map<String, List<WmScoreTaskType>> taskTypeMap = taskTypeList.stream().collect(Collectors.groupingBy(WmScoreTaskType::getScoreId));
+ //for (int i = 0; i < pageRecords.size(); i++) {
+ // WmScorePackage wmScorePackage = pageRecords.get(i);
+ // List<WmTask> tasks = taskGoupMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
+ // List<WmScorePackageStatus> statuses = packageStatusGroupMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
+ // List<WmScorePackageSettleNote> notes = noteMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
+ // List<WmScoreTaskType> scoreTaskTypes = taskTypeMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
+ // wmScorePackageService.buildScorePackageSync(wmScorePackage, packageType1, packageType2, tasks, statuses,
+ // packageType1List, packageType2List, parentPackageNameMap, notes, scoreTaskTypes);
+ return R.ok(wmScorePackagePage);
+ @GetMapping("/getScorePackagePage")
+ public R<?> getScorePackagePage(@RequestParam(value = "current") Integer current,
+ return this.getScorePackagePageForBC(current, size, sendDeptId, userId, packageType1, packageType2, scorePackageName, scorePackageStatus,
+ typeId, monthStart, monthEnd, acceptUser, relationScoreId, toApproval, packageUserScope, sourceType);
+ * 积分包列表-其他(用于MAH结算:药企查询下级提交的) 用于BC
+ @GetMapping("/getScorePackagePageForMahForBC")
+ public R getScorePackagePageForMahForBC(@RequestParam(value = "current") Integer current,
+ @RequestParam(value = "toApproval", required = false) Boolean toApproval
+ .eq("p.mah_settle_dept_id", deptId)
+ .in("p.mah_settle_step", UpmsType.MahSettleStep.BUSINESS.getType(), UpmsType.MahSettleStep.FINANCE.getType())
+ queryWrapper.orderByDesc("p.settlement_date"), acceptUser, relationScoreId, toApproval);
+ // 个人承接-其他 标记已读提醒
+ wmBizReminderService.markRead(UpmsType.BizReminderType.ASSIGN_POINTS_OTHER_REMINDER, deptId);
+ * 积分包列表-其他(用于MAH结算:药企查询下级提交的)
+ @GetMapping("/getScorePackagePageForMah")
+ public R getScorePackagePageForMah(@RequestParam(value = "current") Integer current,
+ return this.getScorePackagePageForMahForBC(current, size, sendDeptId, packageType1, packageType2, scorePackageName,
+ scorePackageStatus, typeId, monthStart, monthEnd, acceptUser, relationScoreId, toApproval);
+ * 个人承接积分值导出-用于BC
+ @ResponseExcel(name = "exportPackageSettle", sheet = "个人承接积分值导出")
+ @SysLog("个人承接积分值导出-用于BC")
+ @GetMapping("/export-score-package-for-bc")
+ public List<WmScorePackageExcelModel> exportScorePackageForBC(
+ @RequestParam(value = "packageUserScope", required = false) String packageUserScope
+ long startMillis = System.currentTimeMillis();
+ List<WmScorePackage> scorePackageList = wmScorePackageMapper.listScorePackage(
+ log.info("积分包列表-不分页sql耗时:{}", System.currentTimeMillis() - startMillis);
+ if (CollUtil.isEmpty(scorePackageList)) {
+ return Collections.emptyList();
+ long buildStartMillis = System.currentTimeMillis();
+ Set<String> packageIds = scorePackageList.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
+ Set<String> parentPackageIds = scorePackageList.stream().map(WmScorePackage::getRelationScoreId).collect(Collectors.toSet());
+ List<WmScorePackageExcelModel> excelModelList = new ArrayList<>(scorePackageList.size());
+ for (int i = 0; i < scorePackageList.size(); i++) {
+ WmScorePackage wmScorePackage = scorePackageList.get(i);
+ log.info("====> 积分包SN:{}", wmScorePackage.getPackageSn());
+ List<WmTask> tasks = taskGoupMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
+ List<WmScorePackageStatus> statuses = packageStatusGroupMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
+ //List<WmScorePackageSettleNote> notes = noteMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
+ //List<WmScoreTaskType> scoreTaskTypes = taskTypeMap.getOrDefault(wmScorePackage.getId(), new ArrayList<>());
+ //wmScorePackageService.buildScorePackageSync(wmScorePackage, packageType1, packageType2, tasks, statuses,
+ WmScorePackageExcelModel excelModel = BeanUtil.copyProperties(wmScorePackage, WmScorePackageExcelModel.class);
+ if (StrUtil.isNotBlank(wmScorePackage.getScorePackageStatus())) {
+ excelModel.setScorePackageStatus(Objects.requireNonNull(ScorePackageStatusEnum.getByVal(wmScorePackage.getScorePackageStatus())).getDesc());
+ if (CollUtil.isNotEmpty(wmScorePackage.getUserList())) {
+ excelModel.setUserNames(String.join(",", wmScorePackage.getUserList()));
+ String typeid = wmScorePackage.getTypeid();
+ if (StrUtil.isNotBlank(typeid)) {
+ excelModel.setTypeidName("3".equals(typeid) ? "全职学术信息沟通专员" :
+ "4".equals(typeid) ? "兼职学术信息沟通专员" : "5".equals(typeid) ? "招商经理" : typeid);
+ excelModel.setNumber(String.valueOf(i + 1));
+ if (wmScorePackage.getYshtt() != null) {
+ excelModel.setFinishRate(String.valueOf(wmScorePackage.getYshtt()));
+ excelModel.setPayScore(wmScorePackage.getShtg());
+ if (wmScorePackage.getShtgtt() != null) {
+ excelModel.setPayRate(String.valueOf(wmScorePackage.getShtgtt()));
+ excelModelList.add(excelModel);
+ log.info("build积分包耗时:{}", System.currentTimeMillis() - buildStartMillis);
+ return excelModelList;
+ * 个人承接积分值导出
+ @SysLog("个人承接积分值导出")
+ @GetMapping("/export-score-package")
+ public List<WmScorePackageExcelModel> exportScorePackage(
+ return this.exportScorePackageForBC(packageType1, packageType2, sendDeptId, userId, scorePackageName,
+ scorePackageStatus, typeId, monthStart, monthEnd, acceptUser, relationScoreId, toApproval, packageUserScope);
+ * 个人承接积分值-其他导出-用于BC
+ @ResponseExcel(name = "exportPackageSettle", sheet = "个人承接积分值-其他导出")
+ @SysLog("个人承接积分值-其他导出-用于BC")
+ @GetMapping("/export-score-package-mah-for-bc")
+ public List<WmScorePackageExcelModel> exportPackageSettleForMahForBC(
+ log.info("MAH积分包列表sql耗时:{}", System.currentTimeMillis() - startMillis);
+ // 结算记录
+ * 个人承接积分值-其他导出
+ @SysLog("个人承接积分值-其他导出")
+ @GetMapping("/export-score-package-mah")
+ public List<WmScorePackageExcelModel> exportPackageSettleForMah(
+ return this.exportPackageSettleForMahForBC(packageType1, packageType2, sendDeptId, scorePackageName, scorePackageStatus,
+ typeId, monthStart, monthEnd, acceptUser, relationScoreId, toApproval);
+ * 积分包列表(结算包管理列表、无团队限制)
+ * @param packageType1 多个逗号分隔
+ @GetMapping("/page-settle-package")
+ public R<?> pageSettlePackage(@RequestParam(value = "current") Integer current,
+ @RequestParam(value = "packageType1") String packageType1,
+ @RequestParam(value = "monthEnd", required = false) String monthEnd
+ LambdaQueryWrapper<WmScorePackage> queryWrapper = Wrappers.<WmScorePackage>lambdaQuery()
+ .eq(WmScorePackage::getPackageType2, packageType2)
+ .like(StrUtil.isNotEmpty(scorePackageName), WmScorePackage::getScorePackageName, scorePackageName)
+ .eq(scorePackageStatus != null, WmScorePackage::getScorePackageStatus, scorePackageStatus)
+ .eq(WmScorePackage::getSendPackageDeptId, sendDeptId)
+ .between(start != null && end != null, WmScorePackage::getCreateTime, start, end);
+ List<String> packageType1List = StrUtil.split(packageType1, StrUtil.COMMA);
+ if (StrUtil.contains(packageType1, StrUtil.COMMA)) {
+ queryWrapper.in(WmScorePackage::getPackageType1, packageType1List);
+ queryWrapper.eq(WmScorePackage::getPackageType1, packageType1);
+ queryWrapper.in(WmScorePackage::getTypeid, "3", "4");
+ queryWrapper.in(WmScorePackage::getTypeid, split);
+ //queryWrapper.ne(WmScorePackage::getLocation, SubjectLocation.MAH_SETTLE);
+ Page<WmScorePackage> wmScorePackagePage = wmScorePackageMapper.selectPage(new Page<>(current, size), queryWrapper
+ .orderByDesc(WmScorePackage::getCreateTime));
// List<Future<WmScorePackage>> futureList = new ArrayList<>(pageRecords.size());
- for (WmScorePackage scorePackage : pageRecords) {
- if (packageType2 == 2) {
- //int wsNum = settleNoteMapper.selectCount(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
- // .eq(WmScorePackageSettleNote::getPackageId, scorePackage.getId())
- // .in(WmScorePackageSettleNote::getSettleNoteStatus, 2, 9));
- //int asNum = settleNoteMapper.selectCount(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
- // .eq(WmScorePackageSettleNote::getSettleNoteStatus, 1));
- //scorePackage.setWsTaskNum(wsNum);
- //scorePackage.setAsTaskNum(asNum);
- if (PackageTypeEnum.TYPE1_HCP_PACKAGE.getName().equals(scorePackage.getPackageType1())) {
- // 如果是患者教育,则转换积分值 '分'-> '元'
- Integer score = scorePackage.getScore();
- String userScore = scorePackage.getUserScore();
- if (org.apache.commons.lang3.StringUtils.isNumeric(userScore)) {
- scorePackage.setUserScore(String.format("%.2f", Integer.parseInt(userScore) / 100.0));
- List<WmScoreTaskType> taskTypeList = wmScoreTaskTypeMapper.getScoreTaskTypeByScoreId(scorePackage.getId());
- String taskTypes = taskTypeList.stream().map(
- WmScoreTaskType::getTaskTypeName).collect(Collectors.joining(","));
- scorePackage.setTaskTypes(taskTypes);
- * 结算包结算管理页面-其他(用于MAH结算)
- @GetMapping("/page-mah-settle-package")
- public R<?> pageMahSettlePackage(@RequestParam(value = "current") Integer current,
- .eq(WmScorePackage::getMahSettleDeptId, sendDeptId)
- .eq(WmScorePackage::getMahSettleStep, UpmsType.MahSettleStep.FINANCE.getType())
- queryWrapper.eq(WmScorePackage::getLocation, SubjectLocation.MAH_SETTLE);
- * 根据id查询积分包信息
- * @return 积分包信息
- @GetMapping("/getScorePackagePageById")
- public R<?> getScorePackagePageById(WmScorePackage wmScorePackage) {
- return wmScorePackageService.getScorePackagePageById(wmScorePackage);
- @SysLog("新增积分包(小包)")
- @PostMapping("/addWmScorePackage")
- public R<?> addWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
- log.info("新增积分包(小包)入参:{}", wmScorePackage);
- //定额
- if (wmScorePackage.getPackageType1().equals("1")) {
- if (StrUtil.isBlank(wmScorePackage.getPackageSn())) {
- return R.failed("积分包序列号必填");
- if (StrUtil.isNotBlank(wmScorePackage.getSubjectLocation())) {
- SubjectLocation location = Enum.valueOf(SubjectLocation.class, wmScorePackage.getSubjectLocation());
- wmScorePackage.setLocation(location);
- wmScorePackage.setSubType(String.valueOf(location.getGigType().getCode()));
- return wmScorePackageService.addWmScorePackage(wmScorePackage);
- @SysLog("修改积分包--删除、结算")
- @PostMapping("/updateEasy")
- public R updateEasy(@RequestBody WmScorePackage wmScorePackage) {
- return wmScorePackageService.updateEasy(wmScorePackage);
- * 更新积分包信息
- @SysLog("修改积分包(小包)")
- @PostMapping("/updateWmScorePackage")
- public R<?> updateWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
- log.info("修改积分包(小包)入参:{}", wmScorePackage);
- if (StrUtil.isBlank(wmScorePackage.getId())) {
- return R.failed("积分包id必填");
- if (wmScorePackage.getPackageType1().equals("1") && wmScorePackage.getScore() <= 0) {
- // 被领取的积分包 不能修改
- int total = wmScorePackageStatusService.count(Wrappers.<WmScorePackageStatus>lambdaQuery().eq(WmScorePackageStatus::getPackageId, wmScorePackage.getId()).in(WmScorePackageStatus::getStatus, "1", "2"));
- if (total > 0) {
- return R.failed("积分包已被领取,不能修改");
- // 校验重名
- long existed = wmScorePackageService.count(Wrappers.<WmScorePackage>lambdaQuery()
- .eq(WmScorePackage::getDeptId, wmScorePackage.getDeptId())
- .ne(WmScorePackage::getId, wmScorePackage.getId()));
- return wmScorePackageService.updateWmScorePackage(wmScorePackage);
- * 终止积分包(个人包)
- * @param wmScorePackage 参数
- @SysLog("终止积分包(个人包)")
- @GetMapping("/updateEnable")
- public R<?> terminatePackageForPersonal(WmScorePackage wmScorePackage) {
- log.info("终止积分包(个人包)入参:{}", wmScorePackage);
- if (!StrUtil.equalsAny(wmScorePackage.getEnableType(), "1", "2") || StrUtil.isBlank(wmScorePackage.getId())) {
- // 查询积分包
- WmScorePackage scorePackage = wmScorePackageService.getById(wmScorePackage.getId());
- // 只有个人承接/多人承接积分包走这个逻辑, 其他的包走原有逻辑
- if (PackageTypeEnum.TYPE1_SCOTE_PACKAGE.val().equals(scorePackage.getPackageType1())
- || PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val().equals(scorePackage.getPackageType1())) {
- return R.ok(wmScorePackageService.terminatePackageForPersonal(wmScorePackage.getId(),
- return wmScorePackageService.updateEnable(scorePackage);
- * 查询已完成积分值
- @GetMapping("/selectSettleStatus")
- public Map<String, Object> selectSettleStatus(WmScorePackage wmScorePackage) {
- return wmScorePackageService.selectSettleStatus(wmScorePackage);
- * 查询发包对象
- @GetMapping("/selectSendPackageDeptId")
- public List<SysDept> selectSendPackageDeptId(WmScorePackage wmScorePackage) {
- return wmScorePackageService.selectSendPackageDeptId(wmScorePackage);
- @GetMapping("/selectRelationScoreIdList")
- public WmScorePackage selectRelationScoreIdList(WmScorePackage wmScorePackage) {
- return wmScorePackageService.selectRelationScoreIdList(wmScorePackage);
- * 获取当前部门的基于所有积分包的相关信息
- * @return 积分包的相关信息
- @GetMapping("/getDeptScorePackageInfo")
- public R<?> getDeptScorePackageInfo() {
- Map<String, Object> result = wmScorePackageService.getDeptScorePackageInfo(deptId);
- * 获取积分包关联企业的药品列表
- * @param page 分页信息
- * @param packageId 积分包id
- * @param drugName 药品名称
- * @return 药品列表
- @SysLog("获取积分包关联企业的药品列表")
- @GetMapping(value = "/drugs")
- public R<?> listDrugsByPackageId(Page<WmDaDrugEntDrugtable> page,
- @RequestParam(value = "packageId") Integer packageId,
- @RequestParam(value = "name", required = false) String drugName) {
- return R.ok(wmScorePackageService.listDrugsByPackageId(page, packageId, drugName.trim()));
- // ~ 批量下发积分包 ===================================================================================================
- * 获取最近的记录
- * @return 最近记录
- @GetMapping(value = "/batch/history")
- public R<?> getBatchHistory() {
- HnqzUser user = SecurityUtils.getUser();
- // 缓存记录key
- String key = String.format(CacheConstants.BATCH_PACKAGE_HISTORY, user.getDeptId(), user.getId());
- String result = redisTemplate.opsForValue().get(key);
- if (StrUtil.isNotEmpty(result) && JSONUtil.isJson(result)) {
- JSONObject jsonObject = JSONUtil.parseObj(result);
- return R.ok(jsonObject);
- * 批量导入积分包
- * @param batchPackageExcelModels 积分包信息文件
- * @param scorePackage 积分包创建信息
- * @return success/false
- @SysLog("批量导入积分包")
- @PostMapping(value = "/batch")
- public R<?> batchCreatePackage(@RequestExcel(fileName = "excel", ignoreEmptyRow = true) List<BatchPackageExcelModel> batchPackageExcelModels,
- @RequestPart(value = "history") WmScorePackage scorePackage) {
- // 加锁防止多处理
- String lock = "lock:package:batch:" + user.getDeptId();
- if (!redisTemplate.opsForValue().setIfAbsent(lock, IdUtil.fastUUID())) {
- return R.failed("有在途的操作,请稍后");
- log.warn("==========================================批量导入积分包-插入redis:开始=====================================================");
- // 获取操作人
- // 记录历史信息
- Map<String, Object> history = new HashMap<>(2);
- scorePackage.setCreateTime(null);
- scorePackage.setUpdateTime(null);
- JSONObject jsonObject = JSONUtil.parseObj(scorePackage);
- jsonObject.set("relatedService", Integer.parseInt(scorePackage.getRelatedService()));
- history.put("history", jsonObject);
- history.put("timestamp", DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_TIME_PATTERN).format(LocalDateTime.now()));
- redisTemplate.opsForValue().set(key, JSONUtil.toJsonStr(history));
- log.warn("==========================================批量导入积分包-插入redis:结束=====================================================");
- log.warn("==========================================批量导入积分包:开始=====================================================");
- Multimap<String, Object> errorMap = ArrayListMultimap.create();
- TargetType targetType = null;
- // 全职
- if (StrUtil.equals("3", scorePackage.getTypeid())) {
- targetType = TargetType.FULL_TIME;
- // 兼职
- else if (StrUtil.equals("4", scorePackage.getTypeid())) {
- targetType = TargetType.PART_TIME;
- // 重复的模型
- Map<String, List<BatchPackageExcelModel>> dupNameModel = batchPackageExcelModels.stream()
- .collect(Collectors.groupingBy(BatchPackageExcelModel::getScorePackageName));
- List<String> names = batchPackageExcelModels.stream().map(BatchPackageExcelModel::getScorePackageName).collect(Collectors.toList());
- for (Map.Entry<String, List<BatchPackageExcelModel>> entry : dupNameModel.entrySet()) {
- String name = entry.getKey();
- int size = entry.getValue().size();
- if (size > 1) {
- List<Integer> index = new ArrayList<>(size);
- List<String> temp = new ArrayList<>(names);
- Iterator<String> iterator = temp.iterator();
- while (iterator.hasNext()) {
- int idx = temp.lastIndexOf(name);
- if (idx != -1) {
- index.add(idx + 1);
- temp.remove(idx);
- errorMap.put("模板内积分包名称重复", index.stream().sorted().collect(Collectors.toList()));
- // 业务校验
- for (int i = 0, batchScoreTotal = 0, rows = batchPackageExcelModels.size(); i < rows; i++) {
- batchScoreTotal += checkColumn(batchPackageExcelModels.get(i), targetType, errorMap, i + 1, user.getDeptId());
- // 额外校验可分配积分包
- if (!"-1".equals(scorePackage.getRelationScoreId()) && batchScoreTotal > (scorePackage.getKfpjf() == null ? 0 : scorePackage.getKfpjf())) {
- errorMap.put("批量下发总值大于可分配值", i + 1);
- // 存在错误全表打回
- if (!errorMap.isEmpty()) {
- List<Map<String, Object>> resultList = new ArrayList<>(errorMap.size());
- Map<String, Collection<Object>> asMap = errorMap.asMap();
- for (Map.Entry<String, Collection<Object>> entry : asMap.entrySet()) {
- Map<String, Object> m = new HashMap<>(2);
- m.put("reason", entry.getKey());
- m.put("line", entry.getValue());
- resultList.add(m);
- for (BatchPackageExcelModel model : batchPackageExcelModels) {
- scorePackage.setScore(Integer.parseInt(model.getScore()));
- scorePackage.setScorePackageName(model.getScorePackageName());
- scorePackage.setDescription(model.getDescription());
- scorePackage.setUserList(StrUtil.isEmpty(model.getTargetId()) ? new ArrayList<>(1) :
- Collections.singletonList(model.getTargetId()));
- scorePackage.setPackageSn("PKG" + pkgSequence.nextNo());
- wmScorePackageService.addWmScorePackage(scorePackage);
- } finally {
- log.warn("==========================================批量导入积分包:结束=====================================================");
- redisTemplate.delete(lock);
- * 校验model
- * @param model model
- * @param targetType 接包人类型
- * @param errorMap 收集错误map
- * @param row 所在行
- * @param deptId 所属企业
- private Integer checkColumn(BatchPackageExcelModel model, TargetType targetType,
- Multimap<String, Object> errorMap, Integer row, Integer deptId) {
- log.warn("==========================================校验批量下发积分包model:开始=====================================================");
- // 校验类型
- log.info("[{}]", model.getTargetType());
- if (!targetType.getDesc().equals(model.getTargetType())) {
- errorMap.put("接单对象类型不匹配", row);
- // 校验是否同名
- log.info("[{}]", model.getScorePackageName());
- if (StrUtil.isNotEmpty(model.getScorePackageName())) {
- .eq(WmScorePackage::getScorePackageName, model.getScorePackageName()));
- if (count != 0) {
- errorMap.put("积分包重名了", row);
- // 校验积分制是否为空
- log.info("[{}]", model.getScore());
- if (StrUtil.isEmpty(model.getScore())) {
- errorMap.put("积分值未填", row);
- // 校验是否是数字
- if (!Validator.isNumber(model.getScore())) {
- errorMap.put("积分值不是数字", row);
- } else if (model.getScore().contains(StrUtil.DOT) || Integer.parseInt(model.getScore()) <= 0) {
- errorMap.put("积分值必须是正整数", row);
- model.setScore("0");
- // 全职校验
- if (TargetType.FULL_TIME.equals(targetType)) {
- // 校验名称是否为空
- log.info("[{}]", model.getTargetName());
- if (StrUtil.isEmpty(model.getTargetName())) {
- errorMap.put("接单人姓名未填", row);
- // 校验名称是否为空,是否是企业下的人
- log.info("[{}]", model.getMobile());
- if (StrUtil.isEmpty(model.getMobile())) {
- errorMap.put("接单人手机号未填", row);
- if (!Validator.isMobile(model.getMobile())) {
- errorMap.put("手机号格式不争取", row);
- // 校验是否是企业下的
- List<SysUser> target = sysUserService.list(Wrappers.<SysUser>lambdaQuery()
- .eq(SysUser::getRealname, model.getTargetName())
- .eq(SysUser::getUsername, model.getMobile())
- .eq(SysUser::getDeptId, deptId)
- .eq(SysUser::getDelFlag, CommonConstants.STATUS_NORMAL)
- .eq(SysUser::getLockFlag, CommonConstants.STATUS_NORMAL)
- if (CollUtil.isEmpty(target) || target.size() > 1) {
- errorMap.put("查无此人", row);
- model.setTargetId(String.valueOf(target.get(0).getUserId()));
- // 兼职校验
- log.info("MOBILE: [{}], NAME: [{}]", model.getTargetName(), model.getTargetName());
- if (StrUtil.isNotEmpty(model.getTargetName()) || StrUtil.isNotEmpty(model.getMobile())) {
- errorMap.put("请勿使用全职模板", row);
- return Integer.parseInt(model.getScore());
- * 拆包
- * @param unpackDTO 拆包参数
- * @return 拆包结果
- @SysLog("拆包")
- @PostMapping("/unpack")
- public R<?> unpack(@Validated @RequestBody UnpackDTO unpackDTO) {
- log.info("======================================拆包开始执行===================================");
- log.info("拆包请求参数:{}", unpackDTO);
- Boolean unpack = wmScorePackageService.unpack(unpackDTO);
- log.info("======================================拆包执行完成===================================");
- return R.ok(unpack);
- * 积分包结算管理-发票上传
- * @param param 发票参数
- @SysLog("积分包结算管理-发票上传")
- @PostMapping("/upload-invoice")
- public R<?> uploadInvoice(@RequestBody WmScorePackageSettleOutput param) {
- log.info("积分包结算管理-发票上传参数:{}", param);
- if (StrUtil.isBlank(param.getId()) || StrUtil.isBlank(param.getInvoiceNumber()) || ArrayUtil.isEmpty(param.getInvoiceFile())) {
- WmScorePackage update = new WmScorePackage();
- update.setId(param.getId());
- update.setInvoiceNumber(param.getInvoiceNumber());
- update.setInvoiceFile(param.getInvoiceFile());
- update.setUpdateTime(LocalDateTime.now());
- update.setUpdateUser(SecurityUtils.getUser().getId());
- return R.ok(wmScorePackageService.updateById(update));
- * 重启积分包(默认延长1年)
- * @param scorePackage 参数
- @SysLog("重启积分包")
- @PostMapping("/restart")
- public R<?> restart(@RequestBody WmScorePackage scorePackage) {
- if (scorePackage.getId() == null) {
- LocalDate now = LocalDate.now();
- update.setId(scorePackage.getId());
- if (scorePackage.getEndTime() != null) {
- update.setEndTime(scorePackage.getEndTime());
- update.setEndTime(now.plusYears(1));
- wmScorePackageService.updateById(update);
+ for (WmScorePackage scorePackage : pageRecords) {
+ if (packageType2 == 2) {
+ //int wsNum = settleNoteMapper.selectCount(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
+ // .eq(WmScorePackageSettleNote::getPackageId, scorePackage.getId())
+ // .in(WmScorePackageSettleNote::getSettleNoteStatus, 2, 9));
+ //int asNum = settleNoteMapper.selectCount(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
+ // .eq(WmScorePackageSettleNote::getSettleNoteStatus, 1));
+ //scorePackage.setWsTaskNum(wsNum);
+ //scorePackage.setAsTaskNum(asNum);
+ if (PackageTypeEnum.TYPE1_HCP_PACKAGE.getName().equals(scorePackage.getPackageType1())) {
+ // 如果是患者教育,则转换积分值 '分'-> '元'
+ Integer score = scorePackage.getScore();
+ String userScore = scorePackage.getUserScore();
+ if (org.apache.commons.lang3.StringUtils.isNumeric(userScore)) {
+ scorePackage.setUserScore(String.format("%.2f", Integer.parseInt(userScore) / 100.0));
+ List<WmScoreTaskType> taskTypeList = wmScoreTaskTypeMapper.getScoreTaskTypeByScoreId(scorePackage.getId());
+ String taskTypes = taskTypeList.stream().map(
+ WmScoreTaskType::getTaskTypeName).collect(Collectors.joining(","));
+ scorePackage.setTaskTypes(taskTypes);
+ * 结算包结算管理页面-其他(用于MAH结算)
+ @GetMapping("/page-mah-settle-package")
+ public R<?> pageMahSettlePackage(@RequestParam(value = "current") Integer current,
+ .eq(WmScorePackage::getMahSettleDeptId, sendDeptId)
+ .eq(WmScorePackage::getMahSettleStep, UpmsType.MahSettleStep.FINANCE.getType())
+ //queryWrapper.eq(WmScorePackage::getLocation, SubjectLocation.MAH_SETTLE);
+ * 根据id查询积分包信息
+ * @return 积分包信息
+ @GetMapping("/getScorePackagePageById")
+ public R<?> getScorePackagePageById(WmScorePackage wmScorePackage) {
+ return wmScorePackageService.getScorePackagePageById(wmScorePackage);
+ @SysLog("新增积分包(小包)")
+ @PostMapping("/addWmScorePackage")
+ public R<?> addWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
+ log.info("新增积分包(小包)入参:{}", wmScorePackage);
+ //定额
+ if (wmScorePackage.getPackageType1().equals("1")) {
+ if (StrUtil.isBlank(wmScorePackage.getPackageSn())) {
+ return R.failed("积分包序列号必填");
+ //if (StrUtil.isNotBlank(wmScorePackage.getSubjectLocation())) {
+ // SubjectLocation location = Enum.valueOf(SubjectLocation.class, wmScorePackage.getSubjectLocation());
+ // wmScorePackage.setLocation(location);
+ // wmScorePackage.setSubType(String.valueOf(location.getGigType().getCode()));
+ return wmScorePackageService.addWmScorePackage(wmScorePackage);
+ @SysLog("修改积分包--删除、结算")
+ @PostMapping("/updateEasy")
+ public R updateEasy(@RequestBody WmScorePackage wmScorePackage) {
+ return wmScorePackageService.updateEasy(wmScorePackage);
+ * 更新积分包信息
+ @SysLog("修改积分包(小包)")
+ @PostMapping("/updateWmScorePackage")
+ public R<?> updateWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
+ log.info("修改积分包(小包)入参:{}", wmScorePackage);
+ if (StrUtil.isBlank(wmScorePackage.getId())) {
+ return R.failed("积分包id必填");
+ if (wmScorePackage.getPackageType1().equals("1") && wmScorePackage.getScore() <= 0) {
+ // 被领取的积分包 不能修改
+ int total = wmScorePackageStatusService.count(Wrappers.<WmScorePackageStatus>lambdaQuery().eq(WmScorePackageStatus::getPackageId, wmScorePackage.getId()).in(WmScorePackageStatus::getStatus, "1", "2"));
+ if (total > 0) {
+ return R.failed("积分包已被领取,不能修改");
+ // 校验重名
+ long existed = wmScorePackageService.count(Wrappers.<WmScorePackage>lambdaQuery()
+ .eq(WmScorePackage::getDeptId, wmScorePackage.getDeptId())
+ .ne(WmScorePackage::getId, wmScorePackage.getId()));
+ return wmScorePackageService.updateWmScorePackage(wmScorePackage);
+ * 终止积分包(个人包)
+ * @param wmScorePackage 参数
+ * @return 结果
+ @SysLog("终止积分包(个人包)")
+ @GetMapping("/updateEnable")
+ public R<?> terminatePackageForPersonal(WmScorePackage wmScorePackage) {
+ log.info("终止积分包(个人包)入参:{}", wmScorePackage);
+ if (!StrUtil.equalsAny(wmScorePackage.getEnableType(), "1", "2") || StrUtil.isBlank(wmScorePackage.getId())) {
+ // 查询积分包
+ WmScorePackage scorePackage = wmScorePackageService.getById(wmScorePackage.getId());
+ // 只有个人承接/多人承接积分包走这个逻辑, 其他的包走原有逻辑
+ if (PackageTypeEnum.TYPE1_SCOTE_PACKAGE.val().equals(scorePackage.getPackageType1())
+ || PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val().equals(scorePackage.getPackageType1())) {
+ return R.ok(wmScorePackageService.terminatePackageForPersonal(wmScorePackage.getId(),
+ return wmScorePackageService.updateEnable(scorePackage);
+ * 查询已完成积分值
+ @GetMapping("/selectSettleStatus")
+ public Map<String, Object> selectSettleStatus(WmScorePackage wmScorePackage) {
+ return wmScorePackageService.selectSettleStatus(wmScorePackage);
+ * 查询发包对象
+ @GetMapping("/selectSendPackageDeptId")
+ public List<SysDept> selectSendPackageDeptId(WmScorePackage wmScorePackage) {
+ return wmScorePackageService.selectSendPackageDeptId(wmScorePackage);
+ @GetMapping("/selectRelationScoreIdList")
+ public WmScorePackage selectRelationScoreIdList(WmScorePackage wmScorePackage) {
+ return wmScorePackageService.selectRelationScoreIdList(wmScorePackage);
+ * 获取当前部门的基于所有积分包的相关信息
+ * @return 积分包的相关信息
+ @GetMapping("/getDeptScorePackageInfo")
+ public R<?> getDeptScorePackageInfo() {
+ Map<String, Object> result = wmScorePackageService.getDeptScorePackageInfo(deptId);
+ * 获取积分包关联企业的药品列表
+ * @param page 分页信息
+ * @param packageId 积分包id
+ * @param drugName 药品名称
+ * @return 药品列表
+ @SysLog("获取积分包关联企业的药品列表")
+ @GetMapping(value = "/drugs")
+ public R<?> listDrugsByPackageId(Page<WmDaDrugEntDrugtable> page,
+ @RequestParam(value = "packageId") Integer packageId,
+ @RequestParam(value = "name", required = false) String drugName) {
+ return R.ok(wmScorePackageService.listDrugsByPackageId(page, packageId, drugName.trim()));
+ // ~ 批量下发积分包 ===================================================================================================
+ * 获取最近的记录
+ * @return 最近记录
+ @GetMapping(value = "/batch/history")
+ public R<?> getBatchHistory() {
+ HnqzUser user = SecurityUtils.getUser();
+ // 缓存记录key
+ String key = String.format(CacheConstants.BATCH_PACKAGE_HISTORY, user.getDeptId(), user.getId());
+ String result = redisTemplate.opsForValue().get(key);
+ if (StrUtil.isNotEmpty(result) && JSONUtil.isJson(result)) {
+ JSONObject jsonObject = JSONUtil.parseObj(result);
+ return R.ok(jsonObject);
+ * 批量导入积分包
+ * @param batchPackageExcelModels 积分包信息文件
+ * @param scorePackage 积分包创建信息
+ * @return success/false
+ @SysLog("批量导入积分包")
+ @PostMapping(value = "/batch")
+ public R<?> batchCreatePackage(@RequestExcel(fileName = "excel", ignoreEmptyRow = true) List<BatchPackageExcelModel> batchPackageExcelModels,
+ @RequestPart(value = "history") WmScorePackage scorePackage) {
+ // 加锁防止多处理
+ String lock = "lock:package:batch:" + user.getDeptId();
+ if (!redisTemplate.opsForValue().setIfAbsent(lock, IdUtil.fastUUID())) {
+ return R.failed("有在途的操作,请稍后");
+ log.warn("==========================================批量导入积分包-插入redis:开始=====================================================");
+ // 获取操作人
+ // 记录历史信息
+ Map<String, Object> history = new HashMap<>(2);
+ scorePackage.setCreateTime(null);
+ scorePackage.setUpdateTime(null);
+ JSONObject jsonObject = JSONUtil.parseObj(scorePackage);
+ jsonObject.set("relatedService", Integer.parseInt(scorePackage.getRelatedService()));
+ history.put("history", jsonObject);
+ history.put("timestamp", DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_TIME_PATTERN).format(LocalDateTime.now()));
+ redisTemplate.opsForValue().set(key, JSONUtil.toJsonStr(history));
+ log.warn("==========================================批量导入积分包-插入redis:结束=====================================================");
+ log.warn("==========================================批量导入积分包:开始=====================================================");
+ Multimap<String, Object> errorMap = ArrayListMultimap.create();
+ TargetType targetType = null;
+ // 全职
+ if (StrUtil.equals("3", scorePackage.getTypeid())) {
+ targetType = TargetType.FULL_TIME;
+ // 兼职
+ else if (StrUtil.equals("4", scorePackage.getTypeid())) {
+ targetType = TargetType.PART_TIME;
+ // 重复的模型
+ Map<String, List<BatchPackageExcelModel>> dupNameModel = batchPackageExcelModels.stream()
+ .collect(Collectors.groupingBy(BatchPackageExcelModel::getScorePackageName));
+ List<String> names = batchPackageExcelModels.stream().map(BatchPackageExcelModel::getScorePackageName).collect(Collectors.toList());
+ for (Map.Entry<String, List<BatchPackageExcelModel>> entry : dupNameModel.entrySet()) {
+ String name = entry.getKey();
+ int size = entry.getValue().size();
+ if (size > 1) {
+ List<Integer> index = new ArrayList<>(size);
+ List<String> temp = new ArrayList<>(names);
+ Iterator<String> iterator = temp.iterator();
+ while (iterator.hasNext()) {
+ int idx = temp.lastIndexOf(name);
+ if (idx != -1) {
+ index.add(idx + 1);
+ temp.remove(idx);
+ errorMap.put("模板内积分包名称重复", index.stream().sorted().collect(Collectors.toList()));
+ // 业务校验
+ for (int i = 0, batchScoreTotal = 0, rows = batchPackageExcelModels.size(); i < rows; i++) {
+ batchScoreTotal += checkColumn(batchPackageExcelModels.get(i), targetType, errorMap, i + 1, user.getDeptId());
+ // 额外校验可分配积分包
+ if (!"-1".equals(scorePackage.getRelationScoreId()) && batchScoreTotal > (scorePackage.getKfpjf() == null ? 0 : scorePackage.getKfpjf())) {
+ errorMap.put("批量下发总值大于可分配值", i + 1);
+ // 存在错误全表打回
+ if (!errorMap.isEmpty()) {
+ List<Map<String, Object>> resultList = new ArrayList<>(errorMap.size());
+ Map<String, Collection<Object>> asMap = errorMap.asMap();
+ for (Map.Entry<String, Collection<Object>> entry : asMap.entrySet()) {
+ Map<String, Object> m = new HashMap<>(2);
+ m.put("reason", entry.getKey());
+ m.put("line", entry.getValue());
+ resultList.add(m);
+ return R.ok(resultList);
+ for (BatchPackageExcelModel model : batchPackageExcelModels) {
+ scorePackage.setScore(Integer.parseInt(model.getScore()));
+ scorePackage.setScorePackageName(model.getScorePackageName());
+ scorePackage.setDescription(model.getDescription());
+ scorePackage.setUserList(StrUtil.isEmpty(model.getTargetId()) ? new ArrayList<>(1) :
+ Collections.singletonList(model.getTargetId()));
+ scorePackage.setPackageSn("PKG" + pkgSequence.nextNo());
+ wmScorePackageService.addWmScorePackage(scorePackage);
+ } finally {
+ log.warn("==========================================批量导入积分包:结束=====================================================");
+ redisTemplate.delete(lock);
+ * 校验model
+ * @param model model
+ * @param targetType 接包人类型
+ * @param errorMap 收集错误map
+ * @param row 所在行
+ * @param deptId 所属企业
+ private Integer checkColumn(BatchPackageExcelModel model, TargetType targetType,
+ Multimap<String, Object> errorMap, Integer row, Integer deptId) {
+ log.warn("==========================================校验批量下发积分包model:开始=====================================================");
+ // 校验类型
+ log.info("[{}]", model.getTargetType());
+ if (!targetType.getDesc().equals(model.getTargetType())) {
+ errorMap.put("接单对象类型不匹配", row);
+ // 校验是否同名
+ log.info("[{}]", model.getScorePackageName());
+ if (StrUtil.isNotEmpty(model.getScorePackageName())) {
+ .eq(WmScorePackage::getScorePackageName, model.getScorePackageName()));
+ if (count != 0) {
+ errorMap.put("积分包重名了", row);
+ // 校验积分制是否为空
+ log.info("[{}]", model.getScore());
+ if (StrUtil.isEmpty(model.getScore())) {
+ errorMap.put("积分值未填", row);
+ // 校验是否是数字
+ if (!Validator.isNumber(model.getScore())) {
+ errorMap.put("积分值不是数字", row);
+ } else if (model.getScore().contains(StrUtil.DOT) || Integer.parseInt(model.getScore()) <= 0) {
+ errorMap.put("积分值必须是正整数", row);
+ model.setScore("0");
+ // 全职校验
+ if (TargetType.FULL_TIME.equals(targetType)) {
+ // 校验名称是否为空
+ log.info("[{}]", model.getTargetName());
+ if (StrUtil.isEmpty(model.getTargetName())) {
+ errorMap.put("接单人姓名未填", row);
+ // 校验名称是否为空,是否是企业下的人
+ log.info("[{}]", model.getMobile());
+ if (StrUtil.isEmpty(model.getMobile())) {
+ errorMap.put("接单人手机号未填", row);
+ if (!Validator.isMobile(model.getMobile())) {
+ errorMap.put("手机号格式不争取", row);
+ // 校验是否是企业下的
+ List<SysUser> target = sysUserService.list(Wrappers.<SysUser>lambdaQuery()
+ .eq(SysUser::getRealname, model.getTargetName())
+ .eq(SysUser::getUsername, model.getMobile())
+ .eq(SysUser::getDeptId, deptId)
+ .eq(SysUser::getDelFlag, CommonConstants.STATUS_NORMAL)
+ .eq(SysUser::getLockFlag, CommonConstants.STATUS_NORMAL)
+ if (CollUtil.isEmpty(target) || target.size() > 1) {
+ errorMap.put("查无此人", row);
+ model.setTargetId(String.valueOf(target.get(0).getUserId()));
+ // 兼职校验
+ log.info("MOBILE: [{}], NAME: [{}]", model.getTargetName(), model.getTargetName());
+ if (StrUtil.isNotEmpty(model.getTargetName()) || StrUtil.isNotEmpty(model.getMobile())) {
+ errorMap.put("请勿使用全职模板", row);
+ return Integer.parseInt(model.getScore());
+ * 拆包
+ * @param unpackDTO 拆包参数
+ * @return 拆包结果
+ @SysLog("拆包")
+ @PostMapping("/unpack")
+ public R<?> unpack(@Validated @RequestBody UnpackDTO unpackDTO) {
+ log.info("======================================拆包开始执行===================================");
+ log.info("拆包请求参数:{}", unpackDTO);
+ Boolean unpack = wmScorePackageService.unpack(unpackDTO);
+ log.info("======================================拆包执行完成===================================");
+ return R.ok(unpack);
+ * 积分包结算管理-发票上传
+ * @param param 发票参数
+ @SysLog("积分包结算管理-发票上传")
+ @PostMapping("/upload-invoice")
+ public R<?> uploadInvoice(@RequestBody WmScorePackageSettleOutput param) {
+ log.info("积分包结算管理-发票上传参数:{}", param);
+ if (StrUtil.isBlank(param.getId()) || StrUtil.isBlank(param.getInvoiceNumber()) || ArrayUtil.isEmpty(param.getInvoiceFile())) {
+ return R.failed("必填参数为空");
+ WmScorePackage update = new WmScorePackage();
+ update.setId(param.getId());
+ update.setInvoiceNumber(param.getInvoiceNumber());
+ update.setInvoiceFile(param.getInvoiceFile());
+ update.setUpdateTime(LocalDateTime.now());
+ update.setUpdateUser(SecurityUtils.getUser().getId());
+ return R.ok(wmScorePackageService.updateById(update));
+ * 重启积分包(默认延长1年)
+ * @param scorePackage 参数
+ @SysLog("重启积分包")
+ @PostMapping("/restart")
+ public R<?> restart(@RequestBody WmScorePackage scorePackage) {
+ if (scorePackage.getId() == null) {
+ LocalDate now = LocalDate.now();
+ update.setId(scorePackage.getId());
+ if (scorePackage.getEndTime() != null) {
+ update.setEndTime(scorePackage.getEndTime());
+ update.setEndTime(now.plusYears(1));
+ wmScorePackageService.updateById(update);
@@ -190,12 +190,12 @@ public class WmTaskTypeController {
//药企新增 两个都是药企id
} else if (wmTaskTypeEntRef1.getAgentId().equals(wmTaskTypeEntRef1.getDrugentId())) {
- wmTaskType.setRuleId(wmTaskTypeEntRef1.getAgentId());
+ wmTaskType.setRuleId(wmTaskTypeEntRef1.getAgentId().toString());
//药企给cso新增 两个都有值 药企和cso
} else if (null!=wmTaskTypeEntRef1.getAgentId()&&null!=wmTaskTypeEntRef1.getDrugentId()
&&!"".equals(wmTaskTypeEntRef1.getAgentId())&&!"".equals(wmTaskTypeEntRef1.getDrugentId())
) {
- wmTaskType.setRuleId(wmTaskTypeEntRef1.getDrugentId() + wmTaskTypeEntRef1.getAgentId());
+ wmTaskType.setRuleId(""+wmTaskTypeEntRef1.getDrugentId() + wmTaskTypeEntRef1.getAgentId());
List<WmTaskType> wmTaskTypeList = wmTaskTypeService.selectByRuleId(wmTaskType);
for (WmTaskType wmTaskType1 : wmTaskTypeList) {
if (null!=wmTaskType1.getDurgentId()&&null!=wmTaskType1.getLevel1Id()
@@ -59,7 +59,7 @@ public class WmTaskTypeEntRefController {
// SysDept deptId = sysDeptMapper.selectDeptId(sysDept1);
SysDept deptId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
WmDaDrugEnt drId = wmDaDrugEntService.selectByDeptId(deptId.getDeptId());
- wmTaskTypeEntRef.setDrugentId((String.valueOf(drId.getId())));
+ wmTaskTypeEntRef.setDrugentId((drId.getId()));
return R.ok(wmTaskTypeEntRefService.page(page, Wrappers.query(wmTaskTypeEntRef)));
@@ -86,8 +86,8 @@ public class WmTaskTypeEntRefController {
if (anId == null) {
return R.ok(new ArrayList<>());
- wmTaskTypeEntRef.setAgentId(String.valueOf(anId.getId()));
- wmTaskTypeEntRef.setDrugentId("");
+ wmTaskTypeEntRef.setAgentId(anId.getId());
+ wmTaskTypeEntRef.setDrugentId(null);
@@ -126,7 +126,7 @@ public class WmTaskTypeEntRefController {
if (null != wmDaAgent) {
- wmTaskTypeEntRef.setDeptId(wmDaAgent.getDeptId());
+ wmTaskTypeEntRef.setDeptId(wmDaAgent.getDeptId().toString());
boolean isSave = wmTaskTypeEntRefService.save(wmTaskTypeEntRef);
@@ -209,7 +209,7 @@ public class WmTaskTypeEntRefController {
else if (null != wmDaAgent) {
}else if (DrugEntDeptId.getLevel() == 2) {
return R.failed("药企只能分配积分规则");
@@ -233,7 +233,7 @@ public class WmTaskTypeEntRefController {
- newOne.setRuleId(wmTaskType1.getDurgentId() + wmTaskType1.getLevel1Id());
+ newOne.setRuleId(""+wmTaskType1.getDurgentId() + wmTaskType1.getLevel1Id());
newList.add(newOne);
@@ -19,69 +19,69 @@ import java.util.Map;
@Mapper
public interface WmDaAgentMapper extends DataScopeMapper<WmDaAgent> {
- WmDaAgent selectByDeptId(WmDaAgent wmDaAgent);
+ WmDaAgent selectByDeptId(WmDaAgent wmDaAgent);
- List selectByUserDeptId(Integer deptId);
+ List selectByUserDeptId(Integer deptId);
- WmDaAgent selectByDeptIds(Integer deptId);
+ WmDaAgent selectByDeptIds(Integer deptId);
- List selectByDrugIds(Integer id);
+ List selectByDrugIds(Integer id);
- List selectByDrugId(Integer id);
+ List selectByDrugId(Integer id);
List selectByRelationId(Integer id);
- List selectByRelationIds(Integer id);
+ List selectByRelationIds(Integer id);
- List selectEntNameByDrugId(Integer id);
+ List selectEntNameByDrugId(Integer id);
- IPage<WmDaAgent> selectWmManagementPage(Page page, @Param("query")WmDaAgent wmDaAgent);
+ IPage<WmDaAgent> selectWmManagementPage(Page page, @Param("query") WmDaAgent wmDaAgent);
- List<WmDaAgent> selectWmManagementList(@Param("query")WmDaAgent wmDaAgent);
+ List<WmDaAgent> selectWmManagementList(@Param("query") WmDaAgent wmDaAgent);
- int insert1(WmDaAgent wmDaAgent);
+ int insert1(WmDaAgent wmDaAgent);
- List<WmDaAgent> selectExtDrugEntList(@Param("query") WmDaAgent wmDaAgent);
+ List<WmDaAgent> selectExtDrugEntList(@Param("query") WmDaAgent wmDaAgent);
- WmDaAgent selectDeptId(WmDaAgent wmDaAgent);
+ WmDaAgent selectDeptId(WmDaAgent wmDaAgent);
- List<Map<String,String>> selectDeptId1(WmDaAgent wmDaAgent);
+ List<Map<String, Object>> selectDeptId1(@Param("deptId") Integer deptId);
- WmDaAgent selectExtDrugEnt(WmDaAgent wmDaAgent);
+ WmDaAgent selectExtDrugEnt(WmDaAgent wmDaAgent);
- List<WmDaAgent> selectByGsmcList(@Param("query")WmDaAgent wmDaAgent);
+ List<WmDaAgent> selectByGsmcList(@Param("query") WmDaAgent wmDaAgent);
- WmDaAgent selectByGsmc(@Param("query")WmDaAgent wmDaAgent);
+ WmDaAgent selectByGsmc(@Param("query") WmDaAgent wmDaAgent);
- List selectEntNameByDrugIds(Integer id);
+ List selectEntNameByDrugIds(Integer id);
List selectByCsoIds(Integer id);
List selectWmDaDrugEntByDeptId(Integer deptId);
- List selectWmDaDrugEntByDeptIds(Integer deptId);
+ List selectWmDaDrugEntByDeptIds(Integer deptId);
- List selectWmDaAgentByRelationId(Integer deptId);
+ List selectWmDaAgentByRelationId(Integer deptId);
List selectWmDaAgentByRelationIds(Integer deptId);
- List selectWmDaAgentByDeptId(String deptId);
- List selectWmDaAgentByDeptIds(String deptId);
- * 根据sys_dept表的level字段查询
- * @param deptLevel
- List<WmDaAgent> listAgentByDeptLevel(@Param("deptLevel") String deptLevel);
- * 根据deptRelation查询
- * @param deptId
- List<WmDaAgent> listAgentByDeptRelation(@Param("deptId") Integer deptId);
+ List selectWmDaAgentByDeptId(String deptId);
+ List selectWmDaAgentByDeptIds(String deptId);
+ * 根据sys_dept表的level字段查询
+ * @param deptLevel
+ List<WmDaAgent> listAgentByDeptLevel(@Param("deptLevel") String deptLevel);
+ * 根据deptRelation查询
+ * @param deptId
+ List<WmDaAgent> listAgentByDeptRelation(@Param("deptId") Integer deptId);
@@ -39,7 +39,7 @@ public interface WmDaDrugEntMapper extends DataScopeMapper<WmDaDrugEnt> {
WmDaDrugEnt selectByDeptId(Integer deptId);
List selectByUserDeptId(Integer deptId);
- List<Map<String,String>> selectDeptId1(WmDaDrugEnt wmDaDrugEnt);
WmDaDrugEnt selectId(WmDaDrugEnt wmDaDrugEnt);
@@ -18,5 +18,5 @@ public interface WmTaskTypeEntRefMapper extends BaseMapper<WmTaskTypeEntRef> {
List<WmTaskTypeEntRef> selectByDrId(String id);
- List<WmTaskTypeEntRef> selectByAgentId(String agentId);
+ List<WmTaskTypeEntRef> selectByAgentId(Integer agentId);
@@ -4,11 +4,9 @@ package com.qunzhixinxi.hnqz.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qunzhixinxi.hnqz.admin.api.entity.MonitoringIndicator;
import java.util.Collection;
* 风险监控
@@ -18,20 +16,20 @@ import java.util.List;
public interface MonitoringIndicatorService extends IService<MonitoringIndicator> {
- * 获取税源地限额
- * @param subjectLocation 税源地
- * @return 限额信息
- MonitoringIndicator locationLimit(SubjectLocation subjectLocation);
- * 结算校验
- * @param notes 结算记录
- * @param location 税源地
- * @return 总结算额
- BigDecimal settleMonitoringIndicator(Collection<WmScorePackageSettleNote> notes, SubjectLocation location);
+ ///**
+ // * 获取税源地限额
+ // *
+ // * @param subjectLocation 税源地
+ // * @return 限额信息
+ // */
+ //MonitoringIndicator locationLimit(SubjectLocation subjectLocation);
+ // * 结算校验
+ // * @param notes 结算记录
+ // * @param location 税源地
+ // * @return 总结算额
+ //BigDecimal settleMonitoringIndicator(Collection<WmScorePackageSettleNote> notes, SubjectLocation location);
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.qunzhixinxi.hnqz.admin.api.model.output.SettleAmountMonitorOutput;
import com.qunzhixinxi.hnqz.common.core.util.R;
import java.util.List;
@@ -20,25 +19,25 @@ import java.util.Set;
public interface SysDeptSubService extends IService<SysDeptSub> {
R<?> updateSubLimitAmount(DeptSubLimitAmountInput input);
- List<SettleAmountMonitorOutput> getSettleAmountMonitor(List<String> idCards, List<Integer> settleNoteIds, SubjectLocation location);
- List<SettleAmountMonitorOutput> getYaoyiAmountMonitor(List<String> idCards, List<Integer> settleNoteIds, SubjectLocation location);
- List<SettleAmountMonitorOutput> getDeptAmountMonitor(Set<Integer> userIds, List<Integer> settleNoteIds, SubjectLocation location);
- * @param input 参数
- void saveSettleConfig(DeptSubLimitAmountInput input);
- * 获取税源地的配置信息
- * @param deptId 部门id
- * @return 税源地记录
- SysDeptSub getDeptSub(Integer deptId, SubjectLocation location);
+ //List<SettleAmountMonitorOutput> getSettleAmountMonitor(List<String> idCards, List<Integer> settleNoteIds, SubjectLocation location);
+ //List<SettleAmountMonitorOutput> getYaoyiAmountMonitor(List<String> idCards, List<Integer> settleNoteIds, SubjectLocation location);
+ //List<SettleAmountMonitorOutput> getDeptAmountMonitor(Set<Integer> userIds, List<Integer> settleNoteIds, SubjectLocation location);
+ // * 结算管理配置
+ // * @param input 参数
+ //void saveSettleConfig(DeptSubLimitAmountInput input);
+ // * 获取税源地的配置信息
+ // * @param deptId 部门id
+ // * @return 税源地记录
+ //SysDeptSub getDeptSub(Integer deptId, SubjectLocation location);
@@ -11,7 +11,6 @@ import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
import com.qunzhixinxi.hnqz.admin.api.dto.CommonUserDTO;
@@ -71,7 +70,7 @@ public interface SysUserService extends IService<SysUser> {
Boolean updateUser(UserDTO userDto);
- public R<Boolean> updateUserInfoVo(UserVO userVO);
+ R<Boolean> updateUserInfoVo(UserVO userVO);
* 通过ID查询用户信息
@@ -106,7 +105,7 @@ public interface SysUserService extends IService<SysUser> {
SysUser getByIdIgnore(String taskUserId);
- R batchChannelCert(UserCertificationInput input);
+ //R batchChannelCert(UserCertificationInput input);
R getAuthInfo(UserCertificationInput input);
@@ -118,13 +117,6 @@ public interface SysUserService extends IService<SysUser> {
Map<String, String> batchByExcel(Map<String, List<CommonUserDTO>> commonUserDTOListMap);
- * 结算时校验用户信息
- * @param userIds 用户id集合
- void checkUserInfoToSettle(Collection<Integer> userIds, SubjectLocation subjectLocation);
* 校验是否超60周岁
package com.qunzhixinxi.hnqz.admin.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
@@ -58,7 +57,7 @@ public interface WmDaAgentService extends IService<WmDaAgent> {
WmDaAgent selectDeptId(WmDaAgent wmDaAgent);
- List<Map<String,String>> selectDeptId1();
+ List<Map<String, Object>> selectDeptId1(Integer deptId);
@@ -16,5 +16,5 @@ public interface WmTaskTypeEntRefService extends IService<WmTaskTypeEntRef> {
@@ -7,7 +7,6 @@ import com.qunzhixinxi.hnqz.admin.api.entity.MonitoringIndicator;
import com.qunzhixinxi.hnqz.admin.mapper.MonitoringIndicatorMapper;
import com.qunzhixinxi.hnqz.admin.service.MonitoringIndicatorService;
@@ -37,91 +36,5 @@ public class MonitoringIndicatorServiceImpl extends ServiceImpl<MonitoringIndica
private final SysDeptSubService sysDeptSubService;
- public MonitoringIndicator locationLimit(SubjectLocation subjectLocation) {
- MonitoringIndicator one = this.getOne(Wrappers.<MonitoringIndicator>lambdaQuery().eq(MonitoringIndicator::getSubjectLocation, subjectLocation));
- if (one == null) {
- throw new RuntimeException("风控信息不存在");
- log.info("风控信息:{}", one);
- return one;
- public BigDecimal settleMonitoringIndicator(Collection<WmScorePackageSettleNote> notes, SubjectLocation location) {
- SysDeptSub sysDeptSub = sysDeptSubService.getDeptSub(SecurityUtils.getUser().getDeptId(), location);
- // 校验当月结算额度
- List<String> idCards = notes.stream().map(WmScorePackageSettleNote::getIdCardNumber).collect(Collectors.toList());
- List<Integer> noteIds = notes.stream().map(WmScorePackageSettleNote::getId).filter(Objects::nonNull).collect(Collectors.toList());
- Set<Integer> userIds = notes.stream().map(WmScorePackageSettleNote::getUserId).map(Integer::valueOf).collect(Collectors.toSet());
- List<SettleAmountMonitorOutput> monitorOutputList = sysDeptSubService.getSettleAmountMonitor(idCards, noteIds, location);
- List<SettleAmountMonitorOutput> yaoyiAmountMonitor = sysDeptSubService.getYaoyiAmountMonitor(idCards, noteIds, location);
- List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(userIds, noteIds, location);
- // 限额
- MonitoringIndicator monitoringIndicator = this.locationLimit(location);
- BigDecimal deptLimit = sysDeptSub.getLimitAmount();
- BigDecimal monitoringLimit = monitoringIndicator.getLimitAmount();
- BigDecimal yaoyiLimitAmount = monitoringIndicator.getYaoyiLimitAmount();
- BigDecimal total = BigDecimal.ZERO;
- for (WmScorePackageSettleNote note : notes) {
- total = total.add(note.getSettleAmount());
- BigDecimal monitorAmount = note.getSettleAmount();
- BigDecimal deptMonitorAmount = note.getSettleAmount();
- BigDecimal yaoyiMonitorAmount = note.getSettleAmount();
- SettleAmountMonitorOutput monitorOutput = monitorOutputList.stream().filter(item -> item.getIdCardNumber()
- .equals(note.getIdCardNumber())).findFirst().orElse(null);
- SettleAmountMonitorOutput deptMonitorOutput = deptAmountMonitor.stream().filter(item -> item.getUserId()
- .equals(note.getUserId())).findFirst().orElse(null);
- SettleAmountMonitorOutput yaoyiMonitorOutput = yaoyiAmountMonitor.stream().filter(item -> item.getIdCardNumber()
- if (null != monitorOutput) {
- monitorAmount = monitorAmount.add(monitorOutput.getTotalAmount());
- if (null != deptMonitorOutput) {
- deptMonitorAmount = deptMonitorAmount.add(deptMonitorOutput.getTotalAmount());
- if (null != yaoyiMonitorOutput) {
- yaoyiMonitorAmount = yaoyiMonitorAmount.add(yaoyiMonitorOutput.getTotalAmount());
- if (null != deptLimit && deptMonitorAmount.compareTo(deptLimit) > 0) {
- throw new RuntimeException("企业限额:[" + deptLimit + "]," + note.getRealName() + "存在:[" + deptMonitorAmount + "], 超过企业限额");
- if (null != monitoringLimit && monitorAmount.compareTo(monitoringLimit) > 0) {
- throw new RuntimeException("渠道限额:[" + monitoringLimit + "]," + note.getRealName() + "存在:[" + monitorAmount + "], 超过结算渠道限额");
- if (null != yaoyiLimitAmount && yaoyiMonitorAmount.compareTo(yaoyiLimitAmount) > 0) {
- throw new RuntimeException("渠道限额:[" + yaoyiLimitAmount + "]," + note.getRealName() + "存在:[" + yaoyiMonitorAmount + "],可用于结算(结算失败、待结算)和当月在途结算的记录总额超过平台限额");
- return total;
@@ -12,8 +12,6 @@ import com.qunzhixinxi.hnqz.admin.api.model.input.SettleAmountMonitorInput;
import com.qunzhixinxi.hnqz.admin.mapper.SysDeptMapper;
import com.qunzhixinxi.hnqz.admin.mapper.SysDeptSubMapper;
import com.qunzhixinxi.hnqz.admin.mapper.WmDaAgentMapper;
@@ -59,121 +57,4 @@ public class SysDeptSubServiceImpl extends ServiceImpl<SysDeptSubMapper, SysDept
return R.ok();
- public List<SettleAmountMonitorOutput> getSettleAmountMonitor(List<String> idCards, List<Integer> settleNoteIds, SubjectLocation location) {
- SettleAmountMonitorInput monitorInput = new SettleAmountMonitorInput(idCards, settleNoteIds, location);
- return sysDeptSubMapper.getSettleAmountMonitor(monitorInput);
- public List<SettleAmountMonitorOutput> getYaoyiAmountMonitor(List<String> idCards, List<Integer> settleNoteIds, SubjectLocation location) {
- return sysDeptSubMapper.getYaoyiAmountMonitor(monitorInput);
- public List<SettleAmountMonitorOutput> getDeptAmountMonitor(Set<Integer> userIds, List<Integer> settleNoteIds, SubjectLocation location) {
- SettleAmountMonitorInput monitorInput = new SettleAmountMonitorInput(userIds, settleNoteIds, location);
- return sysDeptSubMapper.getDeptAmountMonitor(monitorInput);
- public SysDeptSub getDeptSub(Integer deptId, SubjectLocation location) {
- SysDeptSub sysDeptSub = this.getOne(Wrappers.<SysDeptSub>lambdaQuery()
- .eq(SysDeptSub::getDeptId, deptId)
- .eq(SysDeptSub::getSubjectLocation, location)
- .eq(SysDeptSub::getEnableFlag,SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode())
- if (null == sysDeptSub || StringUtils.isBlank(sysDeptSub.getAppId())) {
- throw new RuntimeException("企业结算信息不存在");
- return sysDeptSub;
- public void saveSettleConfig(DeptSubLimitAmountInput input) {
- // 更新结算主体
- String[] subTypeArr = input.getSubList().stream()
- .map(sysDeptSub -> String.valueOf(sysDeptSub.getSubjectLocation().getGigType().getCode()))
- SysDept dept = sysDeptMapper.selectById(input.getDeptId());
- if (dept.getLevel() == 2) {
- // 药企
- wmDaDrugEntMapper.update(null, Wrappers.<WmDaDrugEnt>lambdaUpdate()
- .eq(WmDaDrugEnt::getDeptId, String.valueOf(input.getDeptId()))
- .eq(WmDaDrugEnt::getEnableFlag, EnableEnum.ENABLE.val())
- .eq(WmDaDrugEnt::getDelFlag, DelEnum.NOT_DEL.val())
- .set(WmDaDrugEnt::getSubjectType, subTypeArr));
- } else if (dept.getLevel() == 3) {
- // 更新agent
- wmDaAgentMapper.update(null, Wrappers.<WmDaAgent>lambdaUpdate()
- .eq(WmDaAgent::getDeptId, String.valueOf(input.getDeptId()))
- .set(WmDaAgent::getSubjectType, subTypeArr));
- // 更新dept
- sysDeptMapper.update(null, Wrappers.<SysDept>lambdaUpdate()
- .eq(SysDept::getDeptId, input.getDeptId())
- .set(SysDept::getSubjectType, subTypeArr));
- // 先设置所有deptSub为无效
- SysDeptSub deptSubWhere = new SysDeptSub();
- deptSubWhere.setDeptId(input.getDeptId());
- sysDeptSubMapper.update(deptSubWhere, Wrappers.<SysDeptSub>lambdaUpdate()
- .eq(SysDeptSub::getDeptId, input.getDeptId())
- .set(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_FALSE.getCode()));
- // 更新/保存deptSub
- input.getSubList().forEach(sysDeptSub -> {
- SysDeptSub queryDeptSub = sysDeptSubMapper.selectOne(Wrappers.<SysDeptSub>lambdaQuery()
- .eq(SysDeptSub::getSubjectLocation, sysDeptSub.getSubjectLocation()));
- if (queryDeptSub != null) {
- // 更新
- SysDeptSub updateDeptSub = new SysDeptSub();
- updateDeptSub.setSubId(queryDeptSub.getSubId());
- updateDeptSub.setSubjectChannel(sysDeptSub.getSubjectChannel() == null ? 0 : sysDeptSub.getSubjectChannel());
- updateDeptSub.setSubjectLocation(sysDeptSub.getSubjectLocation());
- updateDeptSub.setSubjectInvoiceCategory(sysDeptSub.getSubjectInvoiceCategory());
- updateDeptSub.setLimitAmount(sysDeptSub.getLimitAmount());
- updateDeptSub.setCertEnable(sysDeptSub.getCertEnable());
- updateDeptSub.setSettleEnable(sysDeptSub.getSettleEnable());
- updateDeptSub.setEidEnable(sysDeptSub.getEidEnable());
- updateDeptSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
- updateDeptSub.setUpdateTime(LocalDateTime.now());
- sysDeptSubMapper.updateById(updateDeptSub);
- // 新增
- SysDeptSub insertDeptSub = new SysDeptSub();
- insertDeptSub.setDeptId(input.getDeptId());
- insertDeptSub.setSubjectType(String.valueOf(sysDeptSub.getSubjectLocation().getGigType().getCode()));
- insertDeptSub.setSubjectChannel(sysDeptSub.getSubjectChannel() == null ? 0 : sysDeptSub.getSubjectChannel());
- insertDeptSub.setSubjectLocation(sysDeptSub.getSubjectLocation());
- insertDeptSub.setSubjectInvoiceCategory(sysDeptSub.getSubjectInvoiceCategory());
- insertDeptSub.setLimitAmount(sysDeptSub.getLimitAmount());
- insertDeptSub.setCertEnable(sysDeptSub.getCertEnable());
- insertDeptSub.setSettleEnable(sysDeptSub.getSettleEnable());
- insertDeptSub.setEidEnable(sysDeptSub.getEidEnable());
- insertDeptSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
- sysDeptSubMapper.insert(insertDeptSub);
@@ -9,7 +9,6 @@ import com.qunzhixinxi.hnqz.admin.api.dto.SysEnterpriseRelationDTO;
import com.qunzhixinxi.hnqz.admin.api.entity.SysEnterpriseRelation;
import com.qunzhixinxi.hnqz.admin.api.vo.SysEnterpriseRelationVO;
import com.qunzhixinxi.hnqz.admin.mapper.SysEnterpriseRelationMapper;
@@ -70,24 +69,24 @@ public class SysEnterpriseRelationServiceImpl extends ServiceImpl<SysEnterpriseR
if (CollUtil.isNotEmpty(serviceCharges)) {
- List<SysDeptSub> deptSubs = deptSubService.list(Wrappers.<SysDeptSub>lambdaQuery().eq(SysDeptSub::getDeptId, relation.getEnterpriseId()));
- if (CollUtil.isNotEmpty(deptSubs)) {
- Map<SubjectLocation, Integer> subMap = deptSubs.stream().collect(Collectors.toMap(SysDeptSub::getSubjectLocation, SysDeptSub::getSubId));
- List<SysDeptSub> subs = serviceCharges.stream().map(m -> {
- SysDeptSub sub = new SysDeptSub();
- sub.setDeptId(relation.getEnterpriseId());
- SubjectLocation location = Enum.valueOf(SubjectLocation.class, (String) m.get("subjectLocation"));
- Integer subId = subMap.get(location);
- sub.setSubId(subId);
- sub.setSubjectLocation(location);
- sub.setServiceCharge(new BigDecimal(m.get("serviceCharge").toString()));
- return sub;
- deptSubService.updateBatchById(subs);
+ //List<SysDeptSub> deptSubs = deptSubService.list(Wrappers.<SysDeptSub>lambdaQuery().eq(SysDeptSub::getDeptId, relation.getEnterpriseId()));
+ //if (CollUtil.isNotEmpty(deptSubs)) {
+ // Map<SubjectLocation, Integer> subMap = deptSubs.stream().collect(Collectors.toMap(SysDeptSub::getSubjectLocation, SysDeptSub::getSubId));
+ // List<SysDeptSub> subs = serviceCharges.stream().map(m -> {
+ // SysDeptSub sub = new SysDeptSub();
+ // sub.setDeptId(relation.getEnterpriseId());
+ // SubjectLocation location = Enum.valueOf(SubjectLocation.class, (String) m.get("subjectLocation"));
+ // Integer subId = subMap.get(location);
+ // sub.setSubId(subId);
+ // sub.setSubjectLocation(location);
+ // sub.setServiceCharge(new BigDecimal(m.get("serviceCharge").toString()));
+ // return sub;
+ // deptSubService.updateBatchById(subs);
@@ -26,13 +26,7 @@ import com.qunzhixinxi.hnqz.admin.api.dto.CommonUserDTO;
import com.qunzhixinxi.hnqz.admin.api.model.output.UserCertificationOutput;
import com.qunzhixinxi.hnqz.admin.api.constant.enums.LockEnum;
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.RenlijiaCertStatus;
import com.qunzhixinxi.hnqz.admin.service.*;
import com.qunzhixinxi.hnqz.common.core.constant.CacheConstants;
@@ -109,7 +103,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
SysDeptSub sysDeptSub = new SysDeptSub();
// sysDeptSub.setDeptId(SecurityUtils.getUser().getDeptId());
sysDeptSub.setDeptId(sysUser.getDeptId());
+ //sysDeptSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
List<SysDeptSub> subList = sysDeptSubMapper.selectList(Wrappers.query(sysDeptSub));
UserCertificationOutput output = new UserCertificationOutput();
output.setSubList(subList);
@@ -147,57 +141,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return errorMap;
- * @param subjectLocation 结算税源地
- public void checkUserInfoToSettle(Collection<Integer> userIds, SubjectLocation subjectLocation) {
- for (Integer userId : userIds) {
- SysUser user = this.getById(userId);
- if (StrUtil.isBlank(user.getIdCardNumber())) {
- throw new RuntimeException(user.getRealname() + "身份信息缺失,不能发起结算");
- // 获取结算零工
- SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery().eq(SysUserSub::getSubjectLocation, subjectLocation).eq(SysUserSub::getUserId, user.getUserId()));
- if (userSub == null) {
- throw new RuntimeException(user.getRealname() + "人员认证信息不存在,不能结算");
- //switch (subjectLocation.getGigType()) {
- // case REN_LI_JIA:
- // case OLADING:
- // case ZHENG_QI_ZHI_XING:
- // case LANG_CHAO:
- // case HUI_QI_YUN:
- // case ZHONG_YI_YUN:
- // case ZHONG_ZHI:
- // case QI_FU:
- // case SHEN_ZHEN_REN_CAI:
- // case YI_MA:
- // case XIN_SHI_YI:
- // case HE_CHUANG:
- // if (!Objects.equals(userSub.getCertStatus(), DingEnum.CER_STATUS_1.getType())) {
- // throw new RuntimeException(user.getRealname() + "未认证,不能发起结算");
- // }
- // break;
- // case TAX_HELPOR:
- // if (!Objects.equals(userSub.getCertStatus(), TaxHelperCertStatus.CERT.getCode())) {
- // throw new RuntimeException(user.getRealname() + "人员未认证或未绑卡,不能结算");
- // default:
- // throw new RuntimeException(user.getRealname() + "人员结算渠道不存在,不能结算");
@@ -636,11 +579,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
- if (ArrayUtils.contains(dept.getSubjectType(), SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode())) {
- //userDTO.setCertStatus(TaxHelperCertStatus.UN_CERT.getCode());
// 记录正确的结果
userDTO.setCreateTime(LocalDateTime.now());
userDTO.setDeptId(dept.getDeptId());
@@ -648,108 +586,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
- * @Modify: start
- * @Version: 2021.4.16
- * @Author: ryz
- * @Date: 2021/4/21
- * @Desc: 认证方式 {@link SubjectLocation SubjectLocation}
- @Transactional
- public R batchChannelCert(UserCertificationInput input) {
- SysUser sysUser = baseMapper.selectById(input.getUserId());
- String inputIdCardNumber = input.getIdCardNumber();
- String bankCardNumber = input.getBankCardNumber();
- sysUser.setIdCardNumber(inputIdCardNumber);
- if (StrUtil.isNotEmpty(bankCardNumber)) {
- sysUser.setBankCardNumber(input.getBankCardNumber());
- SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
- StringBuilder msg = new StringBuilder();
- for (String subjectLocation : input.getSubList()) {
- // 校验是否配置了结算限制
- .eq(SysDeptSub::getDeptId, SecurityUtils.getUser().getDeptId())
- .eq(SysDeptSub::getSubjectLocation, subjectLocation)
- .eq(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode()));
- if (!queryDeptSub.getSettleEnable()) {
- log.info("{}企业配置了结算限制", deptId);
- return R.failed(null, "系统维护中,请联系管理员");
- ////人力家
- //if (SubjectLocation.REN_LI_JIA.getType().equals(subjectLocation)) {
- // Map<String, String> resultMap = certByRenLiJia(sysUser, sysDept);
- // msg.append("人力家认证结果:");
- // msg.append(resultMap.get("msg"));
- // msg.append(";");
- // else if (SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode().equals(subType)) {
- // Map<String, String> resultMap = certByShuiBangYun(sysUser, sysDept);
- // msg.append("税邦云认证结果:");
- String resultMsg = msg.toString();
- baseMapper.updateById(sysUser);
- if (ArrayUtil.contains(input.getSubList(), SubjectLocation.REN_LI_JIA.getType())) {
- Integer certStatus = Optional.ofNullable(sysUser.getRljCertStatus())
- .orElseGet(RenlijiaCertStatus.CER_STATUS_4::getCode);
- // 更新人力家userSub
- SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
- .eq(SysUserSub::getUserId, sysUser.getUserId())
- .eq(SysUserSub::getGigType, GigTypeEnum.REN_LI_JIA));
- if (userSub != null) {
- SysUserSub updateUserSub = new SysUserSub();
- updateUserSub.setId(userSub.getId());
- updateUserSub.setCertStatus(certStatus);
- // 发起成功,则修改CallbackStatus状态为进行中
- if (RenlijiaCertStatus.CER_STATUS_3.getCode() == certStatus) {
- updateUserSub.setCallbackStatus(GigCallBackStatus.IN_PROGRESS);
- updateUserSub.setCallbackStatus(GigCallBackStatus.RETURNED);
- updateUserSub.setCertRemark(resultMsg);
- updateUserSub.setUpdateTime(now);
- updateUserSub.setUpdateUser(0);
- sysUserSubMapper.updateById(updateUserSub);
- SysUserSub saveUserSub = new SysUserSub();
- saveUserSub.setDeptId(sysUser.getDeptId());
- saveUserSub.setUserId(sysUser.getUserId());
- saveUserSub.setGigType(GigTypeEnum.REN_LI_JIA);
- saveUserSub.setSubjectLocation(SubjectLocation.REN_LI_JIA);
- saveUserSub.setGigChannel(GigChannelEnum.DEFAULT);
- saveUserSub.setCertRemark(resultMsg);
- saveUserSub.setCertStatus(certStatus);
- saveUserSub.setCallbackStatus(GigCallBackStatus.IN_PROGRESS);
- saveUserSub.setCallbackStatus(GigCallBackStatus.RETURNED);
- saveUserSub.setCreateTime(now);
- saveUserSub.setCreateUser(0);
- sysUserSubMapper.insert(saveUserSub);
- return R.ok(null, resultMsg.substring(0, resultMsg.length() - 1));
* 保存用户信息
@@ -862,7 +698,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
// 认证状态查询条件
if (StrUtil.isNotBlank(userDTO.getSubjectLocation()) && userDTO.getCertType() != null) {
LambdaQueryWrapper<SysUserSub> queryWrapper = Wrappers.<SysUserSub>lambdaQuery()
- .eq(SysUserSub::getSubjectLocation, SubjectLocation.resolve(userDTO.getSubjectLocation()))
+ //.eq(SysUserSub::getSubjectLocation, SubjectLocation.resolve(userDTO.getSubjectLocation()))
.eq(SysUserSub::getCertStatus, userDTO.getCertType());
if (userDTO.getDeptId() != null) {
queryWrapper.eq(SysUserSub::getDeptId, userDTO.getDeptId());
@@ -1,8 +1,6 @@
package com.qunzhixinxi.hnqz.admin.service.impl;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -12,7 +10,6 @@ import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
import com.qunzhixinxi.hnqz.admin.mapper.WmDaDrugEntMapper;
@@ -54,7 +51,7 @@ public class WmDaDrugEntServiceImpl extends ServiceImpl<WmDaDrugEntMapper, WmDaD
@Transactional(rollbackFor = Exception.class)
public boolean saveDrugEnt(WmDaDrugEnt entity) {
Integer deptId = Integer.parseInt(System.currentTimeMillis() / 1000 + "");
- entity.setDeptId(deptId + "");
+ entity.setDeptId(deptId);
entity.setCreateTime(LocalDateTime.now());
boolean isSave = super.save(entity);
if (isSave) {
@@ -62,7 +59,7 @@ public class WmDaDrugEntServiceImpl extends ServiceImpl<WmDaDrugEntMapper, WmDaD
sysDept.setDeptId(deptId);
sysDept.setName(entity.getEntname());
sysDept.setLevel(2);
- sysDept.setLevel1Id(Integer.parseInt(entity.getId()));
+ sysDept.setLevel1Id(entity.getId());
sysDept.setLevel1Name(entity.getEntname());
sysDept.setSubjectType(entity.getSubjectType());
sysDept.setTaxCode(entity.getEntcode());
@@ -127,7 +124,7 @@ public class WmDaDrugEntServiceImpl extends ServiceImpl<WmDaDrugEntMapper, WmDaD
LocalDateTime now = LocalDateTime.now();
- entity.setDeptId(String.valueOf(System.currentTimeMillis() / 1000));
+ entity.setDeptId((int) System.currentTimeMillis() / 1000);
entity.setCreateTime(now);
entity.setCreateUser(SecurityUtils.getUser().getId());
@@ -140,7 +137,7 @@ public class WmDaDrugEntServiceImpl extends ServiceImpl<WmDaDrugEntMapper, WmDaD
sysDept.setFinancialReviewType(entity.getFinancialReviewType());
sysDept.setExpiryDate(now.plusYears(1L).toLocalDate());
sysDeptService.save(sysDept);
- entity.setDeptId(String.valueOf(sysDept.getDeptId()));
+ entity.setDeptId(sysDept.getDeptId());
wmDaDrugEntMapper.updateById(entity);
List<SysDeptRelation> newList = new ArrayList<>();
@@ -208,15 +205,15 @@ public class WmDaDrugEntServiceImpl extends ServiceImpl<WmDaDrugEntMapper, WmDaD
public IPage<WmDaDrugEnt> selectPage(Page page, WmDaDrugEnt wmDaDrugEnt) {
IPage<WmDaDrugEnt> listIPage = wmDaDrugEntMapper.selectPage(page, wmDaDrugEnt);
- listIPage.getRecords().forEach(ent -> {
- Map<String, Integer> collect = sysDeptSubMapper.selectList(Wrappers.<SysDeptSub>lambdaQuery()
- .eq(SysDeptSub::getDeptId, ent.getDeptId())
- .eq(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode()))
- .stream()
- ent.setSubjectType(collect.keySet().toArray(new String[0]));
- ent.setSubjectTypeAndChannel(collect);
+ //listIPage.getRecords().forEach(ent -> {
+ // Map<String, Integer> collect = sysDeptSubMapper.selectList(Wrappers.<SysDeptSub>lambdaQuery()
+ // .eq(SysDeptSub::getDeptId, ent.getDeptId())
+ // //.eq(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode()))
+ // .stream()
+ // ent.setSubjectType(collect.keySet().toArray(new String[0]));
+ // ent.setSubjectTypeAndChannel(collect);
+ //});
return listIPage;
@@ -252,7 +252,7 @@ public class WmDeptTaskTypeConfigServiceImpl extends ServiceImpl<WmDeptTaskTypeC
@Override
public WmDeptTaskTypeConfigDTO getDeptTaskTypeConfig(Integer deptId) {
// 查询出当前dept对应的药企/代理商id
- String durgentId = null;
+ Integer durgentId;
SysDept dept = sysDeptMapper.selectById(deptId);
if (DeptLevelEnum.ENT.getVal().equals(dept.getLevel())) {
WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntMapper.selectOne(Wrappers.<WmDaDrugEnt>lambdaQuery()
@@ -371,7 +371,7 @@ public class WmDeptTaskTypeConfigServiceImpl extends ServiceImpl<WmDeptTaskTypeC
// 查询出当前dept对应的任务类型(药企或药企给CSO的任务类型)
+ Integer durgentId ;
@@ -198,7 +198,7 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
wmScorePackage.setZbId(null);
wmScorePackage.setTypeid("2");
wmScorePackage.setDelFlag("0");
wmScorePackage.setEnableFlag("0");
@@ -777,7 +777,7 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
if (dept.getLevel() == 2) {//药企
WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.getOne(Wrappers.<WmDaDrugEnt>lambdaQuery()
.eq(WmDaDrugEnt::getDeptId, dept.getDeptId()));
- wmScorePackage.setDrugEntId(wmDaDrugEnt.getId() + "");
wmScorePackage.setRuleId(this.queryRuleID(wmDaDrugEnt, null));
} else if (dept.getLevel() == 3 || dept.getLevel() == 4) {//一级cso
WmDaAgent wmDaAgent = wmDaAgentService.getOne(Wrappers.<WmDaAgent>lambdaQuery()
@@ -1604,7 +1604,7 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
@@ -3887,10 +3887,10 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
if (StringUtils.isBlank(ouPut.getSettleStatus())) {
ouPut.setSettleStatus(String.valueOf(settleNote.getSettleNoteStatus()));
- ouPut.setSubjectLocation(settleNote.getSubjectLocation());
- if (settleNote.getSubjectLocation() != null) {
- ouPut.setSubjectLocationName(settleNote.getSubjectLocation().getDescription());
+ //ouPut.setSubjectLocation(settleNote.getSubjectLocation());
+ //if (settleNote.getSubjectLocation() != null) {
+ // ouPut.setSubjectLocationName(settleNote.getSubjectLocation().getDescription());
ouPut.setSubToGigTime(settleNote.getSubToGigTime());
ouPut.setActualAmount(settleNote.getActualAmount());
ouPut.setCategoryName(settleNote.getCategoryName());
@@ -43,8 +43,6 @@ import com.qunzhixinxi.hnqz.admin.api.constant.enums.PackageFinishStatusEnum;
import com.qunzhixinxi.hnqz.admin.mapper.WmReportMapper;
import com.qunzhixinxi.hnqz.admin.mapper.WmScorePackageMapper;
@@ -100,6 +98,7 @@ import java.util.Date;
import java.util.HashMap;
+import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -378,7 +377,7 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
} else if (sysDept.getLevel() == 4) {
// 二级CSO
- if (StringUtils.isNotBlank(wmScorePackage.getDrugEntId())) {
+ if (Objects.nonNull(wmScorePackage.getDrugEntId())) {
// 通过drugEntId为空,判断是否为药企发来的包,即药企->一级CSO->二级CSO的包
// 药企->一级CSO->二级CSO的大包,只能由一级CSO提交报告审批,二级CSO在任务中心中,点击生成报告按钮应提示没有权限
return R.ok(0);
@@ -1761,8 +1760,8 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
wmTask.setLookintoDate(LocalDateTime.now());
wmTask.setCreateTime(LocalDateTime.now());
- wmTask.setDeptId(wmScorePackage1.getDeptId() + "");
- wmTask.setDrugEntId(wmScorePackage1.getDrugEntId() + "");
+ wmTask.setDeptId(wmScorePackage1.getDeptId());
+ wmTask.setDrugEntId(wmScorePackage1.getDrugEntId() );
wmTask.setTaskStatus("3");//审核通过
wmTask.setDelFlag("0");
wmTask.setEnableFlag("0");
@@ -1827,7 +1826,7 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
task.setEnableFlag(EnableEnum.ENABLE.val());
task.setTaskStatus(TaskStatusEnum.APPROVED.val());
wmTask.setDeptId(String.valueOf(scorePackage.getDeptId()));
- wmTask.setDrugEntId(String.valueOf(scorePackage.getDrugEntId()));
+ wmTask.setDrugEntId(scorePackage.getDrugEntId());
wmTask.setTaskFrom("2");
task.setCreateTime(now);
@@ -2123,8 +2122,8 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
//校验创建人结算信息税邦云信息是否配置完全
SysDeptSub sysDeptSub = sysDeptSubService.getOne(Wrappers.<SysDeptSub>lambdaQuery()
.eq(SysDeptSub::getDeptId, creator.getDeptId())
- .eq(SysDeptSub::getSubjectType, SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode())
+ //.eq(SysDeptSub::getSubjectType, SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode())
+ //.eq(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode())
);
if (null == sysDeptSub || StringUtils.isBlank(sysDeptSub.getAppId())) {
List<String> idList = sourceList.stream().map(CommonEvidenceDTO::getId).collect(Collectors.toList());
@@ -2212,7 +2211,7 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
preUserSettleAmountMap.put(user, tmp);
- errorInfo = checkoutSettleLimit(user, sysDeptSub.getLimitAmount(), tmp, scorePackage.getLocation() );
+ //errorInfo = checkoutSettleLimit(user, sysDeptSub.getLimitAmount(), tmp, scorePackage.getLocation() );
if (StringUtils.isNotEmpty(errorInfo)) {
log.error(errorInfo);
errorMap(errorMap, errorInfo, commonEvidenceDTO.getId());
@@ -2240,68 +2239,7 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
- * 校验结算限制
- * @param user 被校验者
- * @param limitAmount 限制金额
- * @param settleAmount 本次上传证据链累计金额
- * @return 校验错误信息,如果没有错误返回{@code null}
- private String checkoutSettleLimit(SysUser user, BigDecimal limitAmount, BigDecimal settleAmount, SubjectLocation location) {
- String info = null;
- List<SettleAmountMonitorOutput> monitorOutputList = sysDeptSubService.getSettleAmountMonitor(Collections.singletonList(user.getIdCardNumber()), null, location);
- List<SettleAmountMonitorOutput> yaoyiAmountMonitor = sysDeptSubService.getYaoyiAmountMonitor(Collections.singletonList(user.getIdCardNumber()), null, location);
- List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(Collections.singleton(user.getUserId()), null, location);
- MonitoringIndicator monitoringIndicator = monitoringIndicatorService.locationLimit(location);
- .equals(user.getIdCardNumber())).findFirst().orElse(null);
- .equals(String.valueOf(user.getUserId()))).findFirst().orElse(null);
- BigDecimal yaoyiMonitoringLimit = monitoringIndicator.getYaoyiLimitAmount();
- BigDecimal monitorAmount = settleAmount;
- BigDecimal deptMonitorAmount = settleAmount;
- BigDecimal yaoyiMonitorAmount = settleAmount;
- if (null != limitAmount) {
- if (deptMonitorAmount.compareTo(limitAmount) > 0) {
- info = "超过当月限额";
- if (null != monitoringLimit) {
- if (monitorAmount.compareTo(monitoringLimit) > 0) {
- info = "超过结算渠道限额";
- if (null != yaoyiMonitoringLimit) {
- if (yaoyiMonitorAmount.compareTo(yaoyiMonitoringLimit) > 0) {
- info = "超过平台限额";
- return info;
* 积分包信息校验
@@ -28,7 +28,7 @@ private final WmTaskTypeEntRefMapper wmTaskTypeEntRefMapper;
- public List<WmTaskTypeEntRef> selectByAgentId(String agentId) {
+ public List<WmTaskTypeEntRef> selectByAgentId(Integer agentId) {
return wmTaskTypeEntRefMapper.selectByAgentId(agentId);
@@ -74,7 +74,7 @@ public class WmWkArticleShareServiceImpl extends ServiceImpl<WmWkArticleShareMap
WmTaskType wmTaskType1=wmTaskTypeService.getById(taskTypeId);
- wmTaskType.setTaskEntId(sysDept.getLevel2Id()+"");
+ wmTaskType.setTaskEntId(sysDept.getLevel2Id());
int socre=wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
System.out.println("获取任务得分:"+socre);
if(socre<0)
@@ -3,351 +3,353 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qunzhixinxi.hnqz.admin.mapper.WmDaAgentMapper">
- <resultMap id="wmDaAgentMap" type="com.qunzhixinxi.hnqz.admin.api.entity.WmDaAgent">
- <id property="id" column="id"/>
- <result property="gsmc" column="gsmc"/>
- <result property="yyzz" column="yyzz"/>
- <result property="sbjnzm" column="sbjnzm"/>
- <result property="frsfzzmZm" column="frsfzzm_zm"/>
- <result property="frsfzzmBm" column="frsfzzm_bm"/>
- <result property="frsfzzmSc" column="frsfzzm_sc"/>
- <result property="zjType" column="zj_type"/>
- <result property="zjNumber" column="zj_number"/>
- <result property="jsAccount" column="js_account"/>
- <result property="isExamine" column="is_examine"/>
- <result property="extDrugEnt" column="ext_drug_ent"/>
- <result property="temp1" column="temp1"/>
- <result property="temp2" column="temp2"/>
- <result property="deptId" column="dept_id"/>
- <result property="delFlag" column="del_flag"/>
- <result property="enableFlag" column="enable_flag"/>
- <result property="tenantId" column="tenant_id"/>
- <result property="createTime" column="create_time"/>
- <result property="createUser" column="create_user"/>
- <result property="updateTime" column="update_time"/>
- <result property="updateUser" column="update_user"/>
- <result property="drugEntId" column="drug_ent_id"/>
- <result property="pgqx" column="pgqx"/>
- <result property="qylx" column="qylx"/>
- <result property="management" column="management"/>
- </resultMap>
- <insert id="insert1" parameterType="com.qunzhixinxi.hnqz.admin.api.entity.WmDaAgent" >
- insert into wm_da_agent (gsmc, yyzz,
- sbjnzm, frsfzzm_zm, frsfzzm_bm,
- frsfzzm_sc, zj_type, zj_number,
- js_account, is_examine, ext_drug_ent,
- temp1, temp2, dept_id,
- del_flag, enable_flag, tenant_id,
- create_time, create_user, update_time,
- update_user, drug_ent_id, pgqx, qylx
- )
- values (#{gsmc,jdbcType=VARCHAR}, #{yyzz,jdbcType=VARCHAR},
- #{sbjnzm,jdbcType=VARCHAR}, #{frsfzzmZm,jdbcType=VARCHAR}, #{frsfzzmBm,jdbcType=VARCHAR},
- #{frsfzzmSc,jdbcType=VARCHAR}, #{zjType,jdbcType=VARCHAR}, #{zjNumber,jdbcType=VARCHAR},
- #{jsAccount,jdbcType=VARCHAR}, #{isExamine,jdbcType=VARCHAR}, #{extDrugEnt,jdbcType=VARCHAR},
- #{temp1,jdbcType=VARCHAR}, #{temp2,jdbcType=VARCHAR}, #{deptId,jdbcType=VARCHAR},
- #{delFlag,jdbcType=VARCHAR}, #{enableFlag,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},#{createTime,jdbcType=VARCHAR},
- #{createUser,jdbcType=BIGINT}, #{updateTime,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR},
- #{drugEntId,jdbcType=VARCHAR}, #{pgqx,jdbcType=VARCHAR}, #{qylx,jdbcType=VARCHAR}
- </insert>
- <!-- 分页查询派工企业 -->
- <select id="selectWmManagementPage" resultMap="wmDaAgentMap">
- SELECT distinct
- a.*, d.dept_permissions, d.level as dept_level, d.financial_review_type
- FROM wm_da_agent a
- LEFT JOIN sys_dept d ON d.dept_id = a.dept_id
- <if test="query.csmUserIdList != null and query.csmUserIdList.size() > 0">
- left join sys_dept_csm dc on dc.dept_id = a.dept_id
- </if>
- <where>
- AND d.dept_id IS NOT NULL
- AND (d.level = 3 OR d.level = 4 OR d.level = 5)
- <if test="query.gsmc != null and query.gsmc !=''">
- AND gsmc LIKE CONCAT('%',#{query.gsmc},'%')
- <if test="query.zjNumber != null and query.zjNumber !=''">
- AND zj_number LIKE CONCAT('%',#{query.zjNumber},'%')
- <if test="query.pgqx != null and query.pgqx!=''">
- AND pgqx = #{query.pgqx,jdbcType=VARCHAR}
- <if test="query.updateTime != null and query.updateTime !=''">
- AND update_time = #{query.updateTime,jdbcType=VARCHAR}
- <if test="query.createTime != null and query.createTime!='' ">
- AND create_time = #{query.createTime,jdbcType=VARCHAR}
- <if test="query.yyzz != null and query.yyzz!='' ">
- AND yyzz = #{query.yyzz,jdbcType=VARCHAR}
- <if test="query.sbjnzm != null and query.sbjnzm!='' ">
- AND sbjnzm = #{query.sbjnzm,jdbcType=VARCHAR}
- <if test="query.frsfzzmZm != null and query.frsfzzmZm!='' ">
- AND frsfzzm_zm = #{query.frsfzzmZm,jdbcType=VARCHAR}
- <if test="query.frsfzzmBm != null and query.frsfzzmBm!='' ">
- AND frsfzzm_bm = #{query.frsfzzmBm,jdbcType=VARCHAR}
- <if test="query.frsfzzmSc != null and query.frsfzzmSc!=''">
- AND frsfzzm_sc = #{query.frsfzzmSc,jdbcType=VARCHAR}
- <if test="query.extDrugEnt != null and query.extDrugEnt!=''">
- AND ext_drug_ent = #{query.extDrugEnt,jdbcType=VARCHAR}
- <if test="query.qylx != null and query.qylx!=''">
- AND qylx = #{query.qylx,jdbcType=VARCHAR}
- and dc.user_id in (
- <foreach collection="query.csmUserIdList" item="userId" index="index" separator=",">
- #{userId}
- </foreach>
- </where>
- ORDER BY id DESC
- </select>
- <select id="selectWmManagementList" resultMap="wmDaAgentMap">
- select
- from wm_da_agent where 1=1
- AND gsmc like CONCAT('%',#{query.gsmc},'%')
- AND zj_number like CONCAT('%',#{query.zjNumber},'%')
- order by id desc
- <select id="selectExtDrugEntList" resultMap="wmDaAgentMap">
- ext_drug_ent
- from wm_da_agent
- where
- gsmc = #{query.gsmc,jdbcType=VARCHAR}
- <select id="selectByGsmcList" resultMap="wmDaAgentMap">
- <select id="selectByGsmc" resultMap="wmDaAgentMap">
- <select id="selectDeptId" resultMap="wmDaAgentMap">
- a.*, d.dept_permissions
- from wm_da_agent a
- left join sys_dept d
- on a.dept_id = d.dept_id
- a.dept_id = #{deptId,jdbcType=VARCHAR}
- <select id="selectDeptId1" resultType="java.util.HashMap">
- cast(id as char) as id,gsmc as name
- dept_id = #{deptId,jdbcType=VARCHAR}
- <select id="selectExtDrugEnt" resultMap="wmDaAgentMap">
- ext_drug_ent = #{extDrugEnt,jdbcType=VARCHAR}
- <select id="selectByDeptId" resultMap="wmDaAgentMap" parameterType="java.lang.String">
- where dept_id = #{deptId,jdbcType=VARCHAR}
- <select id="selectByDeptIds" resultMap="wmDaAgentMap" parameterType="java.lang.Integer">
- <select id="selectByDrugIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
- select d.*
- from wm_da_agent d
- left join wm_relation r on r.down_id=d.id
- where r.up_id = #{upId,jdbcType=INTEGER}
- UNION
- select * from wm_da_agent where id= #{Id,jdbcType=INTEGER}
- <select id="selectByDrugId" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
- select d.id,d.gsmc
- left join wm_da_drug_ent o on r.up_id=o.id
- select id,entname from wm_da_drug_ent where id= #{Id,jdbcType=INTEGER}
- <select id="selectByRelationId" resultMap="wmDaAgentMap" parameterType="java.lang.Integer">
- select *
- from
- wm_da_agent
- where id= #{Id,jdbcType=INTEGER}
- <select id="selectByRelationIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
- left join wm_relation r on r.down_id=d.dept_id
- <select id="selectEntNameByDrugIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
- select d.id,d.entname
- from wm_da_drug_ent d
- select id,gsmc from wm_da_agent where id= #{Id,jdbcType=INTEGER}
- <select id="selectByUserDeptId" resultMap="wmDaAgentMap" parameterType="java.lang.Integer">
- <select id="selectWmDaDrugEntByDeptIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
- select * from wm_da_agent where dept_id= #{deptId,jdbcType=VARCHAR}
- <select id="selectWmDaDrugEntByDeptId" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
- left join wm_da_drug_ent o on r.up_id=o.dept_id
- select id,entname from wm_da_drug_ent where dept_id= #{deptId,jdbcType=INTEGER}
- <select id="selectWmDaAgentByRelationId" resultMap="wmDaAgentMap" parameterType="java.lang.Integer">
- where dept_id= #{deptId,jdbcType=INTEGER}
- <select id="selectWmDaAgentByRelationIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
- <select id="selectWmDaAgentByDeptId" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
- select d.id,d.gsmc,d.enable_flag
- select id,entname,enable_flag from wm_da_drug_ent where dept_id= #{deptId,jdbcType=INTEGER}
- <select id="selectWmDaAgentByDeptIds" resultMap="wmDaAgentMap" parameterType="java.lang.String">
- where dept_id= #{deptId,jdbcType=VARCHAR}
- <!-- 根据sys_dept表的level字段查询 -->
- <select id="listAgentByDeptLevel" resultMap="wmDaAgentMap">
- SELECT a.*
- WHERE a.del_flag = 0
- AND a.enable_flag = 0
- AND d.level = #{deptLevel}
- <!-- 根据deptRelation查询 -->
- <select id="listAgentByDeptRelation" resultMap="wmDaAgentMap">
- SELECT
- FROM
- wm_da_agent a
- LEFT JOIN sys_dept_relation r ON r.descendant = a.dept_id
- WHERE
- r.ancestor = #{deptId, jdbcType=INTEGER}
+ <resultMap id="wmDaAgentMap" type="com.qunzhixinxi.hnqz.admin.api.entity.WmDaAgent">
+ <id property="id" column="id"/>
+ <result property="gsmc" column="gsmc"/>
+ <result property="yyzz" column="yyzz"/>
+ <result property="sbjnzm" column="sbjnzm"/>
+ <result property="frsfzzmZm" column="frsfzzm_zm"/>
+ <result property="frsfzzmBm" column="frsfzzm_bm"/>
+ <result property="frsfzzmSc" column="frsfzzm_sc"/>
+ <result property="zjType" column="zj_type"/>
+ <result property="zjNumber" column="zj_number"/>
+ <result property="jsAccount" column="js_account"/>
+ <result property="isExamine" column="is_examine"/>
+ <result property="extDrugEnt" column="ext_drug_ent"/>
+ <result property="temp1" column="temp1"/>
+ <result property="temp2" column="temp2"/>
+ <result property="deptId" column="dept_id"/>
+ <result property="delFlag" column="del_flag"/>
+ <result property="enableFlag" column="enable_flag"/>
+ <result property="tenantId" column="tenant_id"/>
+ <result property="createTime" column="create_time"/>
+ <result property="createUser" column="create_user"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="updateUser" column="update_user"/>
+ <result property="drugEntId" column="drug_ent_id"/>
+ <result property="pgqx" column="pgqx"/>
+ <result property="qylx" column="qylx"/>
+ <result property="management" column="management"/>
+ </resultMap>
+ <insert id="insert1" parameterType="com.qunzhixinxi.hnqz.admin.api.entity.WmDaAgent">
+ insert into wm_da_agent (gsmc, yyzz,
+ sbjnzm, frsfzzm_zm, frsfzzm_bm,
+ frsfzzm_sc, zj_type, zj_number,
+ js_account, is_examine, ext_drug_ent,
+ temp1, temp2, dept_id,
+ del_flag, enable_flag, tenant_id,
+ create_time, create_user, update_time,
+ update_user, drug_ent_id, pgqx, qylx
+ )
+ values (#{gsmc,jdbcType=VARCHAR}, #{yyzz,jdbcType=VARCHAR},
+ #{sbjnzm,jdbcType=VARCHAR}, #{frsfzzmZm,jdbcType=VARCHAR}, #{frsfzzmBm,jdbcType=VARCHAR},
+ #{frsfzzmSc,jdbcType=VARCHAR}, #{zjType,jdbcType=VARCHAR}, #{zjNumber,jdbcType=VARCHAR},
+ #{jsAccount,jdbcType=VARCHAR}, #{isExamine,jdbcType=VARCHAR}, #{extDrugEnt,jdbcType=VARCHAR},
+ #{temp1,jdbcType=VARCHAR}, #{temp2,jdbcType=VARCHAR}, #{deptId,jdbcType=VARCHAR},
+ #{delFlag,jdbcType=VARCHAR}, #{enableFlag,jdbcType=VARCHAR},
+ #{tenantId,jdbcType=BIGINT},#{createTime,jdbcType=VARCHAR},
+ #{createUser,jdbcType=BIGINT}, #{updateTime,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR},
+ #{drugEntId,jdbcType=VARCHAR}, #{pgqx,jdbcType=VARCHAR}, #{qylx,jdbcType=VARCHAR}
+ </insert>
+ <!-- 分页查询派工企业 -->
+ <select id="selectWmManagementPage" resultMap="wmDaAgentMap">
+ SELECT distinct
+ a.*, d.dept_permissions, d.level as dept_level, d.financial_review_type
+ FROM wm_da_agent a
+ LEFT JOIN sys_dept d ON d.dept_id = a.dept_id
+ <if test="query.csmUserIdList != null and query.csmUserIdList.size() > 0">
+ left join sys_dept_csm dc on dc.dept_id = a.dept_id
+ </if>
+ <where>
+ AND d.dept_id IS NOT NULL
+ AND (d.level = 3 OR d.level = 4 OR d.level = 5)
+ <if test="query.gsmc != null and query.gsmc !=''">
+ AND gsmc LIKE CONCAT('%',#{query.gsmc},'%')
+ <if test="query.zjNumber != null and query.zjNumber !=''">
+ AND zj_number LIKE CONCAT('%',#{query.zjNumber},'%')
+ <if test="query.pgqx != null and query.pgqx!=''">
+ AND pgqx = #{query.pgqx,jdbcType=VARCHAR}
+ <if test="query.updateTime != null and query.updateTime !=''">
+ AND update_time = #{query.updateTime,jdbcType=VARCHAR}
+ <if test="query.createTime != null and query.createTime!='' ">
+ AND create_time = #{query.createTime,jdbcType=VARCHAR}
+ <if test="query.yyzz != null and query.yyzz!='' ">
+ AND yyzz = #{query.yyzz,jdbcType=VARCHAR}
+ <if test="query.sbjnzm != null and query.sbjnzm!='' ">
+ AND sbjnzm = #{query.sbjnzm,jdbcType=VARCHAR}
+ <if test="query.frsfzzmZm != null and query.frsfzzmZm!='' ">
+ AND frsfzzm_zm = #{query.frsfzzmZm,jdbcType=VARCHAR}
+ <if test="query.frsfzzmBm != null and query.frsfzzmBm!='' ">
+ AND frsfzzm_bm = #{query.frsfzzmBm,jdbcType=VARCHAR}
+ <if test="query.frsfzzmSc != null and query.frsfzzmSc!=''">
+ AND frsfzzm_sc = #{query.frsfzzmSc,jdbcType=VARCHAR}
+ <if test="query.extDrugEnt != null and query.extDrugEnt!=''">
+ AND ext_drug_ent = #{query.extDrugEnt,jdbcType=VARCHAR}
+ <if test="query.qylx != null and query.qylx!=''">
+ AND qylx = #{query.qylx,jdbcType=VARCHAR}
+ and dc.user_id in (
+ <foreach collection="query.csmUserIdList" item="userId" index="index" separator=",">
+ #{userId}
+ </foreach>
+ </where>
+ ORDER BY id DESC
+ </select>
+ <select id="selectWmManagementList" resultMap="wmDaAgentMap">
+ select
+ from wm_da_agent where 1=1
+ AND gsmc like CONCAT('%',#{query.gsmc},'%')
+ AND zj_number like CONCAT('%',#{query.zjNumber},'%')
+ order by id desc
+ <select id="selectExtDrugEntList" resultMap="wmDaAgentMap">
+ ext_drug_ent
+ from wm_da_agent
+ where
+ gsmc = #{query.gsmc,jdbcType=VARCHAR}
+ <select id="selectByGsmcList" resultMap="wmDaAgentMap">
+ <select id="selectByGsmc" resultMap="wmDaAgentMap">
+ <select id="selectDeptId" resultMap="wmDaAgentMap">
+ a.*, d.dept_permissions
+ from wm_da_agent a
+ left join sys_dept d
+ on a.dept_id = d.dept_id
+ a.dept_id = #{deptId,jdbcType=VARCHAR}
+ <select id="selectDeptId1" resultType="map">
+ id,
+ gsmc as name
+ dept_id = #{deptId}
+ <select id="selectExtDrugEnt" resultMap="wmDaAgentMap">
+ ext_drug_ent = #{extDrugEnt,jdbcType=VARCHAR}
+ <select id="selectByDeptId" resultMap="wmDaAgentMap" parameterType="java.lang.String">
+ where dept_id = #{deptId,jdbcType=VARCHAR}
+ <select id="selectByDeptIds" resultMap="wmDaAgentMap" parameterType="java.lang.Integer">
+ <select id="selectByDrugIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
+ select d.*
+ from wm_da_agent d
+ left join wm_relation r on r.down_id=d.id
+ where r.up_id = #{upId,jdbcType=INTEGER}
+ UNION
+ select * from wm_da_agent where id= #{Id,jdbcType=INTEGER}
+ <select id="selectByDrugId" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
+ select d.id,d.gsmc
+ left join wm_da_drug_ent o on r.up_id=o.id
+ select id,entname from wm_da_drug_ent where id= #{Id,jdbcType=INTEGER}
+ <select id="selectByRelationId" resultMap="wmDaAgentMap" parameterType="java.lang.Integer">
+ select *
+ from
+ wm_da_agent
+ where id= #{Id,jdbcType=INTEGER}
+ <select id="selectByRelationIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
+ left join wm_relation r on r.down_id=d.dept_id
+ <select id="selectEntNameByDrugIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
+ select d.id,d.entname
+ from wm_da_drug_ent d
+ select id,gsmc from wm_da_agent where id= #{Id,jdbcType=INTEGER}
+ <select id="selectByUserDeptId" resultMap="wmDaAgentMap" parameterType="java.lang.Integer">
+ <select id="selectWmDaDrugEntByDeptIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
+ select * from wm_da_agent where dept_id= #{deptId,jdbcType=VARCHAR}
+ <select id="selectWmDaDrugEntByDeptId" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
+ left join wm_da_drug_ent o on r.up_id=o.dept_id
+ select id,entname from wm_da_drug_ent where dept_id= #{deptId,jdbcType=INTEGER}
+ <select id="selectWmDaAgentByRelationId" resultMap="wmDaAgentMap" parameterType="java.lang.Integer">
+ where dept_id= #{deptId,jdbcType=INTEGER}
+ <select id="selectWmDaAgentByRelationIds" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
+ <select id="selectWmDaAgentByDeptId" resultMap="wmDaAgentMap" parameterType="java.util.HashMap">
+ select d.id,d.gsmc,d.enable_flag
+ select id,entname,enable_flag from wm_da_drug_ent where dept_id= #{deptId,jdbcType=INTEGER}
+ <select id="selectWmDaAgentByDeptIds" resultMap="wmDaAgentMap" parameterType="java.lang.String">
+ where dept_id= #{deptId,jdbcType=VARCHAR}
+ <!-- 根据sys_dept表的level字段查询 -->
+ <select id="listAgentByDeptLevel" resultMap="wmDaAgentMap">
+ SELECT a.*
+ WHERE a.del_flag = 0
+ AND a.enable_flag = 0
+ AND d.level = #{deptLevel}
+ <!-- 根据deptRelation查询 -->
+ <select id="listAgentByDeptRelation" resultMap="wmDaAgentMap">
+ SELECT
+ FROM
+ wm_da_agent a
+ LEFT JOIN sys_dept_relation r ON r.descendant = a.dept_id
+ WHERE
+ r.ancestor = #{deptId, jdbcType=INTEGER}
</mapper>
@@ -4,184 +4,186 @@
<mapper namespace="com.qunzhixinxi.hnqz.admin.mapper.WmDaDrugEntMapper">
- <resultMap id="wmDaDrugEntMap" type="com.qunzhixinxi.hnqz.admin.api.entity.WmDaDrugEnt">
- <result property="entname" column="entname"/>
- <result property="entcode" column="entcode"/>
- <result property="temp3" column="temp3"/>
- <result property="temp4" column="temp4"/>
- <!-- 分页查询 -->
- <select id="selectPage" resultMap="wmDaDrugEntMap">
- e.id,
- e.entname,
- e.entcode,
- e.temp1,
- e.temp2,
- e.temp3,
- e.temp4,
- e.dept_id,
- e.del_flag,
- e.enable_flag,
- e.tenant_id,
- e.create_time,
- e.create_user,
- e.update_time,
- e.update_user,
- e.pgqx,
- e.management,
- e.subject_type,
- d.dept_permissions,
- d.financial_review_type
- FROM wm_da_drug_ent e LEFT JOIN sys_dept d ON e.dept_id = d.dept_id
- left join sys_dept_csm dc on dc.dept_id = e.dept_id
- <if test="query.entname != null and query.entname != ''">
- AND e.entname LIKE CONCAT('%', #{query.entname, jdbcType=VARCHAR}, '%')
- <if test="query.entcode != null and query.entcode != ''">
- AND e.entcode = #{query.entcode, jdbcType=VARCHAR}
- ORDER BY e.create_time DESC
- <select id="selectByDrugId" resultType="java.lang.Integer" parameterType="java.util.HashMap">
- select o.entname,d.gsmc
- from wm_relation r
- left join wm_da_agent d on r.up_id=d.id
- <select id="selectEntNameByDrugId" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
- id,dept_id,entname
- from wm_da_drug_ent
- id = #{id,jdbcType=VARCHAR}
-</select>
- <select id="selectEntNameByDrugIds" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
- select d.id,d.entname,d.dept_id
- left join wm_relation r on r.up_id=d.id
- left join wm_da_agent o on r.down_id=o.id
- where r.down_id = #{downId,jdbcType=INTEGER}
- select id,gsmc,dept_id from wm_da_agent where id= #{Id,jdbcType=INTEGER}
- <select id="selectByDeptId" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
- <select id="selectByUserDeptId" resultType="java.util.HashMap" parameterType="java.lang.Integer">
- id,entname as gsmc,entcode as zjNumber,management
- <select id="selectDeptId" resultMap="wmDaDrugEntMap">
- dept_id = #{deptId,jdbcType=INTEGER}
- cast(id as char) as id,entname as name
- <select id="selectId" resultMap="wmDaDrugEntMap">
- id = #{id,jdbcType=BIGINT}
- <select id="selectEntNameByDeptId" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
- <select id="selectEntNameByByDeptIds" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
- left join wm_relation r on r.up_id=d.dept_id
- left join wm_da_agent o on r.down_id=o.dept_id
- select id,gsmc,dept_id from wm_da_agent where dept_id= #{deptId,jdbcType=VARCHAR}
- <select id="getListByCsoDeptId" resultMap="wmDaDrugEntMap" >
- SELECT DISTINCT
- wm_da_drug_ent
- dept_id IN (
- up_id
- wm_relation
- down_id = #{deptId,jdbcType=INTEGER}
- down_id IN (
+ <resultMap id="wmDaDrugEntMap" type="com.qunzhixinxi.hnqz.admin.api.entity.WmDaDrugEnt">
+ <result property="entname" column="entname"/>
+ <result property="entcode" column="entcode"/>
+ <result property="temp3" column="temp3"/>
+ <result property="temp4" column="temp4"/>
+ <!-- 分页查询 -->
+ <select id="selectPage" resultMap="wmDaDrugEntMap">
+ e.id,
+ e.entname,
+ e.entcode,
+ e.temp1,
+ e.temp2,
+ e.temp3,
+ e.temp4,
+ e.dept_id,
+ e.del_flag,
+ e.enable_flag,
+ e.tenant_id,
+ e.create_time,
+ e.create_user,
+ e.update_time,
+ e.update_user,
+ e.pgqx,
+ e.management,
+ e.subject_type,
+ d.dept_permissions,
+ d.financial_review_type
+ FROM wm_da_drug_ent e LEFT JOIN sys_dept d ON e.dept_id = d.dept_id
+ left join sys_dept_csm dc on dc.dept_id = e.dept_id
+ <if test="query.entname != null and query.entname != ''">
+ AND e.entname LIKE CONCAT('%', #{query.entname, jdbcType=VARCHAR}, '%')
+ <if test="query.entcode != null and query.entcode != ''">
+ AND e.entcode = #{query.entcode, jdbcType=VARCHAR}
+ ORDER BY e.create_time DESC
+ <select id="selectByDrugId" resultType="java.lang.Integer" parameterType="java.util.HashMap">
+ select o.entname,d.gsmc
+ from wm_relation r
+ left join wm_da_agent d on r.up_id=d.id
+ <select id="selectEntNameByDrugId" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
+ id,dept_id,entname
+ from wm_da_drug_ent
+ id = #{id,jdbcType=VARCHAR}
+ <select id="selectEntNameByDrugIds" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
+ select d.id,d.entname,d.dept_id
+ left join wm_relation r on r.up_id=d.id
+ left join wm_da_agent o on r.down_id=o.id
+ where r.down_id = #{downId,jdbcType=INTEGER}
+ select id,gsmc,dept_id from wm_da_agent where id= #{Id,jdbcType=INTEGER}
+ <select id="selectByDeptId" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
+ dept_id = #{deptId,jdbcType=VARCHAR}
+ <select id="selectByUserDeptId" resultType="java.util.HashMap" parameterType="java.lang.Integer">
+ id,entname as gsmc,entcode as zjNumber,management
+ <select id="selectDeptId" resultMap="wmDaDrugEntMap">
+ dept_id = #{deptId,jdbcType=INTEGER}
+ <!--cast(id as char) as id,entname as name-->
+ entname as name
+ <select id="selectId" resultMap="wmDaDrugEntMap">
+ id = #{id,jdbcType=BIGINT}
+ <select id="selectEntNameByDeptId" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
+ <select id="selectEntNameByByDeptIds" resultMap="wmDaDrugEntMap" parameterType="java.util.HashMap">
+ left join wm_relation r on r.up_id=d.dept_id
+ left join wm_da_agent o on r.down_id=o.dept_id
+ select id,gsmc,dept_id from wm_da_agent where dept_id= #{deptId,jdbcType=VARCHAR}
+ <select id="getListByCsoDeptId" resultMap="wmDaDrugEntMap">
+ SELECT DISTINCT
+ wm_da_drug_ent
+ dept_id IN (
+ up_id
+ wm_relation
+ down_id = #{deptId,jdbcType=INTEGER}
+ down_id IN (
@@ -1,83 +1,80 @@
-package com.qunzhixinxi.hnqz.admin;
-import cn.hutool.core.codec.Base64;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
-import com.qunzhixinxi.hnqz.admin.api.entity.SysUserExtRecord;
-import com.qunzhixinxi.hnqz.admin.api.entity.SysUserSub;
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.DelEnum;
-import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
-import com.qunzhixinxi.hnqz.admin.service.SysUserExtRecordService;
-import com.qunzhixinxi.hnqz.admin.service.SysUserService;
-import com.qunzhixinxi.hnqz.admin.service.SysUserSubService;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.io.File;
-import java.util.Set;
- * 图片base64测试类
- * @date 2023/10/27
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = {HnqzAdminApplication.class})
-public class ImgBase64Test {
- @Autowired
- private SysUserSubService sysUserSubService;
- private SysUserExtRecordService sysUserExtRecordService;
- private SysDeptService sysDeptService;
-// @Test
- public void base64ToImgtest() {
- List<SysUserSub> userSubList = sysUserSubService.list(Wrappers.<SysUserSub>lambdaQuery()
- .eq(SysUserSub::getCertStatus, 1)
- .eq(SysUserSub::getSubjectLocation, SubjectLocation.HUI_QI_YUN));
- Set<Integer> userIds = userSubList.stream().map(SysUserSub::getUserId).collect(Collectors.toSet());
- List<SysUserExtRecord> userExtRecordList = sysUserExtRecordService.list(Wrappers.<SysUserExtRecord>lambdaQuery()
- .in(SysUserExtRecord::getUserId, userIds)
- .eq(SysUserExtRecord::getDelFlag, DelEnum.NOT_DEL.val())
- .select(SysUserExtRecord::getIdCardFrontBase64, SysUserExtRecord::getIdCardBackBase64, SysUserExtRecord::getDeptId,
- SysUserExtRecord::getRealName, SysUserExtRecord::getIdCardNumber));
- userExtRecordList.forEach(sysUserExtRecord -> {
- SysDept sysDept = sysDeptService.getById(sysUserExtRecord.getDeptId());
- String parentFileName = String.format("D:\\li312\\Desktop\\huiqiyun_cert_user\\%s", sysDept.getName());
- File parentFile = new File(parentFileName);
- if (!parentFile.exists()) {
- parentFile.mkdirs();
- String frontFileName = String.format("%s\\%s_%s_front.jpg",
- parentFileName, sysUserExtRecord.getRealName(), sysUserExtRecord.getIdCardNumber());
- System.out.println("frontFileName: " + frontFileName);
- File frontFile = new File(frontFileName);
- Base64.decodeToFile(sysUserExtRecord.getIdCardFrontBase64(), frontFile);
- String backFileName = String.format("%s\\%s_%s_back.jpg",
- System.out.println("backFileName: " + backFileName);
- File backFile = new File(backFileName);
- Base64.decodeToFile(sysUserExtRecord.getIdCardBackBase64(), backFile);
+//package com.qunzhixinxi.hnqz.admin;
+//
+//import cn.hutool.core.codec.Base64;
+//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+//import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
+//import com.qunzhixinxi.hnqz.admin.api.entity.SysUserExtRecord;
+//import com.qunzhixinxi.hnqz.admin.api.entity.SysUserSub;
+//import com.qunzhixinxi.hnqz.admin.api.constant.enums.DelEnum;
+//import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
+//import com.qunzhixinxi.hnqz.admin.service.SysUserExtRecordService;
+//import com.qunzhixinxi.hnqz.admin.service.SysUserSubService;
+//import org.junit.runner.RunWith;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.boot.test.context.SpringBootTest;
+//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+//import java.io.File;
+//import java.util.List;
+//import java.util.Set;
+//import java.util.stream.Collectors;
+///**
+// * 图片base64测试类
+// *
+// * @author lixuesong
+// * @date 2023/10/27
+// */
+//@RunWith(SpringJUnit4ClassRunner.class)
+//@SpringBootTest(classes = {HnqzAdminApplication.class})
+//public class ImgBase64Test {
+// @Autowired
+// private SysUserSubService sysUserSubService;
+// private SysUserExtRecordService sysUserExtRecordService;
+// private SysDeptService sysDeptService;
+//// @Test
+// public void base64ToImgtest() {
+// List<SysUserSub> userSubList = sysUserSubService.list(Wrappers.<SysUserSub>lambdaQuery()
+// .eq(SysUserSub::getCertStatus, 1)
+// //.eq(SysUserSub::getSubjectLocation, SubjectLocation.HUI_QI_YUN));
+// Set<Integer> userIds = userSubList.stream().map(SysUserSub::getUserId).collect(Collectors.toSet());
+// List<SysUserExtRecord> userExtRecordList = sysUserExtRecordService.list(Wrappers.<SysUserExtRecord>lambdaQuery()
+// .in(SysUserExtRecord::getUserId, userIds)
+// .eq(SysUserExtRecord::getDelFlag, DelEnum.NOT_DEL.val())
+// .select(SysUserExtRecord::getIdCardFrontBase64, SysUserExtRecord::getIdCardBackBase64, SysUserExtRecord::getDeptId,
+// SysUserExtRecord::getRealName, SysUserExtRecord::getIdCardNumber));
+// userExtRecordList.forEach(sysUserExtRecord -> {
+// SysDept sysDept = sysDeptService.getById(sysUserExtRecord.getDeptId());
+// String parentFileName = String.format("D:\\li312\\Desktop\\huiqiyun_cert_user\\%s", sysDept.getName());
+// File parentFile = new File(parentFileName);
+// if (!parentFile.exists()) {
+// parentFile.mkdirs();
+// }
+// String frontFileName = String.format("%s\\%s_%s_front.jpg",
+// parentFileName, sysUserExtRecord.getRealName(), sysUserExtRecord.getIdCardNumber());
+// System.out.println("frontFileName: " + frontFileName);
+// File frontFile = new File(frontFileName);
+// Base64.decodeToFile(sysUserExtRecord.getIdCardFrontBase64(), frontFile);
+// String backFileName = String.format("%s\\%s_%s_back.jpg",
+// System.out.println("backFileName: " + backFileName);
+// File backFile = new File(backFileName);
+// Base64.decodeToFile(sysUserExtRecord.getIdCardBackBase64(), backFile);
+// });
+//}
@@ -93,10 +93,10 @@ public class WmTaskTypeServiceTest {
newOne.setDurgentId(wmDaDrugEnt.getId());
newOne.setTaskTypeLevel("2");
newOne.setTaskEntId(wmDaDrugEnt.getId());
- newOne.setDeptId(wmDaDrugEnt.getDeptId());
+ newOne.setDeptId(wmDaDrugEnt.getDeptId().toString());
- newOne.setRuleId(wmDaDrugEnt.getId());
+ newOne.setRuleId(wmDaDrugEnt.getId().toString());
newOne.setTaskReceiverType(wmTaskType1.getTaskReceiverType());
List<WmTaskType> taskTypeList = wmTaskTypeMapper.selectList(Wrappers.<WmTaskType>lambdaQuery()
@@ -141,9 +141,9 @@ public class WmTaskTypeServiceTest {
newOne.setLevel1Id(wmDaAgent.getId());
- newOne.setRuleId(wmDaDrugEnt.getId() + wmDaAgent.getId());
+ newOne.setRuleId(""+wmDaDrugEnt.getId() + wmDaAgent.getId());
newOne.setTaskEntId(wmDaAgent.getId());
- newOne.setDeptId(wmDaAgent.getDeptId());
+ newOne.setDeptId(wmDaAgent.getDeptId().toString());
@@ -165,8 +165,8 @@ public class WmTaskTypeServiceTest {
- newOne.setRuleId(wmDaAgent.getId());
+ newOne.setRuleId(wmDaAgent.getId().toString());
newOne.setBaseId(wmTaskType2.getId());
newOne.setTaskReceiverType(wmTaskType2.getTaskReceiverType());
@@ -202,8 +202,8 @@ public class WmTaskTypeServiceTest {
newOne.setLevel1Id(wmDaAgent2.getId());
newOne.setTaskEntId(wmDaAgent2.getId());
- newOne.setRuleId(wmDaAgent2.getId());
- newOne.setDeptId(wmDaAgent2.getDeptId());
+ newOne.setRuleId(wmDaAgent2.getId().toString());
+ newOne.setDeptId(wmDaAgent2.getDeptId().toString());
@@ -252,8 +252,8 @@ public class WmTaskTypeServiceTest {
@@ -289,8 +289,8 @@ public class WmTaskTypeServiceTest {