Browse Source

Merge remote-tracking branch 'origin/test' into test

songyh 3 years ago
parent
commit
b00ff0d3eb

+ 30 - 7
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java

@@ -185,12 +185,13 @@ public class CwjsPolicyInfoController {
         List<CwjsCompanyApprovalUser> cwjsCompanyApprovalUserList = companyApprovalUserMapper.queryByUserId(userId);
 		List<CwjsPolicyInfo> cwjsPolicyInfoList = cwjsPolicyInfoService.queryPageList(cwjsPolicyInfo);
 		if(Check.isNull(cwjsPolicyInfoList)){
-			return Result.successMsg("目前没有政策,请新增",null);
+			PageInfo<CwjsPolicyInfo> pageInfo = new PageInfo<>(cwjsPolicyInfoList);
+			return Result.successMsg("目前没有政策,请新增",pageInfo);
 		}
         /**如果是管理员,就全部看,该搜索搜索,不搜索就全看*/
 
         /**如果不是管理员,也不是审核人员。看自己和自己下属的所有政策。*/
-        if(!"admin".equalsIgnoreCase(roleCode) && Check.isNull(cwjsCompanyApprovalUserList)){
+        if(!"admin".equalsIgnoreCase(roleCode) && !"finance".equalsIgnoreCase(roleCode) && Check.isNull(cwjsCompanyApprovalUserList)){
 //			Set<String> userIds= materialReportOverViewService.recursiveQuerySubordinate(userId);
 			List<String> userIds = cwjsPolicyInfoService.getAllSubordinate(userId);
 			List<CwjsPolicyInfo> removeList = new ArrayList<>();
@@ -202,7 +203,7 @@ public class CwjsPolicyInfoController {
             cwjsPolicyInfoList.removeAll(removeList);
         }
         /**如果不是管理员,是审核人员。看自己创建的和自己下属的所有政策、和该自己审核。*/
-        if(!"admin".equalsIgnoreCase(roleCode) && !Check.isNull(cwjsCompanyApprovalUserList)){
+        if(!"admin".equalsIgnoreCase(roleCode) && !"finance".equalsIgnoreCase(roleCode) && !Check.isNull(cwjsCompanyApprovalUserList)){
 //			Set<String> userIds= materialReportOverViewService.recursiveQuerySubordinate(userId);
 			List<String> userIds = cwjsPolicyInfoService.getAllSubordinate(userId);
 
@@ -226,7 +227,7 @@ public class CwjsPolicyInfoController {
 			}
             cwjsPolicy.setOperation("查看");  //所有人只要能看到就能有查看的按钮
 			if(userId.equals(cwjsPolicy.getCreateUserId()) && cwjsPolicy.getApprovedStatus() == 4){ //创建人是自己且状态是审核拒绝的
-                cwjsPolicy.setOperation("编辑|提交审核");
+                cwjsPolicy.setOperation("查看|编辑|提交审核");
             }
 
 			if(userId.equals(cwjsPolicy.getApprovedProgress()) && (cwjsPolicy.getApprovedStatus() == 1 || cwjsPolicy.getApprovedStatus() == 2)){
@@ -256,7 +257,7 @@ public class CwjsPolicyInfoController {
 	public Result getAllSaleList(@RequestParam(name="userId",required=true) String userId){
         String roleCode = roleService.getRoleCodeByUserId(userId);
         List<JSONObject> allSaleList;
-        if("admin".equalsIgnoreCase(roleCode)){
+        if("admin".equalsIgnoreCase(roleCode) || "finance".equalsIgnoreCase(roleCode)){
             allSaleList = cwjsPolicyInfoService.getAllSale();
         }else{
             allSaleList = cwjsPolicyInfoService.getAllSaleByUserId(userId);
@@ -302,7 +303,7 @@ public class CwjsPolicyInfoController {
 			String areaInfo = cwjsPolicyInfo.getAreaInfo();
 			Integer companySubjectId = companySubjectMapper.queryIdBySubjectNameAndArea(companySubjectName, areaInfo);
 			if(Check.isNull(companySubjectId)){
-				return  Result.errorMsg("您选择的区域和公司主体不合法,请联系开发人员");
+				return  Result.errorMsg("您选择的区域和公司主体系统不支持,请联系开发人员开放");
 			}
 			cwjsPolicyInfo.setCompanySubjectId(companySubjectId);
 			List<CwjsCompanyApprovalUser> cwjsCompanyApprovalUsers = companyApprovalUserMapper.queryByCompanySubjectId(companySubjectId);
@@ -354,6 +355,28 @@ public class CwjsPolicyInfoController {
 		if(cwjsPolicyInfoEntity==null) {
 			result.error500("未找到对应实体");
 		}else {
+			String companySubjectName = cwjsPolicyInfo.getCompanySubjectName();
+			String areaInfo = cwjsPolicyInfo.getAreaInfo();
+			Integer companySubjectId = companySubjectMapper.queryIdBySubjectNameAndArea(companySubjectName, areaInfo);
+			if(Check.isNull(companySubjectId)){
+				return  Result.errorMsg("您要修改的区域和公司主体系统不支持,请联系开发人员开放");
+			}
+			cwjsPolicyInfo.setCompanySubjectId(companySubjectId);
+			//删除旧的产品
+			cwjsPolicyProductService.deleteProductsByPolicyId(cwjsPolicyInfo.getId());
+			//保存新的产品
+			List<CwjsPolicyProduct> policyProductList = new ArrayList<>();
+			JSONArray products = cwjsPolicyInfo.getPolicyProductName();
+			products.forEach(productName -> {
+				CwjsPolicyProduct policyProduct = new CwjsPolicyProduct();
+				policyProduct.setCreateUserId(cwjsPolicyInfo.getCreateUserId());
+				policyProduct.setDelFlag(0);
+				policyProduct.setPolicyProductName((String) productName);
+				policyProduct.setPolicyId(cwjsPolicyInfo.getId());
+				policyProductList.add(policyProduct);
+			});
+			cwjsPolicyProductService.saveBatch(policyProductList);
+
 			boolean ok = cwjsPolicyInfoService.updateById(cwjsPolicyInfo);
 			if(ok) {
 				result.success("修改成功!");
@@ -372,7 +395,7 @@ public class CwjsPolicyInfoController {
 	 */
 	@ApiOperation(value="政策信息表-通过id查询", notes="政策信息表-通过id查询")
 	@GetMapping(value = "/queryById")
-	public Result<CwjsPolicyInfo> queryById(@RequestParam(name="id",required=true) String id) throws ParseException {
+	public Result<CwjsPolicyInfo> queryById(@RequestParam(name="id",required=true) Integer id) throws ParseException {
 		Result<CwjsPolicyInfo> result = new Result<>();
 		CwjsPolicyInfo cwjsPolicyInfo = cwjsPolicyInfoService.getById(id);
 		Date startDate = DateUtils.parseDate(cwjsPolicyInfo.getPolicyStartDate(),"yyyy-MM-dd");

+ 2 - 2
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyInfo.java

@@ -130,9 +130,9 @@ public class CwjsPolicyInfo {
 	private String productName;
 
 	@TableField(exist = false)
-	private Date startTime;
+	private String startTime;
 	@TableField(exist = false)
-	private Date endTime;
+	private String endTime;
 	@TableField(exist = false)
 	private List<String> createUserIds;
 	@TableField(exist = false)

+ 3 - 1
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyProductMapper.java

@@ -13,5 +13,7 @@ import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
  * @version V1.0
  */
 public interface CwjsPolicyProductMapper extends BaseMapper<CwjsPolicyProduct> {
-    List<CwjsPolicyProduct> queryProductsByPolicyId(String policyId);
+    List<CwjsPolicyProduct> queryProductsByPolicyId(Integer policyId);
+
+    void deleteProductsByPolicyId(Integer policyId);
 }

+ 6 - 5
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyInfoMapper.xml

@@ -6,11 +6,12 @@
         where 1=1
         <if test="companyName != null and companyName != ''">and t2.company_name like concat(concat('%',#{companyName}),'%')</if>
         <if test="advertiserName != null and advertiserName != ''">and t2.advertiser_name like concat(concat('%',#{advertiserName}),'%')</if>
-        <if test="productName != null and productName != ''">and t2.policy_product_name like concat(concat('%',#{productName}),'%')</if>
+        <if test="productName != null and productName != ''">and t1.policy_product_name like concat(concat('%',#{productName}),'%')</if>
         <if test="dianPayCompanyName != null and dianPayCompanyName != ''">and t2.dian_pay_company_name like concat(concat('%',#{dianPayCompanyName}),'%')</if>
-        <if test="mediaType != null and mediaType != ''">and t2.media_type = #{mediaType}</if>
-        <if test="rebateType != null and rebateType != ''">and t2.rebate_type = #{rebateType}</if>
+        <if test="mediaType != null">and t2.media_type = #{mediaType}</if>
+        <if test="rebateType != null">and t2.rebate_type = #{rebateType}</if>
         <if test="createUserId != null and createUserId != ''">and t2.create_user_id = #{createUserId}</if>
+        <if test="createUserName != null and createUserName != ''">and t2.create_user_name = #{createUserName}</if>
         <if test="createUserIds != null and createUserIds != ''">and  t2.create_user_id in
          <foreach item="item" index="index" collection="createUserIds" open="(" separator="," close=")">
             #{item}
@@ -19,7 +20,7 @@
             <foreach item="item" index="index" collection="companySubjectIds" open="(" separator="," close=")">
                 #{item}
             </foreach></if>
-        <if test="promotionType != null and promotionType != ''">and t2.promotion_type = #{promotionType}</if>
+        <if test="promotionType != null">and t2.promotion_type = #{promotionType}</if>
         <if test="approvedStatus != null and approvedStatus != ''">and t2.approved_status = #{approvedStatus}</if>
         <if test="startTime != null and startTime != ''">and t2.create_time &gt;= #{startTime}</if>
         <if test="endTime != null and endTime != ''">and t2.create_time &lt;= #{endTime}</if>
@@ -46,7 +47,7 @@
             , 'salesSupportManager'
             , 'saleAm'
             )
-            and t1.company_id = #{companyId}
+
     </select>
 
     <select id="getAllSaleByUserId" resultType="com.alibaba.fastjson.JSONObject">

+ 4 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyProductMapper.xml

@@ -4,4 +4,8 @@
     <select id="queryProductsByPolicyId" resultType="org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct">
         select * from ctop_cwjs_policy_product where policy_id = #{policyId} and del_flag = 0
     </select>
+
+    <delete id="deleteProductsByPolicyId">
+        delete from ctop_cwjs_policy_product where policy_id = #{policyId}
+    </delete>
 </mapper>

+ 3 - 1
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyProductService.java

@@ -13,5 +13,7 @@ import java.util.List;
  */
 public interface ICwjsPolicyProductService extends IService<CwjsPolicyProduct> {
 
-    List<CwjsPolicyProduct> queryProductsByPolicyId(String policyId);
+    List<CwjsPolicyProduct> queryProductsByPolicyId(Integer policyId);
+
+    void deleteProductsByPolicyId(Integer policyId);
 }

+ 7 - 1
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyProductServiceImpl.java

@@ -22,7 +22,13 @@ public class CwjsPolicyProductServiceImpl extends ServiceImpl<CwjsPolicyProductM
     CwjsPolicyProductMapper policyProductMapper;
 
     @Override
-    public List<CwjsPolicyProduct> queryProductsByPolicyId(String policyId){
+    public List<CwjsPolicyProduct> queryProductsByPolicyId(Integer policyId){
         return policyProductMapper.queryProductsByPolicyId(policyId);
     }
+
+
+    @Override
+    public void deleteProductsByPolicyId(Integer policyId){
+        policyProductMapper.deleteProductsByPolicyId(policyId);
+    }
 }

+ 12 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml

@@ -7,8 +7,19 @@
 	</select>
 
     <!-- 根据用户名查询 -->
+    <!-- 修改前的版本select * from  sys_user  where username = #{username} and del_flag = 0 -->
     <select id="getUserByName" resultType="org.jeecg.common.system.entity.SysUser">
-		select * from  sys_user  where username = #{username} and del_flag = 0
+
+		SELECT
+            t2.*,
+            t4.role_name
+        FROM
+            sys_user t2
+        LEFT JOIN sys_user_role t3 ON t2.id = t3.user_id
+        LEFT JOIN sys_role t4 ON t3.role_id = t4.id
+        WHERE
+            t2.username = #{username}
+        AND t2.del_flag = 0
 	</select>
 
     <!-- 根据部门Id查询 -->

+ 4 - 4
jeecg-cloud-module/jeecg-cloud-gateway/src/main/resources/application-dev.yml

@@ -26,12 +26,12 @@ spring:
           - Path=/jeecg-boot/**
         filters:
           - DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
-      - id: finance
-        uri: lb://jeecg-boot-finance
-        predicates:
-          - Path=/finance/**
+      - id: jeecg-cloud-finance
+        uri: lb://jeecg-cloud-finance
         filters:
           - DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
+        predicates:
+          - Path=/finance/**
       - id: jeecg-bytedance-ad
         uri: lb://jeecg-bytedance-ad
         predicates: