Merge remote-tracking branch 'refs/remotes/origin/bd_test' into bd_online
This commit is contained in:
		
						commit
						6cc6f02c7b
					
				| 
						 | 
					@ -21,6 +21,7 @@ import java.math.BigDecimal;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 会员服务接口
 | 
					 * 会员服务接口
 | 
				
			||||||
| 
						 | 
					@ -443,4 +444,5 @@ public interface IMemberServiceApi {
 | 
				
			||||||
    R<Map<String, Long>> memberRegionMap(Date settleDate);
 | 
					    R<Map<String, Long>> memberRegionMap(Date settleDate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    R<List<CuMember>> getMemberByIds(Set<Long> memberIds);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,21 +4,21 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- 通用查询映射结果 -->
 | 
					    <!-- 通用查询映射结果 -->
 | 
				
			||||||
    <resultMap id="CuMemberAwards" type="com.hzs.common.domain.member.detail.CuMemberAwards">
 | 
					    <resultMap id="CuMemberAwards" type="com.hzs.common.domain.member.detail.CuMemberAwards">
 | 
				
			||||||
        <id column="PK_ID" property="pkId" />
 | 
					        <id column="PK_ID" property="pkId"/>
 | 
				
			||||||
        <result column="PK_MEMBER" property="pkMember" />
 | 
					        <result column="PK_MEMBER" property="pkMember"/>
 | 
				
			||||||
        <result column="PERIOD" property="period" />
 | 
					        <result column="PERIOD" property="period"/>
 | 
				
			||||||
        <result column="UP_TYPE" property="upType" />
 | 
					        <result column="UP_TYPE" property="upType"/>
 | 
				
			||||||
        <result column="OLD_LEVEL" property="oldLevel" />
 | 
					        <result column="OLD_LEVEL" property="oldLevel"/>
 | 
				
			||||||
        <result column="NEW_LEVEL" property="newLevel" />
 | 
					        <result column="NEW_LEVEL" property="newLevel"/>
 | 
				
			||||||
        <result column="PURCHASE_STATUS" property="purchaseStatus" />
 | 
					        <result column="PURCHASE_STATUS" property="purchaseStatus"/>
 | 
				
			||||||
        <result column="PK_ORDER" property="pkOrder" />
 | 
					        <result column="PK_ORDER" property="pkOrder"/>
 | 
				
			||||||
        <result column="REMARK" property="remark" />
 | 
					        <result column="REMARK" property="remark"/>
 | 
				
			||||||
        <result column="DEL_FLAG" property="delFlag" />
 | 
					        <result column="DEL_FLAG" property="delFlag"/>
 | 
				
			||||||
        <result column="CREATION_TIME" property="creationTime" />
 | 
					        <result column="CREATION_TIME" property="creationTime"/>
 | 
				
			||||||
        <result column="MODIFIED_TIME" property="modifiedTime" />
 | 
					        <result column="MODIFIED_TIME" property="modifiedTime"/>
 | 
				
			||||||
        <result column="PK_COUNTRY" property="pkCountry" />
 | 
					        <result column="PK_COUNTRY" property="pkCountry"/>
 | 
				
			||||||
        <result column="PK_CREATOR" property="pkCreator" />
 | 
					        <result column="PK_CREATOR" property="pkCreator"/>
 | 
				
			||||||
        <result column="PK_MODIFIED" property="pkModified" />
 | 
					        <result column="PK_MODIFIED" property="pkModified"/>
 | 
				
			||||||
    </resultMap>
 | 
					    </resultMap>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <insert id="saveBatchCuMemberAwards">
 | 
					    <insert id="saveBatchCuMemberAwards">
 | 
				
			||||||
| 
						 | 
					@ -60,7 +60,13 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- 删除自动升级的奖衔升级记录 -->
 | 
					    <!-- 删除自动升级的奖衔升级记录 -->
 | 
				
			||||||
    <delete id="deleteCuMemberAwards">
 | 
					    <delete id="deleteCuMemberAwards">
 | 
				
			||||||
 | 
					        update cu_member_awards
 | 
				
			||||||
 | 
					        set DEL_FLAG = 1,
 | 
				
			||||||
 | 
					        MODIFIED_TIME = sysdate
 | 
				
			||||||
 | 
					        where period = #{period} and up_type = 1
 | 
				
			||||||
 | 
					        <!--
 | 
				
			||||||
        delete from cu_member_awards where period = #{period} and up_type = 1
 | 
					        delete from cu_member_awards where period = #{period} and up_type = 1
 | 
				
			||||||
 | 
					        -->
 | 
				
			||||||
    </delete>
 | 
					    </delete>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <select id="queryLastCuMemberAwards" resultMap="CuMemberAwards">
 | 
					    <select id="queryLastCuMemberAwards" resultMap="CuMemberAwards">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,10 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.math.BigDecimal;
 | 
					import java.math.BigDecimal;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.*;
 | 
				
			||||||
import java.util.HashMap;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 会员涉及dubbo服务
 | 
					 * 会员涉及dubbo服务
 | 
				
			||||||
| 
						 | 
					@ -520,4 +517,9 @@ public class MemberServiceProvider implements IMemberServiceApi {
 | 
				
			||||||
        return R.ok(resultMap);
 | 
					        return R.ok(resultMap);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public R<List<CuMember>> getMemberByIds(Set<Long> memberIds) {
 | 
				
			||||||
 | 
					        return R.ok(iCuMemberService.getMemberByIds(memberIds));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,10 +23,7 @@ import com.hzs.member.share.param.ShareRegisterParam;
 | 
				
			||||||
import com.hzs.system.sys.dto.ApprovalBusinessResultDTO;
 | 
					import com.hzs.system.sys.dto.ApprovalBusinessResultDTO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.math.BigDecimal;
 | 
					import java.math.BigDecimal;
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.*;
 | 
				
			||||||
import java.util.Date;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 会员 服务类
 | 
					 * 会员 服务类
 | 
				
			||||||
| 
						 | 
					@ -1029,4 +1026,5 @@ public interface ICuMemberService extends IService<CuMember> {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void clearZeroMember();
 | 
					    void clearZeroMember();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    List<CuMember> getMemberByIds(Set<Long> memberIds);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3771,4 +3771,10 @@ public class CuMemberServiceImpl extends ServiceImpl<CuMemberMapper, CuMember> i
 | 
				
			||||||
        baseMapper.clearZeroMember();
 | 
					        baseMapper.clearZeroMember();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<CuMember> getMemberByIds(Set<Long> memberIds) {
 | 
				
			||||||
 | 
					        return baseMapper.selectList(new LambdaQueryWrapper<CuMember>()
 | 
				
			||||||
 | 
					                .in(CuMember::getPkId, memberIds));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,10 @@
 | 
				
			||||||
package com.hzs.activity.base.controller.api;
 | 
					package com.hzs.activity.base.controller.api;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.hutool.core.collection.CollectionUtil;
 | 
				
			||||||
import com.hzs.activity.base.param.ActivityParam;
 | 
					import com.hzs.activity.base.param.ActivityParam;
 | 
				
			||||||
 | 
					import com.hzs.activity.base.service.IAcBaseAuthorityService;
 | 
				
			||||||
import com.hzs.activity.base.service.IAcBaseConfigService;
 | 
					import com.hzs.activity.base.service.IAcBaseConfigService;
 | 
				
			||||||
 | 
					import com.hzs.common.core.enums.EActType;
 | 
				
			||||||
import com.hzs.common.core.web.controller.BaseController;
 | 
					import com.hzs.common.core.web.controller.BaseController;
 | 
				
			||||||
import com.hzs.common.core.web.page.TableDataInfo;
 | 
					import com.hzs.common.core.web.page.TableDataInfo;
 | 
				
			||||||
import com.hzs.common.domain.activity.base.AcBaseConfig;
 | 
					import com.hzs.common.domain.activity.base.AcBaseConfig;
 | 
				
			||||||
| 
						 | 
					@ -14,44 +17,51 @@ import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @description: 查询活动列表
 | 
					 * 查询活动列表
 | 
				
			||||||
 * @author: sui q
 | 
					 | 
				
			||||||
 * @time: 2023/4/27 09:15
 | 
					 | 
				
			||||||
 * @classname: ApiActivityController
 | 
					 | 
				
			||||||
 * @package_name: com.hzs.activity.base.controller.api
 | 
					 | 
				
			||||||
 * version 1.0.0
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@RestController
 | 
					@RestController
 | 
				
			||||||
@RequestMapping("/api/base")
 | 
					@RequestMapping("/api/base")
 | 
				
			||||||
public class ApiActivityController extends BaseController {
 | 
					public class ApiActivityController extends BaseController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private IAcBaseConfigService baseConfigService;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    public void setBaseConfigService(IAcBaseConfigService baseConfigService) {
 | 
					    private IAcBaseConfigService iAcBaseConfigService;
 | 
				
			||||||
        this.baseConfigService = baseConfigService;
 | 
					    @Autowired
 | 
				
			||||||
    }
 | 
					    private IAcBaseAuthorityService iAcBaseAuthorityService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * @description: 查询活动列表
 | 
					     * 查询活动列表
 | 
				
			||||||
     * @author: sui q
 | 
					 | 
				
			||||||
     * @date: 2023/4/21 17:33
 | 
					 | 
				
			||||||
     * @param: null null
 | 
					 | 
				
			||||||
     **/
 | 
					     **/
 | 
				
			||||||
    @GetMapping("/activity-list")
 | 
					    @GetMapping("/activity-list")
 | 
				
			||||||
    public TableDataInfo activityList() {
 | 
					    public TableDataInfo activityList() {
 | 
				
			||||||
        return getDataTable(baseConfigService.queryBaseConfigList(SecurityUtils.getPkCountry(), SecurityUtils.getUserId()));
 | 
					        Long pkMember = SecurityUtils.getUserId();
 | 
				
			||||||
 | 
					        String memberCode = SecurityUtils.getMemberCode();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<AcBaseConfigExt> resultList = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<AcBaseConfigExt> list = iAcBaseConfigService.queryBaseConfigList(SecurityUtils.getPkCountry(), SecurityUtils.getUserId());
 | 
				
			||||||
 | 
					        if (CollectionUtil.isNotEmpty(list)) {
 | 
				
			||||||
 | 
					            for (AcBaseConfigExt acBaseConfigExt : list) {
 | 
				
			||||||
 | 
					                if (EActType.DECLARATION_GIFT.getValue() == acBaseConfigExt.getActType()) {
 | 
				
			||||||
 | 
					                    // 报单赠送,需要处理权限
 | 
				
			||||||
 | 
					                    if (!iAcBaseAuthorityService.checkAuthority(pkMember, memberCode, acBaseConfigExt.getPkId())) {
 | 
				
			||||||
 | 
					                        continue;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                resultList.add(acBaseConfigExt);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        TableDataInfo tableDataInfo = getDataTable(list);
 | 
				
			||||||
 | 
					        tableDataInfo.setRows(resultList);
 | 
				
			||||||
 | 
					        return tableDataInfo;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * @description: 查询活动列表
 | 
					     *  查询活动列表
 | 
				
			||||||
     * @author: sui q
 | 
					 | 
				
			||||||
     * @date: 2023/4/21 17:33
 | 
					 | 
				
			||||||
     * @param: null null
 | 
					 | 
				
			||||||
     **/
 | 
					     **/
 | 
				
			||||||
    @PostMapping("/activity-detail")
 | 
					    @PostMapping("/activity-detail")
 | 
				
			||||||
    public TableDataInfo activityDetail(@RequestBody ActivityParam activityParam) {
 | 
					    public TableDataInfo activityDetail(@RequestBody ActivityParam activityParam) {
 | 
				
			||||||
        AcBaseConfigExt acBaseConfig = baseConfigService.queryBaseConfigDetail(activityParam.getPkId(), SecurityUtils.getPkCountry());
 | 
					        AcBaseConfigExt acBaseConfig = iAcBaseConfigService.queryBaseConfigDetail(activityParam.getPkId(), SecurityUtils.getPkCountry());
 | 
				
			||||||
        List<AcBaseConfig> acBaseConfigList = new ArrayList<>();
 | 
					        List<AcBaseConfig> acBaseConfigList = new ArrayList<>();
 | 
				
			||||||
        acBaseConfigList.add(acBaseConfig);
 | 
					        acBaseConfigList.add(acBaseConfig);
 | 
				
			||||||
        return getDataTable(acBaseConfigList);
 | 
					        return getDataTable(acBaseConfigList);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,12 +5,10 @@ import com.hzs.common.domain.activity.base.AcBaseAuthority;
 | 
				
			||||||
import org.apache.ibatis.annotations.Param;
 | 
					import org.apache.ibatis.annotations.Param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 活动基础权限表 Mapper 接口
 | 
					 * 活动基础权限表 Mapper 接口
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @author hzs
 | 
					 | 
				
			||||||
 * @since 2025-02-18
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public interface AcBaseAuthorityMapper extends BaseMapper<AcBaseAuthority> {
 | 
					public interface AcBaseAuthorityMapper extends BaseMapper<AcBaseAuthority> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,4 +38,14 @@ public interface AcBaseAuthorityMapper extends BaseMapper<AcBaseAuthority> {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<AcBaseAuthority> listAuthority(@Param("pkBaseId") Long pkBaseId);
 | 
					    List<AcBaseAuthority> listAuthority(@Param("pkBaseId") Long pkBaseId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量查询会员是否在血缘伞下
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Set<Long> queryBlood(@Param("paramList") Set<String> paramList, @Param("pkMember") Long pkMember);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量查询会员是否在安置伞下
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Set<Long> queryPlace(@Param("paramList") Set<String> paramList, @Param("pkMember") Long pkMember);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,9 +7,6 @@ import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 活动基础权限表 服务类
 | 
					 * 活动基础权限表 服务类
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @author hzs
 | 
					 | 
				
			||||||
 * @since 2025-02-18
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public interface IAcBaseAuthorityService extends IService<AcBaseAuthority> {
 | 
					public interface IAcBaseAuthorityService extends IService<AcBaseAuthority> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,4 +36,9 @@ public interface IAcBaseAuthorityService extends IService<AcBaseAuthority> {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<AcBaseAuthority> listAuthority(Long pkBaseId);
 | 
					    List<AcBaseAuthority> listAuthority(Long pkBaseId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 校验权限
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    boolean checkAuthority(Long pkMember, String memberCode, Long pkBaseId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,18 +1,19 @@
 | 
				
			||||||
package com.hzs.activity.base.service.impl;
 | 
					package com.hzs.activity.base.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.hutool.core.collection.CollectionUtil;
 | 
				
			||||||
import com.hzs.activity.base.mapper.AcBaseAuthorityMapper;
 | 
					import com.hzs.activity.base.mapper.AcBaseAuthorityMapper;
 | 
				
			||||||
import com.hzs.activity.base.service.IAcBaseAuthorityService;
 | 
					import com.hzs.activity.base.service.IAcBaseAuthorityService;
 | 
				
			||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
				
			||||||
 | 
					import com.hzs.common.core.enums.EWaresPermissionType;
 | 
				
			||||||
import com.hzs.common.domain.activity.base.AcBaseAuthority;
 | 
					import com.hzs.common.domain.activity.base.AcBaseAuthority;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.HashSet;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 活动基础权限表 服务实现类
 | 
					 * 活动基础权限表 服务实现类
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @author hzs
 | 
					 | 
				
			||||||
 * @since 2025-02-18
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Service
 | 
					@Service
 | 
				
			||||||
public class AcBaseAuthorityServiceImpl extends ServiceImpl<AcBaseAuthorityMapper, AcBaseAuthority> implements IAcBaseAuthorityService {
 | 
					public class AcBaseAuthorityServiceImpl extends ServiceImpl<AcBaseAuthorityMapper, AcBaseAuthority> implements IAcBaseAuthorityService {
 | 
				
			||||||
| 
						 | 
					@ -32,4 +33,59 @@ public class AcBaseAuthorityServiceImpl extends ServiceImpl<AcBaseAuthorityMappe
 | 
				
			||||||
        return baseMapper.listAuthority(pkBaseId);
 | 
					        return baseMapper.listAuthority(pkBaseId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean checkAuthority(Long pkMember, String memberCode, Long pkBaseId) {
 | 
				
			||||||
 | 
					        List<AcBaseAuthority> authorityList = baseMapper.listAuthority(pkBaseId);
 | 
				
			||||||
 | 
					        if (CollectionUtil.isNotEmpty(authorityList)) {
 | 
				
			||||||
 | 
					            // 血缘查询
 | 
				
			||||||
 | 
					            Set<String> authorityParentSet = new HashSet<>();
 | 
				
			||||||
 | 
					            // 安置查询
 | 
				
			||||||
 | 
					            Set<String> authorityPlaceSet = new HashSet<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for (AcBaseAuthority acBaseAuthority : authorityList) {
 | 
				
			||||||
 | 
					                if (EWaresPermissionType.MEMBER.getValue() == acBaseAuthority.getAuthorityType()) {
 | 
				
			||||||
 | 
					                    // 指定会员
 | 
				
			||||||
 | 
					                    if (acBaseAuthority.getMemberCode().equals(memberCode)) {
 | 
				
			||||||
 | 
					                        return true;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                } else if (EWaresPermissionType.BLOOD_ALLOW.getValue() == acBaseAuthority.getAuthorityType()
 | 
				
			||||||
 | 
					                        || EWaresPermissionType.BLOOD_STOP.getValue() == acBaseAuthority.getAuthorityType()) {
 | 
				
			||||||
 | 
					                    // 血缘关系
 | 
				
			||||||
 | 
					                    authorityParentSet.add(acBaseAuthority.getMemberCode());
 | 
				
			||||||
 | 
					                } else if (EWaresPermissionType.PLACE_ALLWO.getValue() == acBaseAuthority.getAuthorityType()
 | 
				
			||||||
 | 
					                        || EWaresPermissionType.PLACE_STOP.getValue() == acBaseAuthority.getAuthorityType()) {
 | 
				
			||||||
 | 
					                    // 安置关系
 | 
				
			||||||
 | 
					                    authorityPlaceSet.add(acBaseAuthority.getMemberCode());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // 查询血缘
 | 
				
			||||||
 | 
					            Set<Long> authParentList = new HashSet<>();
 | 
				
			||||||
 | 
					            if (authorityParentSet.size() > 0) {
 | 
				
			||||||
 | 
					                authParentList = baseMapper.queryBlood(authorityParentSet, pkMember);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            // 查询安置
 | 
				
			||||||
 | 
					            Set<Long> authPlaceList = new HashSet<>();
 | 
				
			||||||
 | 
					            if (authorityPlaceSet.size() > 0) {
 | 
				
			||||||
 | 
					                authPlaceList = baseMapper.queryPlace(authorityPlaceSet, pkMember);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for (AcBaseAuthority acBaseAuthority : authorityList) {
 | 
				
			||||||
 | 
					                if (acBaseAuthority.getAuthorityType() == EWaresPermissionType.BLOOD_STOP.getValue()) {
 | 
				
			||||||
 | 
					                    // 血缘禁止
 | 
				
			||||||
 | 
					                    if (authParentList.contains(pkMember)) {
 | 
				
			||||||
 | 
					                        return false;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                } else if (acBaseAuthority.getAuthorityType() == EWaresPermissionType.PLACE_STOP.getValue()) {
 | 
				
			||||||
 | 
					                    // 安置禁止
 | 
				
			||||||
 | 
					                    if (authPlaceList.contains(pkMember)) {
 | 
				
			||||||
 | 
					                        return false;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@ package com.hzs.activity.declaration.param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
					import com.fasterxml.jackson.annotation.JsonFormat;
 | 
				
			||||||
import com.hzs.activity.add.param.AcAddUpgradeConfigParam;
 | 
					import com.hzs.activity.add.param.AcAddUpgradeConfigParam;
 | 
				
			||||||
 | 
					import com.hzs.common.domain.activity.base.AcBaseAuthority;
 | 
				
			||||||
import com.hzs.common.domain.activity.base.AcBaseConfig;
 | 
					import com.hzs.common.domain.activity.base.AcBaseConfig;
 | 
				
			||||||
import com.hzs.common.domain.activity.base.AcGoalMemberConfig;
 | 
					import com.hzs.common.domain.activity.base.AcGoalMemberConfig;
 | 
				
			||||||
import lombok.AllArgsConstructor;
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
| 
						 | 
					@ -108,6 +109,11 @@ public class AcDeclarationDetailParam implements Serializable {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private List<AcGoalMemberConfig> goalMemberConfigList;
 | 
					    private List<AcGoalMemberConfig> goalMemberConfigList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 权限配置列表
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private List<AcBaseAuthority> authorityList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 是否强制弹框 0 是  1 否
 | 
					     * 是否强制弹框 0 是  1 否
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,5 +44,9 @@ public class AcDeclarationParam {
 | 
				
			||||||
     * 报单赠送信息
 | 
					     * 报单赠送信息
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private List<AcDeclarationConfigParam> acDeclarationConfigParams;
 | 
					    private List<AcDeclarationConfigParam> acDeclarationConfigParams;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 权限配置列表
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private List<AcBaseAuthority> authorityList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,13 @@
 | 
				
			||||||
package com.hzs.activity.declaration.service.impl;
 | 
					package com.hzs.activity.declaration.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import cn.hutool.core.bean.BeanUtil;
 | 
					import cn.hutool.core.bean.BeanUtil;
 | 
				
			||||||
 | 
					import cn.hutool.core.collection.CollectionUtil;
 | 
				
			||||||
 | 
					import cn.hutool.core.util.StrUtil;
 | 
				
			||||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
 | 
					import com.alibaba.nacos.client.naming.utils.CollectionUtils;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
				
			||||||
import com.hzs.activity.base.param.ActivityParam;
 | 
					import com.hzs.activity.base.param.ActivityParam;
 | 
				
			||||||
 | 
					import com.hzs.activity.base.service.IAcBaseAuthorityService;
 | 
				
			||||||
import com.hzs.activity.base.service.IAcBaseConfigService;
 | 
					import com.hzs.activity.base.service.IAcBaseConfigService;
 | 
				
			||||||
import com.hzs.activity.base.service.IActivityService;
 | 
					import com.hzs.activity.base.service.IActivityService;
 | 
				
			||||||
import com.hzs.activity.declaration.mapper.AcDeclarationGiftConfigMapper;
 | 
					import com.hzs.activity.declaration.mapper.AcDeclarationGiftConfigMapper;
 | 
				
			||||||
| 
						 | 
					@ -14,12 +18,12 @@ import com.hzs.activity.declaration.param.AcDeclarationProductParam;
 | 
				
			||||||
import com.hzs.activity.declaration.service.IAcDeclarationGiftConfigService;
 | 
					import com.hzs.activity.declaration.service.IAcDeclarationGiftConfigService;
 | 
				
			||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
				
			||||||
import com.hzs.activity.declaration.service.IAcDeclarationGiftDetailService;
 | 
					import com.hzs.activity.declaration.service.IAcDeclarationGiftDetailService;
 | 
				
			||||||
 | 
					import com.hzs.activity.recommend.param.AcRecommendParam;
 | 
				
			||||||
 | 
					import com.hzs.common.core.enums.*;
 | 
				
			||||||
 | 
					import com.hzs.common.domain.activity.base.AcBaseAuthority;
 | 
				
			||||||
import com.hzs.common.domain.activity.declaration.AcDeclarationGiftConfig;
 | 
					import com.hzs.common.domain.activity.declaration.AcDeclarationGiftConfig;
 | 
				
			||||||
import com.hzs.common.domain.activity.declaration.AcDeclarationGiftDetail;
 | 
					import com.hzs.common.domain.activity.declaration.AcDeclarationGiftDetail;
 | 
				
			||||||
import com.hzs.common.core.constant.CountryConstants;
 | 
					import com.hzs.common.core.constant.CountryConstants;
 | 
				
			||||||
import com.hzs.common.core.enums.EActType;
 | 
					 | 
				
			||||||
import com.hzs.common.core.enums.EApprovalBusiness;
 | 
					 | 
				
			||||||
import com.hzs.common.core.enums.ERegistrationAuthority;
 | 
					 | 
				
			||||||
import com.hzs.common.core.web.domain.AjaxResult;
 | 
					import com.hzs.common.core.web.domain.AjaxResult;
 | 
				
			||||||
import com.hzs.common.domain.activity.base.AcBaseConfig;
 | 
					import com.hzs.common.domain.activity.base.AcBaseConfig;
 | 
				
			||||||
import com.hzs.common.security.utils.SecurityUtils;
 | 
					import com.hzs.common.security.utils.SecurityUtils;
 | 
				
			||||||
| 
						 | 
					@ -64,6 +68,8 @@ public class AcDeclarationGiftConfigServiceImpl extends ServiceImpl<AcDeclaratio
 | 
				
			||||||
    private IAcDeclarationGiftConfigService iAcDeclarationGiftConfigService;
 | 
					    private IAcDeclarationGiftConfigService iAcDeclarationGiftConfigService;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IGradeServiceApi iGradeServiceApi;
 | 
					    private IGradeServiceApi iGradeServiceApi;
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private IAcBaseAuthorityService iAcBaseAuthorityService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public AjaxResult getDetail(Integer pkId) {
 | 
					    public AjaxResult getDetail(Integer pkId) {
 | 
				
			||||||
| 
						 | 
					@ -77,10 +83,13 @@ public class AcDeclarationGiftConfigServiceImpl extends ServiceImpl<AcDeclaratio
 | 
				
			||||||
        list.forEach(item -> {
 | 
					        list.forEach(item -> {
 | 
				
			||||||
            AcDeclarationConfigParam acDeclarationConfigParam = BeanUtil.copyProperties(item, AcDeclarationConfigParam.class);
 | 
					            AcDeclarationConfigParam acDeclarationConfigParam = BeanUtil.copyProperties(item, AcDeclarationConfigParam.class);
 | 
				
			||||||
            List<AcDeclarationProductParam> declarationConfigParams = iAcDeclarationGiftDetailService.listByPKRuleId(item.getPkId());
 | 
					            List<AcDeclarationProductParam> declarationConfigParams = iAcDeclarationGiftDetailService.listByPKRuleId(item.getPkId());
 | 
				
			||||||
 | 
					            // 添加商品详情
 | 
				
			||||||
            acDeclarationConfigParam.setAcDeclarationProductParamList(declarationConfigParams);
 | 
					            acDeclarationConfigParam.setAcDeclarationProductParamList(declarationConfigParams);
 | 
				
			||||||
            acDeclarationConfigParams.add(acDeclarationConfigParam);
 | 
					            acDeclarationConfigParams.add(acDeclarationConfigParam);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					        // 添加权限控制信息
 | 
				
			||||||
 | 
					        List<AcBaseAuthority> acBaseAuthorities = iAcBaseAuthorityService.listAuthority(baseConfig.getPkId());
 | 
				
			||||||
 | 
					        activityParam.setAuthorityList(acBaseAuthorities);
 | 
				
			||||||
        activityParam.setAcDeclarationConfigParams(acDeclarationConfigParams);
 | 
					        activityParam.setAcDeclarationConfigParams(acDeclarationConfigParams);
 | 
				
			||||||
        activityParam.setPkBaseId(baseConfig.getPkId());
 | 
					        activityParam.setPkBaseId(baseConfig.getPkId());
 | 
				
			||||||
        return AjaxResult.success(activityParam);
 | 
					        return AjaxResult.success(activityParam);
 | 
				
			||||||
| 
						 | 
					@ -105,7 +114,7 @@ public class AcDeclarationGiftConfigServiceImpl extends ServiceImpl<AcDeclaratio
 | 
				
			||||||
        // 新增活动基本配置
 | 
					        // 新增活动基本配置
 | 
				
			||||||
        AcBaseConfig acBaseConfig = iActivityService.saveBaseConfig(activityParam);
 | 
					        AcBaseConfig acBaseConfig = iActivityService.saveBaseConfig(activityParam);
 | 
				
			||||||
        // 新增加购活动配置
 | 
					        // 新增加购活动配置
 | 
				
			||||||
        saveDeclarationConfig(acDeclarationParam.getAcDeclarationConfigParams(), acBaseConfig);
 | 
					        saveDeclarationConfig(acDeclarationParam, acBaseConfig);
 | 
				
			||||||
        //日志
 | 
					        //日志
 | 
				
			||||||
        activityParam.setBusinessCode(acDeclarationParam.getActivityParam().getBusinessCode());
 | 
					        activityParam.setBusinessCode(acDeclarationParam.getActivityParam().getBusinessCode());
 | 
				
			||||||
        iActivityService.createBaseConfigLog(activityParam, new StringBuffer(), null, EApprovalBusiness.AC_DECLARATION_GIFT_ADD.getValue(), false);
 | 
					        iActivityService.createBaseConfigLog(activityParam, new StringBuffer(), null, EApprovalBusiness.AC_DECLARATION_GIFT_ADD.getValue(), false);
 | 
				
			||||||
| 
						 | 
					@ -192,7 +201,7 @@ public class AcDeclarationGiftConfigServiceImpl extends ServiceImpl<AcDeclaratio
 | 
				
			||||||
        activityParam.setPkCountry(loginUser.getDataCountry());
 | 
					        activityParam.setPkCountry(loginUser.getDataCountry());
 | 
				
			||||||
        activityParam.setPkCreator(loginUser.getUserId());
 | 
					        activityParam.setPkCreator(loginUser.getUserId());
 | 
				
			||||||
        activityParam.setActType(EActType.DECLARATION_GIFT.getValue());
 | 
					        activityParam.setActType(EActType.DECLARATION_GIFT.getValue());
 | 
				
			||||||
        updateDeclarationConfig(activityParam, acDeclarationParam.getAcDeclarationConfigParams());
 | 
					        updateDeclarationConfig(activityParam, acDeclarationParam);
 | 
				
			||||||
        iActivityService.createBaseConfigLog(activityParam, new StringBuffer(), null, EApprovalBusiness.AC_DECLARATION_GIFT_UPDATE.getValue(), false);
 | 
					        iActivityService.createBaseConfigLog(activityParam, new StringBuffer(), null, EApprovalBusiness.AC_DECLARATION_GIFT_UPDATE.getValue(), false);
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -212,6 +221,25 @@ public class AcDeclarationGiftConfigServiceImpl extends ServiceImpl<AcDeclaratio
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 保存活动权限
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param recommendParam
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void saveAuthority(AcDeclarationParam recommendParam,AcBaseConfig acBaseConfig) {
 | 
				
			||||||
 | 
					        List<AcBaseAuthority> authorityList = recommendParam.getAuthorityList();
 | 
				
			||||||
 | 
					        boolean hasInvalid = authorityList.stream()
 | 
				
			||||||
 | 
					                .anyMatch(auth -> auth.getAuthorityType() == null);
 | 
				
			||||||
 | 
					        if (hasInvalid) {
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (CollectionUtil.isNotEmpty(authorityList)) {
 | 
				
			||||||
 | 
					            for (AcBaseAuthority acBaseAuthority : authorityList) {
 | 
				
			||||||
 | 
					                acBaseAuthority.setPkBaseId(acBaseConfig.getPkId());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            iAcBaseAuthorityService.saveBatch(authorityList);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void removeDeclarationConfig(Long pkId) {
 | 
					    private void removeDeclarationConfig(Long pkId) {
 | 
				
			||||||
        // 删除活动基本配置
 | 
					        // 删除活动基本配置
 | 
				
			||||||
| 
						 | 
					@ -222,10 +250,15 @@ public class AcDeclarationGiftConfigServiceImpl extends ServiceImpl<AcDeclaratio
 | 
				
			||||||
        // 删除报单赠送详情配置
 | 
					        // 删除报单赠送详情配置
 | 
				
			||||||
        iAcDeclarationGiftDetailService.remove(new LambdaQueryWrapper<AcDeclarationGiftDetail>()
 | 
					        iAcDeclarationGiftDetailService.remove(new LambdaQueryWrapper<AcDeclarationGiftDetail>()
 | 
				
			||||||
                .eq(AcDeclarationGiftDetail::getPkBaseId, pkId));
 | 
					                .eq(AcDeclarationGiftDetail::getPkBaseId, pkId));
 | 
				
			||||||
 | 
					        // 删除活动权限配置
 | 
				
			||||||
 | 
					        iAcBaseAuthorityService.update(Wrappers.<AcBaseAuthority>lambdaUpdate()
 | 
				
			||||||
 | 
					                .eq(AcBaseAuthority::getPkBaseId, pkId)
 | 
				
			||||||
 | 
					                .eq(AcBaseAuthority::getDelFlag, EDelFlag.UN_DELETE.getValue())
 | 
				
			||||||
 | 
					                .set(AcBaseAuthority::getDelFlag, EDelFlag.DELETE.getValue())
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void updateDeclarationConfig(ActivityParam activityParam, List<AcDeclarationConfigParam> acDeclarationConfigParams) {
 | 
					    private void updateDeclarationConfig(ActivityParam activityParam, AcDeclarationParam acDeclarationParam) {
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            Long pkId = activityParam.getPkId();
 | 
					            Long pkId = activityParam.getPkId();
 | 
				
			||||||
            // 查询基础信息
 | 
					            // 查询基础信息
 | 
				
			||||||
            AcBaseConfig baseConfig = BeanUtil.copyProperties(activityParam, AcBaseConfig.class);
 | 
					            AcBaseConfig baseConfig = BeanUtil.copyProperties(activityParam, AcBaseConfig.class);
 | 
				
			||||||
| 
						 | 
					@ -235,15 +268,23 @@ public class AcDeclarationGiftConfigServiceImpl extends ServiceImpl<AcDeclaratio
 | 
				
			||||||
            // 删除活动配置
 | 
					            // 删除活动配置
 | 
				
			||||||
            baseMapper.delete(new LambdaQueryWrapper<AcDeclarationGiftConfig>()
 | 
					            baseMapper.delete(new LambdaQueryWrapper<AcDeclarationGiftConfig>()
 | 
				
			||||||
                    .eq(AcDeclarationGiftConfig::getPkBaseId, pkId));
 | 
					                    .eq(AcDeclarationGiftConfig::getPkBaseId, pkId));
 | 
				
			||||||
 | 
					            // 删除活动权限配置
 | 
				
			||||||
 | 
					            iAcBaseAuthorityService.update(Wrappers.<AcBaseAuthority>lambdaUpdate()
 | 
				
			||||||
 | 
					                    .eq(AcBaseAuthority::getPkBaseId, pkId)
 | 
				
			||||||
 | 
					                    .eq(AcBaseAuthority::getDelFlag, EDelFlag.UN_DELETE.getValue())
 | 
				
			||||||
 | 
					                    .set(AcBaseAuthority::getDelFlag, EDelFlag.DELETE.getValue())
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
            // 删除活动详情配置
 | 
					            // 删除活动详情配置
 | 
				
			||||||
            iAcDeclarationGiftDetailService.remove(new LambdaQueryWrapper<AcDeclarationGiftDetail>()
 | 
					            iAcDeclarationGiftDetailService.remove(new LambdaQueryWrapper<AcDeclarationGiftDetail>()
 | 
				
			||||||
                    .eq(AcDeclarationGiftDetail::getPkBaseId, pkId));
 | 
					                    .eq(AcDeclarationGiftDetail::getPkBaseId, pkId));
 | 
				
			||||||
            // 添加加购活动配置
 | 
					            // 添加加购活动配置
 | 
				
			||||||
            saveDeclarationConfig(acDeclarationConfigParams, baseConfig);
 | 
					            saveDeclarationConfig(acDeclarationParam, baseConfig);
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void saveDeclarationConfig(List<AcDeclarationConfigParam> acDeclarationConfigParams, AcBaseConfig acBaseConfig) {
 | 
					    private void saveDeclarationConfig(AcDeclarationParam acDeclarationParam, AcBaseConfig acBaseConfig) {
 | 
				
			||||||
 | 
					        List<AcDeclarationConfigParam> acDeclarationConfigParams = acDeclarationParam.getAcDeclarationConfigParams();
 | 
				
			||||||
 | 
					        // 保存活动权限配置
 | 
				
			||||||
 | 
					        this.saveAuthority(acDeclarationParam,acBaseConfig);
 | 
				
			||||||
        acDeclarationConfigParams.forEach(item -> {
 | 
					        acDeclarationConfigParams.forEach(item -> {
 | 
				
			||||||
            if (item != null) {
 | 
					            if (item != null) {
 | 
				
			||||||
                AcDeclarationGiftConfig build = AcDeclarationGiftConfig.builder()
 | 
					                AcDeclarationGiftConfig build = AcDeclarationGiftConfig.builder()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,16 +1,20 @@
 | 
				
			||||||
package com.hzs.activity.tourism.provider;
 | 
					package com.hzs.activity.tourism.provider;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.hutool.core.collection.CollectionUtil;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
				
			||||||
 | 
					import com.hzs.activity.base.service.IAcBaseAuthorityService;
 | 
				
			||||||
import com.hzs.activity.base.service.IAcBaseConfigService;
 | 
					import com.hzs.activity.base.service.IAcBaseConfigService;
 | 
				
			||||||
import com.hzs.activity.declaration.service.IAcDeclarationGiftConfigService;
 | 
					import com.hzs.activity.declaration.service.IAcDeclarationGiftConfigService;
 | 
				
			||||||
import com.hzs.activity.declaration.service.IAcDeclarationGiftRecordService;
 | 
					import com.hzs.activity.declaration.service.IAcDeclarationGiftRecordService;
 | 
				
			||||||
 | 
					import com.hzs.common.core.enums.*;
 | 
				
			||||||
 | 
					import com.hzs.common.domain.activity.base.AcBaseAuthority;
 | 
				
			||||||
import com.hzs.common.domain.activity.declaration.AcDeclarationGiftConfig;
 | 
					import com.hzs.common.domain.activity.declaration.AcDeclarationGiftConfig;
 | 
				
			||||||
import com.hzs.common.domain.activity.declaration.AcDeclarationGiftRecord;
 | 
					import com.hzs.common.domain.activity.declaration.AcDeclarationGiftRecord;
 | 
				
			||||||
import com.hzs.activity.tourism.IAcTourismServiceApi;
 | 
					import com.hzs.activity.tourism.IAcTourismServiceApi;
 | 
				
			||||||
import com.hzs.activity.tourism.service.IAcTourismDataService;
 | 
					import com.hzs.activity.tourism.service.IAcTourismDataService;
 | 
				
			||||||
import com.hzs.common.core.constant.CountryConstants;
 | 
					import com.hzs.common.core.constant.CountryConstants;
 | 
				
			||||||
import com.hzs.common.core.domain.R;
 | 
					import com.hzs.common.core.domain.R;
 | 
				
			||||||
import com.hzs.common.core.enums.EOrderType;
 | 
					 | 
				
			||||||
import com.hzs.common.domain.activity.base.AcBaseConfig;
 | 
					import com.hzs.common.domain.activity.base.AcBaseConfig;
 | 
				
			||||||
import com.hzs.common.domain.member.base.CuMember;
 | 
					import com.hzs.common.domain.member.base.CuMember;
 | 
				
			||||||
import com.hzs.common.domain.sale.order.SaOrder;
 | 
					import com.hzs.common.domain.sale.order.SaOrder;
 | 
				
			||||||
| 
						 | 
					@ -24,9 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
import java.time.LocalDate;
 | 
					import java.time.LocalDate;
 | 
				
			||||||
import java.time.ZoneId;
 | 
					import java.time.ZoneId;
 | 
				
			||||||
import java.time.temporal.ChronoUnit;
 | 
					import java.time.temporal.ChronoUnit;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.*;
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
import java.util.function.Function;
 | 
					import java.util.function.Function;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +56,8 @@ public class AcTourismServiceProvider implements IAcTourismServiceApi {
 | 
				
			||||||
    private IAcBaseConfigService iAcBaseConfigService;
 | 
					    private IAcBaseConfigService iAcBaseConfigService;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IMemberServiceApi iMemberServiceApi;
 | 
					    private IMemberServiceApi iMemberServiceApi;
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private IAcBaseAuthorityService iAcBaseAuthorityService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public R<?> handleTourismData() {
 | 
					    public R<?> handleTourismData() {
 | 
				
			||||||
| 
						 | 
					@ -110,55 +114,88 @@ public class AcTourismServiceProvider implements IAcTourismServiceApi {
 | 
				
			||||||
        Date targetDate = java.sql.Date.valueOf(LocalDate.now().minusDays(7));
 | 
					        Date targetDate = java.sql.Date.valueOf(LocalDate.now().minusDays(7));
 | 
				
			||||||
        log.info("处理日期: {}", targetDate);
 | 
					        log.info("处理日期: {}", targetDate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 获取所有7天前有效的报单赠送活动
 | 
				
			||||||
 | 
					        List<AcBaseConfig> acBaseConfigList = iAcBaseConfigService.list(new LambdaQueryWrapper<AcBaseConfig>()
 | 
				
			||||||
 | 
					                .le(AcBaseConfig::getActStartDate, targetDate)
 | 
				
			||||||
 | 
					                .ge(AcBaseConfig::getActEndDate, targetDate)
 | 
				
			||||||
 | 
					                .eq(AcBaseConfig::getActType, EActType.DECLARATION_GIFT.getValue())
 | 
				
			||||||
 | 
					                .eq(AcBaseConfig::getDelFlag, EDelFlag.UN_DELETE.getValue()));
 | 
				
			||||||
 | 
					        if (acBaseConfigList.isEmpty()) {
 | 
				
			||||||
 | 
					            log.info("{}天前无有效报单赠送活动,处理结束", daysAgo);
 | 
				
			||||||
 | 
					            return R.ok();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 查询订单
 | 
					        // 查询订单
 | 
				
			||||||
        List<SaOrder> orderList = iSaOrderService.list(new LambdaQueryWrapper<SaOrder>()
 | 
					        List<SaOrder> orderList = iSaOrderService.list(new LambdaQueryWrapper<SaOrder>()
 | 
				
			||||||
                .nested(w -> w.in(SaOrder::getOrderType, EOrderType.REGISTER_ORDER.getValue(), EOrderType.UPGRADE_ORDER.getValue())
 | 
					                .nested(w -> w.in(SaOrder::getOrderType, EOrderType.REGISTER_ORDER.getValue(), EOrderType.UPGRADE_ORDER.getValue())
 | 
				
			||||||
                        .or()
 | 
					                        .or()
 | 
				
			||||||
                        .nested(x -> x.eq(SaOrder::getOrderType, EOrderType.REPURCHASE_ORDER.getValue())
 | 
					                        .nested(x -> x.eq(SaOrder::getOrderType, EOrderType.REPURCHASE_ORDER.getValue())
 | 
				
			||||||
                                .eq(SaOrder::getOrderTypeExtend, 1)))
 | 
					                                .eq(SaOrder::getOrderTypeExtend, EOrderTypeExtend.REG_REP.getValue())))
 | 
				
			||||||
                .apply("TRUNC(PAY_TIME) BETWEEN TRUNC(SYSDATE - {0}) AND TRUNC(SYSDATE - 7)", daysAgo)
 | 
					                .apply("TRUNC(PAY_TIME) BETWEEN TRUNC(SYSDATE - {0}) AND TRUNC(SYSDATE - 7)", daysAgo)
 | 
				
			||||||
                .eq(SaOrder::getOrderStatus, 1)
 | 
					                .eq(SaOrder::getOrderStatus, EOrderStatus.PAY.getValue())
 | 
				
			||||||
                .eq(SaOrder::getDelFlag, 0)
 | 
					                .eq(SaOrder::getDelFlag, EDelFlag.UN_DELETE.getValue())
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        log.info("{}天无有效订单,处理结束", daysAgo);
 | 
					        if (orderList.isEmpty()) {
 | 
				
			||||||
        // 获取所有7天前有效的报单赠送活动
 | 
					            log.info("{}天无有效订单,处理结束", daysAgo);
 | 
				
			||||||
        List<AcBaseConfig> acBaseConfigList = iAcBaseConfigService.list(new LambdaQueryWrapper<AcBaseConfig>()
 | 
					 | 
				
			||||||
                .le(AcBaseConfig::getActStartDate, targetDate)
 | 
					 | 
				
			||||||
                .ge(AcBaseConfig::getActEndDate, targetDate)
 | 
					 | 
				
			||||||
                .eq(AcBaseConfig::getActType, 32)
 | 
					 | 
				
			||||||
                .eq(AcBaseConfig::getDelFlag, 0));
 | 
					 | 
				
			||||||
        if (acBaseConfigList.isEmpty()) {
 | 
					 | 
				
			||||||
            log.info("{}天前无有效报单赠送活动,处理结束", daysAgo);
 | 
					 | 
				
			||||||
            return R.ok();
 | 
					            return R.ok();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 报单赠送活动主键集合
 | 
					        // 报单赠送活动主键集合
 | 
				
			||||||
        List<Long> declarationBaseIds = acBaseConfigList.stream().map(AcBaseConfig::getPkId).collect(Collectors.toList());
 | 
					        List<Long> declarationBaseIds = acBaseConfigList.stream().map(AcBaseConfig::getPkId).collect(Collectors.toList());
 | 
				
			||||||
        // 查询所有报单赠送活动数据
 | 
					        // 查询所有报单赠送活动数据
 | 
				
			||||||
        List<AcDeclarationGiftConfig> declarationGiftConfigs = iAcDeclarationGiftConfigService.list(new LambdaQueryWrapper<AcDeclarationGiftConfig>()
 | 
					        List<AcDeclarationGiftConfig> declarationGiftConfigs = iAcDeclarationGiftConfigService.list(new LambdaQueryWrapper<AcDeclarationGiftConfig>()
 | 
				
			||||||
                .in(AcDeclarationGiftConfig::getPkBaseId, declarationBaseIds)
 | 
					                .in(AcDeclarationGiftConfig::getPkBaseId, declarationBaseIds)
 | 
				
			||||||
                .eq(AcDeclarationGiftConfig::getDelFlag, 0));
 | 
					                .eq(AcDeclarationGiftConfig::getDelFlag, EDelFlag.UN_DELETE.getValue()));
 | 
				
			||||||
        Map<String, AcDeclarationGiftConfig> configMap = declarationGiftConfigs.stream()
 | 
					        Map<String, AcDeclarationGiftConfig> configMap = declarationGiftConfigs.stream()
 | 
				
			||||||
                .collect(Collectors.toMap(
 | 
					                .collect(Collectors.toMap(
 | 
				
			||||||
                        cfg -> cfg.getRegisterAuthority() + "_" + cfg.getSpecifyLevel(),
 | 
					                        cfg -> cfg.getRegisterAuthority() + "_" + cfg.getSpecifyLevel(),
 | 
				
			||||||
                        Function.identity(),
 | 
					                        Function.identity(),
 | 
				
			||||||
                        (a, b) -> b
 | 
					                        (a, b) -> b
 | 
				
			||||||
                ));
 | 
					                ));
 | 
				
			||||||
 | 
					        // 一次批量查询会员信息
 | 
				
			||||||
 | 
					        Set<Long> memberIds = new HashSet<>();
 | 
				
			||||||
        orderList.forEach(order -> {
 | 
					        orderList.forEach(order -> {
 | 
				
			||||||
            // 查看是否有重复订单
 | 
					            memberIds.add(order.getPkMember());
 | 
				
			||||||
            int count = iAcDeclarationGiftRecordService.count(new LambdaQueryWrapper<AcDeclarationGiftRecord>()
 | 
					            memberIds.add(order.getPkCreator());
 | 
				
			||||||
                    .eq(AcDeclarationGiftRecord::getOrderCode, order.getOrderCode())
 | 
					        });
 | 
				
			||||||
                    .eq(AcDeclarationGiftRecord::getDelFlag, 0));
 | 
					
 | 
				
			||||||
            if (count > 0) {
 | 
					        Map<Long, CuMember> memberMap = iMemberServiceApi.getMemberByIds(memberIds)
 | 
				
			||||||
                log.warn("当前订单已同步至报单明细{}", order.getOrderCode());
 | 
					                .getData().stream().collect(Collectors.toMap(CuMember::getPkId, m -> m));
 | 
				
			||||||
                return;
 | 
					
 | 
				
			||||||
            }
 | 
					
 | 
				
			||||||
            // 查询新会员信息
 | 
					        List<String> orderCodes = orderList.stream()
 | 
				
			||||||
            R<CuMember> newMemberResult = iMemberServiceApi.getMember(order.getPkMember());
 | 
					                .map(SaOrder::getOrderCode)
 | 
				
			||||||
            CuMember newMember = newMemberResult.getData();
 | 
					                .collect(Collectors.toList());
 | 
				
			||||||
            // 查询老会员信息
 | 
					
 | 
				
			||||||
            R<CuMember> oldMemberResult = iMemberServiceApi.getMember(order.getPkCreator());
 | 
					        // 过滤已存在订单
 | 
				
			||||||
            CuMember oldMember = oldMemberResult.getData();
 | 
					        Set<String> existSet = iAcDeclarationGiftRecordService.list(
 | 
				
			||||||
 | 
					                new LambdaQueryWrapper<AcDeclarationGiftRecord>()
 | 
				
			||||||
 | 
					                        .in(AcDeclarationGiftRecord::getOrderCode, orderCodes)
 | 
				
			||||||
 | 
					                        .eq(AcDeclarationGiftRecord::getDelFlag, EDelFlag.UN_DELETE.getValue())
 | 
				
			||||||
 | 
					        ).stream().map(AcDeclarationGiftRecord::getOrderCode).collect(Collectors.toSet());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        orderList = orderList.stream()
 | 
				
			||||||
 | 
					                .filter(order -> !existSet.contains(order.getOrderCode()))
 | 
				
			||||||
 | 
					                .collect(Collectors.toList());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 批量查询这些活动对应的权限记录
 | 
				
			||||||
 | 
					        List<AcBaseAuthority> allAuthorityList = iAcBaseAuthorityService.list(
 | 
				
			||||||
 | 
					                Wrappers.<AcBaseAuthority>lambdaQuery()
 | 
				
			||||||
 | 
					                        .in(AcBaseAuthority::getPkBaseId, declarationBaseIds)
 | 
				
			||||||
 | 
					                        .eq(AcBaseAuthority::getDelFlag, EDelFlag.UN_DELETE.getValue())
 | 
				
			||||||
 | 
					                        .orderByDesc(AcBaseAuthority::getAuthorityType)
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Map<Long, List<AcBaseAuthority>> authorityCache = allAuthorityList.stream()
 | 
				
			||||||
 | 
					                .collect(Collectors.groupingBy(AcBaseAuthority::getPkBaseId));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<AcDeclarationGiftRecord> recordList = new ArrayList<>();
 | 
				
			||||||
 | 
					        orderList.forEach(order -> {
 | 
				
			||||||
 | 
					            // 新会员信息
 | 
				
			||||||
 | 
					            CuMember newMember = memberMap.get(order.getPkMember());
 | 
				
			||||||
 | 
					            // 老会员信息
 | 
				
			||||||
 | 
					            CuMember oldMember = memberMap.get(order.getPkCreator());
 | 
				
			||||||
            if (oldMember == null || newMember == null) {
 | 
					            if (oldMember == null || newMember == null) {
 | 
				
			||||||
                log.warn("会员信息不存在, 新会员id={},老会员id={}", order.getPkMember(), order.getPkCreator());
 | 
					                log.warn("会员信息不存在, 新会员id={},老会员id={}", order.getPkMember(), order.getPkCreator());
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
| 
						 | 
					@ -173,7 +210,10 @@ public class AcTourismServiceProvider implements IAcTourismServiceApi {
 | 
				
			||||||
                        oldMember.getPkId(), oldMember.getRegisterAuthority(), newMember.getPkSettleGrade());
 | 
					                        oldMember.getPkId(), oldMember.getRegisterAuthority(), newMember.getPkSettleGrade());
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            // 查询活动权限
 | 
				
			||||||
 | 
					            if (!this.checkAuthority(matchedConfig.getPkBaseId(), order.getPkMember(),oldMember.getMemberCode(),authorityCache)) {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            AcDeclarationGiftRecord record = AcDeclarationGiftRecord.builder()
 | 
					            AcDeclarationGiftRecord record = AcDeclarationGiftRecord.builder()
 | 
				
			||||||
                    .pkRuleId(matchedConfig.getPkId())
 | 
					                    .pkRuleId(matchedConfig.getPkId())
 | 
				
			||||||
                    .pkBaseId(matchedConfig.getPkBaseId())
 | 
					                    .pkBaseId(matchedConfig.getPkBaseId())
 | 
				
			||||||
| 
						 | 
					@ -181,16 +221,67 @@ public class AcTourismServiceProvider implements IAcTourismServiceApi {
 | 
				
			||||||
                    .syncStatus(0)
 | 
					                    .syncStatus(0)
 | 
				
			||||||
                    .build();
 | 
					                    .build();
 | 
				
			||||||
            record.setCreationTime(new Date());
 | 
					            record.setCreationTime(new Date());
 | 
				
			||||||
            record.setDelFlag(0);
 | 
					            record.setDelFlag(EDelFlag.UN_DELETE.getValue());
 | 
				
			||||||
            record.setPkCreator(oldMember.getPkId());
 | 
					            record.setPkCreator(oldMember.getPkId());
 | 
				
			||||||
            record.setPkCountry(pkCountry);
 | 
					            record.setPkCountry(pkCountry);
 | 
				
			||||||
            // 插入数据库
 | 
					            recordList.add(record);
 | 
				
			||||||
            iAcDeclarationGiftRecordService.save(record);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            log.info("成功插入报单赠送记录 -> memberId={}, ruleId={}",
 | 
					 | 
				
			||||||
                    oldMember.getPkId(), matchedConfig.getPkId());
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					        if (!recordList.isEmpty()) {
 | 
				
			||||||
 | 
					            iAcDeclarationGiftRecordService.saveBatch(recordList);
 | 
				
			||||||
 | 
					            log.info("[DeclarationGiftJob] 订单量={} 活动数={} 插入记录={}",
 | 
				
			||||||
 | 
					                    orderList.size(), acBaseConfigList.size(), recordList.size());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return R.ok();
 | 
					        return R.ok();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 校验活动权限(true:进行处理,false:不进行处理)
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param memberCode
 | 
				
			||||||
 | 
					     * @param authorityCache
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private boolean checkAuthority(Long pkBaseId, Long pkMember, String memberCode, Map<Long, List<AcBaseAuthority>> authorityCache) {
 | 
				
			||||||
 | 
					        List<AcBaseAuthority> authList = authorityCache.get(pkBaseId);
 | 
				
			||||||
 | 
					        if (CollectionUtil.isEmpty(authList)) {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (CollectionUtil.isNotEmpty(authList)) {
 | 
				
			||||||
 | 
					            Map<Integer, List<String>> authMap = new HashMap<>();
 | 
				
			||||||
 | 
					            for (AcBaseAuthority authority : authList) {
 | 
				
			||||||
 | 
					                authMap.computeIfAbsent(authority.getAuthorityType(), k -> new ArrayList<>());
 | 
				
			||||||
 | 
					                authMap.get(authority.getAuthorityType()).add(authority.getMemberCode());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            // 指定会员优先处理
 | 
				
			||||||
 | 
					            List<String> memberList = authMap.get(EWaresPermissionType.MEMBER.getValue());
 | 
				
			||||||
 | 
					            if (CollectionUtil.isNotEmpty(memberList)) {
 | 
				
			||||||
 | 
					                if (memberList.contains(memberCode)) {
 | 
				
			||||||
 | 
					                    return true;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            for (Integer key : authMap.keySet()) {
 | 
				
			||||||
 | 
					                List<String> memberCodeList = authMap.get(key);
 | 
				
			||||||
 | 
					                switch (EWaresPermissionType.getEnumByValue(key)) {
 | 
				
			||||||
 | 
					                    case AUTH_ORITY_TYPE:
 | 
				
			||||||
 | 
					                        // 全部
 | 
				
			||||||
 | 
					                        return true;
 | 
				
			||||||
 | 
					                    case PLACE_STOP:
 | 
				
			||||||
 | 
					                        // 安置禁止
 | 
				
			||||||
 | 
					                        return iAcBaseAuthorityService.checkPlaceParent(pkMember, memberCodeList) <= 0;
 | 
				
			||||||
 | 
					                    case BLOOD_STOP:
 | 
				
			||||||
 | 
					                        // 血缘禁止
 | 
				
			||||||
 | 
					                        return iAcBaseAuthorityService.checkParent(pkMember, memberCodeList) <= 0;
 | 
				
			||||||
 | 
					                    case PLACE_ALLWO:
 | 
				
			||||||
 | 
					                        // 安置可见
 | 
				
			||||||
 | 
					                        return iAcBaseAuthorityService.checkPlaceParent(pkMember, memberCodeList) > 0;
 | 
				
			||||||
 | 
					                    case BLOOD_ALLOW:
 | 
				
			||||||
 | 
					                        // 血缘可见
 | 
				
			||||||
 | 
					                        return iAcBaseAuthorityService.checkParent(pkMember, memberCodeList) > 0;
 | 
				
			||||||
 | 
					                    default:
 | 
				
			||||||
 | 
					                        return true;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@ import com.hzs.common.core.web.domain.AjaxResult;
 | 
				
			||||||
import com.hzs.common.security.utils.SecurityUtils;
 | 
					import com.hzs.common.security.utils.SecurityUtils;
 | 
				
			||||||
import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
 | 
					import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
 | 
				
			||||||
import com.hzs.sale.product.service.IBdAreaClassifyService;
 | 
					import com.hzs.sale.product.service.IBdAreaClassifyService;
 | 
				
			||||||
 | 
					import com.hzs.sale.product.vo.AreaClassifyTreeVo;
 | 
				
			||||||
import com.hzs.sale.product.vo.AreaClassifyVo;
 | 
					import com.hzs.sale.product.vo.AreaClassifyVo;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
| 
						 | 
					@ -42,6 +43,21 @@ public class ApiAreaClassifyController extends BaseController {
 | 
				
			||||||
        return AjaxResult.success(list);
 | 
					        return AjaxResult.success(list);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询分类列表(拼接树形结构)
 | 
				
			||||||
 | 
					     * @param areaClassifyParam
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/listTree")
 | 
				
			||||||
 | 
					    public AjaxResult listTree(AreaClassifyParam areaClassifyParam) {
 | 
				
			||||||
 | 
					        areaClassifyParam.setEnableState(EYesNo.YES.getIntValue());
 | 
				
			||||||
 | 
					        areaClassifyParam.setPkCountry(SecurityUtils.getPkCountry());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<Tree<String>> treeList = iBdAreaClassifyService.selectByAreaClassifyListAll(areaClassifyParam);
 | 
				
			||||||
 | 
					        return AjaxResult.success(treeList);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 查询第一层分类
 | 
					     * 查询第一层分类
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,7 @@ package com.hzs.sale.product.mapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
					import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
				
			||||||
import com.hzs.common.domain.sale.product.BdAreaClassify;
 | 
					import com.hzs.common.domain.sale.product.BdAreaClassify;
 | 
				
			||||||
import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
 | 
					import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
 | 
				
			||||||
 | 
					import com.hzs.sale.product.vo.AreaClassifyTreeVo;
 | 
				
			||||||
import com.hzs.sale.product.vo.AreaClassifyVo;
 | 
					import com.hzs.sale.product.vo.AreaClassifyVo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
| 
						 | 
					@ -23,4 +24,6 @@ public interface BdAreaClassifyMapper extends BaseMapper<BdAreaClassify> {
 | 
				
			||||||
     * @return
 | 
					     * @return
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<AreaClassifyVo> selectByAreaClassifyList(AreaClassifyParam areaClassifyParam);
 | 
					    List<AreaClassifyVo> selectByAreaClassifyList(AreaClassifyParam areaClassifyParam);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    List<AreaClassifyTreeVo> selectByAreaClassifyListAll(AreaClassifyParam areaClassifyParam);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,10 @@
 | 
				
			||||||
package com.hzs.sale.product.service;
 | 
					package com.hzs.sale.product.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.hutool.core.lang.tree.Tree;
 | 
				
			||||||
import com.baomidou.mybatisplus.extension.service.IService;
 | 
					import com.baomidou.mybatisplus.extension.service.IService;
 | 
				
			||||||
import com.hzs.common.domain.sale.product.BdAreaClassify;
 | 
					import com.hzs.common.domain.sale.product.BdAreaClassify;
 | 
				
			||||||
import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
 | 
					import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
 | 
				
			||||||
 | 
					import com.hzs.sale.product.vo.AreaClassifyTreeVo;
 | 
				
			||||||
import com.hzs.sale.product.vo.AreaClassifyVo;
 | 
					import com.hzs.sale.product.vo.AreaClassifyVo;
 | 
				
			||||||
import com.hzs.system.sys.dto.LoginUser;
 | 
					import com.hzs.system.sys.dto.LoginUser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,4 +53,6 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
 | 
				
			||||||
     * @param pkId
 | 
					     * @param pkId
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void deleteAreaClassify(Integer pkId);
 | 
					    void deleteAreaClassify(Integer pkId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    List<Tree<String>> selectByAreaClassifyListAll(AreaClassifyParam areaClassifyParam);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
package com.hzs.sale.product.service.impl;
 | 
					package com.hzs.sale.product.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import cn.hutool.core.bean.BeanUtil;
 | 
					import cn.hutool.core.bean.BeanUtil;
 | 
				
			||||||
 | 
					import cn.hutool.core.lang.tree.Tree;
 | 
				
			||||||
 | 
					import cn.hutool.core.lang.tree.TreeUtil;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
					import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
				
			||||||
import com.hzs.common.core.enums.EDelFlag;
 | 
					import com.hzs.common.core.enums.EDelFlag;
 | 
				
			||||||
| 
						 | 
					@ -11,15 +13,15 @@ import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
 | 
				
			||||||
import com.hzs.sale.product.mapper.BdAreaClassifyMapper;
 | 
					import com.hzs.sale.product.mapper.BdAreaClassifyMapper;
 | 
				
			||||||
import com.hzs.sale.product.service.IBdAreaClassifyService;
 | 
					import com.hzs.sale.product.service.IBdAreaClassifyService;
 | 
				
			||||||
import com.hzs.sale.product.service.IBdAreaClassifySpecialAreaService;
 | 
					import com.hzs.sale.product.service.IBdAreaClassifySpecialAreaService;
 | 
				
			||||||
 | 
					import com.hzs.sale.product.vo.AreaClassifyTreeVo;
 | 
				
			||||||
import com.hzs.sale.product.vo.AreaClassifyVo;
 | 
					import com.hzs.sale.product.vo.AreaClassifyVo;
 | 
				
			||||||
import com.hzs.system.sys.dto.LoginUser;
 | 
					import com.hzs.system.sys.dto.LoginUser;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.*;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 商品分类 服务实现类
 | 
					 * 商品分类 服务实现类
 | 
				
			||||||
| 
						 | 
					@ -108,4 +110,31 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
 | 
				
			||||||
        iBdAreaClassifySpecialAreaService.deleteByAreaClassifyPk(pkId);
 | 
					        iBdAreaClassifySpecialAreaService.deleteByAreaClassifyPk(pkId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<Tree<String>> selectByAreaClassifyListAll(AreaClassifyParam areaClassifyParam) {
 | 
				
			||||||
 | 
					        List<AreaClassifyTreeVo> flatList = baseMapper.selectByAreaClassifyListAll(areaClassifyParam);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        flatList.forEach(vo -> {
 | 
				
			||||||
 | 
					            vo.setId(String.valueOf(vo.getPkId()));
 | 
				
			||||||
 | 
					            vo.setParentId(vo.getPkParent() != 0L ? String.valueOf(vo.getPkParent()) : "0");
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return TreeUtil.build(flatList, "0", (node, tree) -> {
 | 
				
			||||||
 | 
					            tree.setId(node.getId());
 | 
				
			||||||
 | 
					            tree.setParentId(node.getParentId());
 | 
				
			||||||
 | 
					            tree.setName(node.getClassifyName());
 | 
				
			||||||
 | 
					            tree.putExtra("classifyImg",node.getClassifyImg());
 | 
				
			||||||
 | 
					            tree.putExtra("classifyName",node.getClassifyName());
 | 
				
			||||||
 | 
					            tree.putExtra("creationTime",node.getCreationTime());
 | 
				
			||||||
 | 
					            tree.putExtra("enableState",node.getEnableState());
 | 
				
			||||||
 | 
					            tree.putExtra("hierarchy",node.getHierarchy());
 | 
				
			||||||
 | 
					            tree.putExtra("pkCountry",node.getPkCountry());
 | 
				
			||||||
 | 
					            tree.putExtra("pkCreator",node.getPkCreator());
 | 
				
			||||||
 | 
					            tree.putExtra("pkId",node.getPkId());
 | 
				
			||||||
 | 
					            tree.putExtra("pkParent",node.getPkParent());
 | 
				
			||||||
 | 
					            tree.putExtra("sort",node.getSort());
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,81 @@
 | 
				
			||||||
 | 
					package com.hzs.sale.product.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hzs.common.core.web.domain.BaseEntity;
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					import lombok.EqualsAndHashCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.Serializable;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@EqualsAndHashCode(callSuper = true)
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class AreaClassifyTreeVo extends BaseEntity implements Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 主键
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Integer pkId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 所属专区
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private List<Integer> specialArea;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 分类名称
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String classifyName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 排序
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Integer sort;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 上级专区主键
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Long pkParent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 分类图片
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String classifyImg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 是否启用
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Integer enableState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 层级 0 表示 第一层
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Integer hierarchy;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 上级分类名称
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String parentClassifyName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 下级数量
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Integer levelCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 是否推荐 0 推荐 1 不推荐
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Integer isRecommend;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String parentId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private List<AreaClassifyTreeVo> children = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private AreaClassifyTreeVo  Extra;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@ package com.hzs.sale.wares.controller.manage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import cn.hutool.core.bean.BeanUtil;
 | 
					import cn.hutool.core.bean.BeanUtil;
 | 
				
			||||||
import cn.hutool.core.collection.CollectionUtil;
 | 
					import cn.hutool.core.collection.CollectionUtil;
 | 
				
			||||||
 | 
					import com.alibaba.nacos.client.naming.utils.CollectionUtils;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
					import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
				
			||||||
import com.hzs.common.core.annotation.AccessPermissions;
 | 
					import com.hzs.common.core.annotation.AccessPermissions;
 | 
				
			||||||
| 
						 | 
					@ -79,8 +80,6 @@ public class BdWaresController extends BaseController {
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IBdWaresLabelService waresLabelService;
 | 
					    private IBdWaresLabelService waresLabelService;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IBdWaresExtendService waresExtendService;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IBdWaresDetailService waresDetailService;
 | 
					    private IBdWaresDetailService waresDetailService;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IBdWaresSpecsSkuService waresSpecsSkuService;
 | 
					    private IBdWaresSpecsSkuService waresSpecsSkuService;
 | 
				
			||||||
| 
						 | 
					@ -94,6 +93,8 @@ public class BdWaresController extends BaseController {
 | 
				
			||||||
    private IBdAreaClassifyService areaClassifyService;
 | 
					    private IBdAreaClassifyService areaClassifyService;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private UserTokenService userTokenService;
 | 
					    private UserTokenService userTokenService;
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private IBdWaresExtendService iBdWaresExtendService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 查询列表
 | 
					     * 查询列表
 | 
				
			||||||
| 
						 | 
					@ -561,7 +562,7 @@ public class BdWaresController extends BaseController {
 | 
				
			||||||
        BdWares wares = iBdWaresService.getById(pkId);
 | 
					        BdWares wares = iBdWaresService.getById(pkId);
 | 
				
			||||||
        LambdaQueryWrapper<BdWaresExtend> queryWrapper = new LambdaQueryWrapper<>();
 | 
					        LambdaQueryWrapper<BdWaresExtend> queryWrapper = new LambdaQueryWrapper<>();
 | 
				
			||||||
        queryWrapper.eq(BdWaresExtend::getPkWares, pkId);
 | 
					        queryWrapper.eq(BdWaresExtend::getPkWares, pkId);
 | 
				
			||||||
        BdWaresExtend waresExtend = waresExtendService.getOne(queryWrapper);
 | 
					        BdWaresExtend waresExtend = iBdWaresExtendService.getOne(queryWrapper);
 | 
				
			||||||
        WaresParams waresParams = new WaresParams();
 | 
					        WaresParams waresParams = new WaresParams();
 | 
				
			||||||
        waresParams.setWaresId(wares.getPkId());
 | 
					        waresParams.setWaresId(wares.getPkId());
 | 
				
			||||||
        waresParams.setIsPreSale(wares.getIsPreSale());
 | 
					        waresParams.setIsPreSale(wares.getIsPreSale());
 | 
				
			||||||
| 
						 | 
					@ -1119,4 +1120,32 @@ public class BdWaresController extends BaseController {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 商品批量上架
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Log(module = EOperationModule.PUT_ON_LIST, business = EOperationBusiness.PUT_ON_LIST, method = EOperationMethod.RENEW, remark = "商品批量上架")
 | 
				
			||||||
 | 
					    @PostMapping("/putOnList")
 | 
				
			||||||
 | 
					    public AjaxResult putOnList(@RequestBody WaresPutOnIdsParams waresPutOnIdsParams) {
 | 
				
			||||||
 | 
					        if (CollectionUtils.isEmpty(waresPutOnIdsParams.getPkWares())) {
 | 
				
			||||||
 | 
					            return AjaxResult.error("商品ID不能为空");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        iBdWaresExtendService.putOnList(waresPutOnIdsParams);
 | 
				
			||||||
 | 
					        return AjaxResult.success();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 商品批量下架
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Log(module = EOperationModule.PUT_OFF_LIST, business = EOperationBusiness.PUT_OFF_LIST, method = EOperationMethod.RENEW, remark = "商品批量下架")
 | 
				
			||||||
 | 
					    @PostMapping("/putOffList")
 | 
				
			||||||
 | 
					    public AjaxResult putOffList(@RequestBody WaresPutOnIdsParams waresPutOnIdsParams) {
 | 
				
			||||||
 | 
					        if (CollectionUtils.isEmpty(waresPutOnIdsParams.getPkWares())) {
 | 
				
			||||||
 | 
					            return AjaxResult.error("商品ID不能为空");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        iBdWaresExtendService.putOffList(waresPutOnIdsParams);
 | 
				
			||||||
 | 
					        return AjaxResult.success();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,4 +49,11 @@ public interface BdWaresExtendMapper extends BaseMapper<BdWaresExtend> {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int batchUpdateInventoryUse(@Param("limitList") List<BdWaresMemberLimit> limitList);
 | 
					    int batchUpdateInventoryUse(@Param("limitList") List<BdWaresMemberLimit> limitList);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void putOnList(@Param("pkWares") List<Integer> pkWares);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void putOffList(@Param("pkWares") List<Integer> pkWares);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void updatePutOnTimeByPkWares(@Param("pkWares") List<Integer> pkWares);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void updatePutOffTimeByPkWares(@Param("pkWares") List<Integer> pkWares);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					package com.hzs.sale.wares.param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					import lombok.NoArgsConstructor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					@NoArgsConstructor
 | 
				
			||||||
 | 
					public class WaresPutOnIdsParams {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 商品主键信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private List<Integer> pkWares;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,7 @@ import com.hzs.common.domain.sale.wares.BdWaresExtend;
 | 
				
			||||||
import com.hzs.common.domain.sale.wares.BdWaresMemberLimit;
 | 
					import com.hzs.common.domain.sale.wares.BdWaresMemberLimit;
 | 
				
			||||||
import com.hzs.sale.order.param.WaresNumberParam;
 | 
					import com.hzs.sale.order.param.WaresNumberParam;
 | 
				
			||||||
import com.hzs.sale.order.vo.WaresPreSaleVo;
 | 
					import com.hzs.sale.order.vo.WaresPreSaleVo;
 | 
				
			||||||
 | 
					import com.hzs.sale.wares.param.WaresPutOnIdsParams;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
| 
						 | 
					@ -56,4 +57,7 @@ public interface IBdWaresExtendService extends IService<BdWaresExtend> {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int batchUpdateInventoryUse(List<BdWaresMemberLimit> limitList);
 | 
					    int batchUpdateInventoryUse(List<BdWaresMemberLimit> limitList);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void putOnList(WaresPutOnIdsParams waresPutOnIdsParams);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void putOffList(WaresPutOnIdsParams waresPutOnIdsParams);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
package com.hzs.sale.wares.service.impl;
 | 
					package com.hzs.sale.wares.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import cn.hutool.core.collection.CollectionUtil;
 | 
					import cn.hutool.core.collection.CollectionUtil;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
					import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
				
			||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
				
			||||||
import com.hzs.common.domain.sale.wares.BdWaresExtend;
 | 
					import com.hzs.common.domain.sale.wares.BdWaresExtend;
 | 
				
			||||||
| 
						 | 
					@ -8,18 +9,23 @@ import com.hzs.common.domain.sale.wares.BdWaresMemberLimit;
 | 
				
			||||||
import com.hzs.sale.order.param.WaresNumberParam;
 | 
					import com.hzs.sale.order.param.WaresNumberParam;
 | 
				
			||||||
import com.hzs.sale.order.vo.WaresPreSaleVo;
 | 
					import com.hzs.sale.order.vo.WaresPreSaleVo;
 | 
				
			||||||
import com.hzs.sale.wares.mapper.BdWaresExtendMapper;
 | 
					import com.hzs.sale.wares.mapper.BdWaresExtendMapper;
 | 
				
			||||||
 | 
					import com.hzs.sale.wares.param.WaresPutOnIdsParams;
 | 
				
			||||||
import com.hzs.sale.wares.service.IBdWaresExtendService;
 | 
					import com.hzs.sale.wares.service.IBdWaresExtendService;
 | 
				
			||||||
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.Collections;
 | 
					import java.util.Collections;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 商品发布扩展表 服务实现类
 | 
					 * 商品发布扩展表 服务实现类
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Service
 | 
					@Service
 | 
				
			||||||
 | 
					@Slf4j
 | 
				
			||||||
public class BdWaresExtendServiceImpl extends ServiceImpl<BdWaresExtendMapper, BdWaresExtend> implements IBdWaresExtendService {
 | 
					public class BdWaresExtendServiceImpl extends ServiceImpl<BdWaresExtendMapper, BdWaresExtend> implements IBdWaresExtendService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
| 
						 | 
					@ -62,4 +68,36 @@ public class BdWaresExtendServiceImpl extends ServiceImpl<BdWaresExtendMapper, B
 | 
				
			||||||
        return baseMapper.batchUpdateInventoryUse(limitList);
 | 
					        return baseMapper.batchUpdateInventoryUse(limitList);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    public void putOnList(WaresPutOnIdsParams waresPutOnIdsParams) {
 | 
				
			||||||
 | 
					        log.info("上架商品主键列表{}",waresPutOnIdsParams.getPkWares());
 | 
				
			||||||
 | 
					        List<BdWaresExtend> bdWaresExtends = baseMapper.selectList(new LambdaQueryWrapper<BdWaresExtend>()
 | 
				
			||||||
 | 
					                .in(BdWaresExtend::getPkWares, waresPutOnIdsParams.getPkWares())
 | 
				
			||||||
 | 
					                .eq(BdWaresExtend::getIsPutOn, 1));
 | 
				
			||||||
 | 
					        List<Integer> list = bdWaresExtends.stream().map(BdWaresExtend::getPkWares).collect(Collectors.toList());
 | 
				
			||||||
 | 
					        log.info("当前未上架商品主键列表{}",list);
 | 
				
			||||||
 | 
					        if (CollectionUtil.isEmpty(list)) {
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        baseMapper.putOnList(list);
 | 
				
			||||||
 | 
					        baseMapper.updatePutOnTimeByPkWares(list);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    public void putOffList(WaresPutOnIdsParams waresPutOnIdsParams) {
 | 
				
			||||||
 | 
					        log.info("下架商品主键列表{}",waresPutOnIdsParams.getPkWares());
 | 
				
			||||||
 | 
					        List<BdWaresExtend> bdWaresExtends = baseMapper.selectList(new LambdaQueryWrapper<BdWaresExtend>()
 | 
				
			||||||
 | 
					                .in(BdWaresExtend::getPkWares, waresPutOnIdsParams.getPkWares())
 | 
				
			||||||
 | 
					                .eq(BdWaresExtend::getIsPutOn, 0));
 | 
				
			||||||
 | 
					        List<Integer> list = bdWaresExtends.stream().map(BdWaresExtend::getPkWares).collect(Collectors.toList());
 | 
				
			||||||
 | 
					        log.info("当前未下架商品主键列表{}",list);
 | 
				
			||||||
 | 
					        if (CollectionUtil.isEmpty(list)) {
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        baseMapper.putOffList(list);
 | 
				
			||||||
 | 
					        baseMapper.updatePutOffTimeByPkWares(list);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,7 @@
 | 
				
			||||||
        LEFT JOIN BD_GRADE BG ON aaur.PK_ORIGIN_GRADE = BG.PK_ID
 | 
					        LEFT JOIN BD_GRADE BG ON aaur.PK_ORIGIN_GRADE = BG.PK_ID
 | 
				
			||||||
        LEFT JOIN BD_GRADE BGG ON aaur.PK_UPGRADE_GRADE = BGG.PK_ID
 | 
					        LEFT JOIN BD_GRADE BGG ON aaur.PK_UPGRADE_GRADE = BGG.PK_ID
 | 
				
			||||||
        WHERE
 | 
					        WHERE
 | 
				
			||||||
        aaur.DEL_FLAG = 0 AND cm.DEL_FLAG = 0 AND cm.CUSTOMER_TYPE = 0
 | 
					        aaur.DEL_FLAG = 0 AND cm.DEL_FLAG = 0 AND cm.CATEGORY = 0
 | 
				
			||||||
        <if test="actName != null and actName != ''">
 | 
					        <if test="actName != null and actName != ''">
 | 
				
			||||||
            AND abc.ACT_NAME = #{actName}
 | 
					            AND abc.ACT_NAME = #{actName}
 | 
				
			||||||
        </if>
 | 
					        </if>
 | 
				
			||||||
| 
						 | 
					@ -65,6 +65,7 @@
 | 
				
			||||||
        <if test="endActEndDate != null and endActEndDate != ''">
 | 
					        <if test="endActEndDate != null and endActEndDate != ''">
 | 
				
			||||||
            AND abc.ACT_END_DATE <= TO_DATE(SUBSTR(#{endActEndDate},1,10), 'YYYY-MM-DD')
 | 
					            AND abc.ACT_END_DATE <= TO_DATE(SUBSTR(#{endActEndDate},1,10), 'YYYY-MM-DD')
 | 
				
			||||||
        </if>
 | 
					        </if>
 | 
				
			||||||
 | 
					        ORDER BY aaur.CREATION_TIME DESC
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,4 +36,26 @@
 | 
				
			||||||
          and aba.pk_base_id = #{pkBaseId}
 | 
					          and aba.pk_base_id = #{pkBaseId}
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="queryBlood" resultType="long">
 | 
				
			||||||
 | 
					        <foreach collection="paramList" item="item" separator=" union ">
 | 
				
			||||||
 | 
					            select ${pkMember}
 | 
				
			||||||
 | 
					            from cu_member cm
 | 
				
			||||||
 | 
					            where cm.del_flag = 0
 | 
				
			||||||
 | 
					            and cm.member_code = #{item}
 | 
				
			||||||
 | 
					            start with cm.pk_id = #{pkMember}
 | 
				
			||||||
 | 
					            connect by cm.pk_id = prior cm.pk_parent
 | 
				
			||||||
 | 
					        </foreach>
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="queryPlace" resultType="long">
 | 
				
			||||||
 | 
					        <foreach collection="paramList" item="item" separator=" union ">
 | 
				
			||||||
 | 
					            select ${pkMember}
 | 
				
			||||||
 | 
					            from cu_member cm
 | 
				
			||||||
 | 
					            where cm.del_flag = 0
 | 
				
			||||||
 | 
					            and cm.member_code = #{item}
 | 
				
			||||||
 | 
					            start with cm.pk_id = #{pkMember}
 | 
				
			||||||
 | 
					            connect by cm.pk_id = prior cm.pk_place_parent
 | 
				
			||||||
 | 
					        </foreach>
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,25 +56,14 @@
 | 
				
			||||||
                    when act_end_date < sysdate then 2
 | 
					                    when act_end_date < sysdate then 2
 | 
				
			||||||
                    else 1 end)                     ACT_STATUS,
 | 
					                    else 1 end)                     ACT_STATUS,
 | 
				
			||||||
               ac.act_explain,
 | 
					               ac.act_explain,
 | 
				
			||||||
               nvl(draw.exist_draw_num, 1)          exist_draw_num,
 | 
					               nvl(draw.exist_draw_num, 1)          exist_draw_num
 | 
				
			||||||
               pk_new_people,
 | 
					 | 
				
			||||||
               nvl(people.exist_new_people_gift, 1) exist_new_people_gift
 | 
					 | 
				
			||||||
        from ac_base_config ac
 | 
					        from ac_base_config ac
 | 
				
			||||||
                 left join (
 | 
					                 left join (
 | 
				
			||||||
            select pk_base_id, 0 exist_draw_num
 | 
					            select pk_base_id, 0 exist_draw_num
 | 
				
			||||||
            from ac_draw_reward_num
 | 
					            from ac_draw_reward_num
 | 
				
			||||||
            where del_flag = 0
 | 
					            where del_flag = 0
 | 
				
			||||||
              and pk_member = #{pkMember}
 | 
					              and pk_member = #{pkMember}
 | 
				
			||||||
              and (total_surplus_num + available_surplus_num) > 0) draw
 | 
					              and (total_surplus_num + available_surplus_num) > 0) draw on ac.pk_id = draw.pk_base_id
 | 
				
			||||||
                           on ac.pk_id = draw.pk_base_id
 | 
					 | 
				
			||||||
                 left join (
 | 
					 | 
				
			||||||
            select distinct pk_base_id, pk_new_people, 0 exist_new_people_gift
 | 
					 | 
				
			||||||
            from ac_people_service
 | 
					 | 
				
			||||||
            where del_flag = 0
 | 
					 | 
				
			||||||
              and pk_member = #{pkMember}
 | 
					 | 
				
			||||||
              and plan_state = 0
 | 
					 | 
				
			||||||
        ) people
 | 
					 | 
				
			||||||
                           on ac.pk_id = people.pk_base_id
 | 
					 | 
				
			||||||
        where ac.del_flag = 0
 | 
					        where ac.del_flag = 0
 | 
				
			||||||
          and ac.pk_country = #{pkCountry}
 | 
					          and ac.pk_country = #{pkCountry}
 | 
				
			||||||
          and ac.dis_start_date <= sysdate
 | 
					          and ac.dis_start_date <= sysdate
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,7 +89,7 @@
 | 
				
			||||||
        LEFT JOIN BD_GRADE bg ON cmm.PK_SETTLE_GRADE = bg.PK_ID
 | 
					        LEFT JOIN BD_GRADE bg ON cmm.PK_SETTLE_GRADE = bg.PK_ID
 | 
				
			||||||
        LEFT JOIN AC_BASE_CONFIG abc ON adgr.PK_BASE_ID = abc.PK_ID
 | 
					        LEFT JOIN AC_BASE_CONFIG abc ON adgr.PK_BASE_ID = abc.PK_ID
 | 
				
			||||||
        WHERE
 | 
					        WHERE
 | 
				
			||||||
        so.ORDER_STATUS = 1 AND so.DEL_FLAG = 0 AND cm.DEL_FLAG = 0 AND cm.CUSTOMER_TYPE = 0 AND cmm.DEL_FLAG = 0 AND cmm.CUSTOMER_TYPE = 0
 | 
					        so.ORDER_STATUS = 1 AND so.DEL_FLAG = 0 AND cm.DEL_FLAG = 0 AND cm.CATEGORY = 0 AND cmm.DEL_FLAG = 0 AND cmm.CATEGORY = 0
 | 
				
			||||||
        <if test="actName != null and actName != ''">
 | 
					        <if test="actName != null and actName != ''">
 | 
				
			||||||
            AND abc.ACT_NAME = #{actName}
 | 
					            AND abc.ACT_NAME = #{actName}
 | 
				
			||||||
        </if>
 | 
					        </if>
 | 
				
			||||||
| 
						 | 
					@ -117,6 +117,7 @@
 | 
				
			||||||
        <if test="creationEndTime!= null and creationEndTime != ''">
 | 
					        <if test="creationEndTime!= null and creationEndTime != ''">
 | 
				
			||||||
            AND adgr.CREATION_TIME <= #{creationEndTime}
 | 
					            AND adgr.CREATION_TIME <= #{creationEndTime}
 | 
				
			||||||
        </if>
 | 
					        </if>
 | 
				
			||||||
 | 
					        ORDER BY so.PAY_TIME DESC
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <select id="selectLastRecord" resultType="com.hzs.common.domain.activity.declaration.AcDeclarationGiftRecord">
 | 
					    <select id="selectLastRecord" resultType="com.hzs.common.domain.activity.declaration.AcDeclarationGiftRecord">
 | 
				
			||||||
        SELECT *
 | 
					        SELECT *
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,5 +73,42 @@
 | 
				
			||||||
        </if>
 | 
					        </if>
 | 
				
			||||||
        order by ac.SORT desc
 | 
					        order by ac.SORT desc
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 | 
					    <select id="selectByAreaClassifyListAll" resultType="com.hzs.sale.product.vo.AreaClassifyTreeVo">
 | 
				
			||||||
 | 
					        select ac.*,pac.CLASSIFY_NAME parentClassifyName from BD_AREA_CLASSIFY ac
 | 
				
			||||||
 | 
					        left join BD_AREA_CLASSIFY pac on pac.PK_ID = ac.PK_PARENT
 | 
				
			||||||
 | 
					        where ac.DEL_FLAG = 0
 | 
				
			||||||
 | 
					        <if test="pkCountry != null">
 | 
				
			||||||
 | 
					            and ac.PK_COUNTRY = #{pkCountry}
 | 
				
			||||||
 | 
					        </if>
 | 
				
			||||||
 | 
					        <if test="enableState != null">
 | 
				
			||||||
 | 
					            AND ac.ENABLE_STATE = #{enableState}
 | 
				
			||||||
 | 
					        </if>
 | 
				
			||||||
 | 
					        <if test="specialArea != null">
 | 
				
			||||||
 | 
					            AND (
 | 
				
			||||||
 | 
					            (select count(csa.PK_ID) from BD_AREA_CLASSIFY_SPECIAL_AREA csa where csa.SPECIAL_AREA = #{specialArea} and csa.PK_AREA_CLASSIFY =
 | 
				
			||||||
 | 
					            ac.PK_ID ) > 0
 | 
				
			||||||
 | 
					            or
 | 
				
			||||||
 | 
					            (
 | 
				
			||||||
 | 
					            select count(t.PK_ID)
 | 
				
			||||||
 | 
					            from BD_AREA_CLASSIFY t
 | 
				
			||||||
 | 
					            where (select count(csa.PK_ID) from BD_AREA_CLASSIFY_SPECIAL_AREA csa where csa.SPECIAL_AREA = #{specialArea} and csa.PK_AREA_CLASSIFY =
 | 
				
			||||||
 | 
					            t.PK_ID) > 0
 | 
				
			||||||
 | 
					            start with t.pk_id = ac.PK_ID
 | 
				
			||||||
 | 
					            connect by t.pk_id = prior t.pk_parent
 | 
				
			||||||
 | 
					            ) > 0
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        </if>
 | 
				
			||||||
 | 
					        <if test="hierarchy != null">
 | 
				
			||||||
 | 
					            AND ac.HIERARCHY = #{hierarchy}
 | 
				
			||||||
 | 
					        </if>
 | 
				
			||||||
 | 
					        <if test="isRecommend != null">
 | 
				
			||||||
 | 
					            AND ac.IS_RECOMMEND = #{isRecommend}
 | 
				
			||||||
 | 
					        </if>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <if test="classifyName != null and classifyName !='' ">
 | 
				
			||||||
 | 
					            AND ac.CLASSIFY_NAME like #{classifyName}||'%'
 | 
				
			||||||
 | 
					        </if>
 | 
				
			||||||
 | 
					        order by ac.SORT desc
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -100,5 +100,37 @@
 | 
				
			||||||
        when matched then
 | 
					        when matched then
 | 
				
			||||||
        update set bwe.inventory_use = bwe.inventory_use + tmp.quantity
 | 
					        update set bwe.inventory_use = bwe.inventory_use + tmp.quantity
 | 
				
			||||||
    </update>
 | 
					    </update>
 | 
				
			||||||
 | 
					    <update id="putOnList">
 | 
				
			||||||
 | 
					        update BD_WARES_EXTEND
 | 
				
			||||||
 | 
					        SET IS_PUT_ON = 0
 | 
				
			||||||
 | 
					        WHERE PK_WARES IN
 | 
				
			||||||
 | 
					        <foreach collection="pkWares" item="id" open="(" separator="," close=")">
 | 
				
			||||||
 | 
					            #{id}
 | 
				
			||||||
 | 
					        </foreach>
 | 
				
			||||||
 | 
					    </update>
 | 
				
			||||||
 | 
					    <update id="putOffList">
 | 
				
			||||||
 | 
					        update BD_WARES_EXTEND
 | 
				
			||||||
 | 
					        SET IS_PUT_ON = 1
 | 
				
			||||||
 | 
					        WHERE PK_WARES IN
 | 
				
			||||||
 | 
					        <foreach collection="pkWares" item="id" open="(" separator="," close=")">
 | 
				
			||||||
 | 
					            #{id}
 | 
				
			||||||
 | 
					        </foreach>
 | 
				
			||||||
 | 
					    </update>
 | 
				
			||||||
 | 
					    <update id="updatePutOnTimeByPkWares">
 | 
				
			||||||
 | 
					        update BD_WARES
 | 
				
			||||||
 | 
					        SET LISTING_TIME = SYSDATE
 | 
				
			||||||
 | 
					        WHERE PK_ID IN
 | 
				
			||||||
 | 
					        <foreach collection="pkWares" item="id" open="(" separator="," close=")">
 | 
				
			||||||
 | 
					            #{id}
 | 
				
			||||||
 | 
					        </foreach>
 | 
				
			||||||
 | 
					    </update>
 | 
				
			||||||
 | 
					    <update id="updatePutOffTimeByPkWares">
 | 
				
			||||||
 | 
					        update BD_WARES
 | 
				
			||||||
 | 
					        SET REMOVAL_TIME = SYSDATE
 | 
				
			||||||
 | 
					        WHERE PK_ID IN
 | 
				
			||||||
 | 
					        <foreach collection="pkWares" item="id" open="(" separator="," close=")">
 | 
				
			||||||
 | 
					            #{id}
 | 
				
			||||||
 | 
					        </foreach>
 | 
				
			||||||
 | 
					    </update>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -263,6 +263,9 @@
 | 
				
			||||||
        <if test="waresStatus != null">
 | 
					        <if test="waresStatus != null">
 | 
				
			||||||
            and bw.WARES_STATUS <= #{waresStatus}
 | 
					            and bw.WARES_STATUS <= #{waresStatus}
 | 
				
			||||||
        </if>
 | 
					        </if>
 | 
				
			||||||
 | 
					        <if test="isMakerGift != null">
 | 
				
			||||||
 | 
					            and we.IS_MAKER_GIFT = #{isMakerGift}
 | 
				
			||||||
 | 
					        </if>
 | 
				
			||||||
        order by bw.sort desc, bw.CREATION_TIME desc
 | 
					        order by bw.sort desc, bw.CREATION_TIME desc
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,6 +110,10 @@ public enum EOperationBusiness {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    WARES_LIST("商品列表"),
 | 
					    WARES_LIST("商品列表"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    PUT_ON_LIST("商品批量上架"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    PUT_OFF_LIST("商品批量下架"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AREA_CLASSIFY("商品分类"),
 | 
					    AREA_CLASSIFY("商品分类"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    PRODUCT_CLASSIFY("产品分类"),
 | 
					    PRODUCT_CLASSIFY("产品分类"),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,6 +72,10 @@ public enum EOperationModule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    WARES_LIST("商品列表"),
 | 
					    WARES_LIST("商品列表"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    PUT_ON_LIST("商品批量上架"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    PUT_OFF_LIST("商品批量下架"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AREA_CLASSIFY("商品分类"),
 | 
					    AREA_CLASSIFY("商品分类"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SPECIFICATIONS_CONFIG("规格配置"),
 | 
					    SPECIFICATIONS_CONFIG("规格配置"),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,9 +9,6 @@ import java.io.Serializable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 活动基础权限表
 | 
					 * 活动基础权限表
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @author hzs
 | 
					 | 
				
			||||||
 * @since 2025-02-18
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@Accessors(chain = true)
 | 
					@Accessors(chain = true)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
package com.hzs.third.pay.controller.notify;
 | 
					package com.hzs.third.pay.controller.notify;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.hutool.core.util.StrUtil;
 | 
				
			||||||
import cn.hutool.json.JSONUtil;
 | 
					import cn.hutool.json.JSONUtil;
 | 
				
			||||||
import com.hzs.common.core.enums.EPayChannel;
 | 
					import com.hzs.common.core.enums.EPayChannel;
 | 
				
			||||||
import com.hzs.common.core.enums.EPayType;
 | 
					import com.hzs.common.core.enums.EPayType;
 | 
				
			||||||
| 
						 | 
					@ -153,6 +154,9 @@ public class JdPayNotifyController extends JdBaseController {
 | 
				
			||||||
        return ERROR;
 | 
					        return ERROR;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    private Integer convertPayType(String payName){
 | 
					    private Integer convertPayType(String payName){
 | 
				
			||||||
 | 
					        if(StrUtil.isEmpty(payName)){
 | 
				
			||||||
 | 
					            payName = "";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        Integer result = EPayType.WECHAT.getValue();
 | 
					        Integer result = EPayType.WECHAT.getValue();
 | 
				
			||||||
        switch (payName){
 | 
					        switch (payName){
 | 
				
			||||||
            case "XJK":
 | 
					            case "XJK":
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,20 +12,24 @@ import java.util.TreeMap;
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class PayUtil {
 | 
					public class PayUtil {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 支付大于1元才能进行随机减
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    final static BigDecimal RANDOM_LIMIT = new BigDecimal("1");
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 随机减金额
 | 
					     * 随机减金额
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    final static BigDecimal RANDOM = new BigDecimal("0.5");
 | 
					    final static BigDecimal RANDOM = new BigDecimal("0.3");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 计算随机金额,0.2元进行随机生成
 | 
					     * 计算随机金额,0.3元进行随机生成
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param amount
 | 
					     * @param amount
 | 
				
			||||||
     * @return
 | 
					     * @return
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static BigDecimal handleAmountRandom(BigDecimal amount) {
 | 
					    public static BigDecimal handleAmountRandom(BigDecimal amount) {
 | 
				
			||||||
        if (amount.compareTo(RANDOM) > 0) {
 | 
					        if (amount.compareTo(RANDOM_LIMIT) >= 0) {
 | 
				
			||||||
            // 订单金额大于0.99元才进行处理
 | 
					            // 订单金额大于1元才进行处理
 | 
				
			||||||
            return amount.subtract(RANDOM).add(RandomUtil.randomBigDecimal(new BigDecimal("0.01"), RANDOM).setScale(2, BigDecimal.ROUND_HALF_UP));
 | 
					            return amount.subtract(RANDOM).add(RandomUtil.randomBigDecimal(new BigDecimal("0.01"), RANDOM).setScale(2, BigDecimal.ROUND_HALF_UP));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return amount;
 | 
					        return amount;
 | 
				
			||||||
| 
						 | 
					@ -39,7 +43,7 @@ public class PayUtil {
 | 
				
			||||||
     * @return
 | 
					     * @return
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static boolean checkAmount(BigDecimal amount, BigDecimal payAmount) {
 | 
					    public static boolean checkAmount(BigDecimal amount, BigDecimal payAmount) {
 | 
				
			||||||
        // 实际订单金额 - 支付金额 <= 0.2 则为正常处理
 | 
					        // 实际订单金额 - 支付金额 <= 0.3 则为正常处理
 | 
				
			||||||
        return amount.subtract(payAmount).compareTo(RANDOM) <= 0;
 | 
					        return amount.subtract(payAmount).compareTo(RANDOM) <= 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue