yangdamao 9 сар өмнө
parent
commit
30b488b3a0

+ 10 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/base/UserProfileController.java

@@ -10,6 +10,7 @@ import cn.hutool.core.lang.Validator;
 import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.framework.web.service.TokenService;
+import com.zhongzheng.modules.base.bo.UserCardEditBo;
 import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
 import com.zhongzheng.modules.base.vo.UserProfileExportVo;
 import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportVo;
@@ -93,6 +94,15 @@ public class UserProfileController extends BaseController {
         return AjaxResult.success(iUserProfileService.queryById(id));
     }
 
+    /**
+     * 修改身份证正反面照片
+     */
+    @ApiOperation("修改身份证正反面照片")
+    @PostMapping("/edit/card")
+    public AjaxResult<Void> editUserCard(@RequestBody UserCardEditBo bo) {
+        return toAjax(iUserProfileService.editUserCard(bo) ? 1 : 0);
+    }
+
     /**
      * 修改填写资料审核
      */

+ 20 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/UserCardEditBo.java

@@ -0,0 +1,20 @@
+package com.zhongzheng.modules.base.bo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class UserCardEditBo implements Serializable {
+
+    private Long id;
+
+    private Long userId;
+
+    private String idCard1;
+
+    private String idCard2;
+
+    private Integer degree;
+}

+ 3 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IUserProfileService.java

@@ -1,14 +1,11 @@
 package com.zhongzheng.modules.base.service;
 
 import com.zhongzheng.common.core.domain.model.LoginUser;
-import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
+import com.zhongzheng.modules.base.bo.*;
 import com.zhongzheng.modules.base.domain.UserProfile;
 import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
 import com.zhongzheng.modules.base.vo.UserProfileExportVo;
 import com.zhongzheng.modules.base.vo.UserProfileVo;
-import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
-import com.zhongzheng.modules.base.bo.UserProfileAddBo;
-import com.zhongzheng.modules.base.bo.UserProfileEditBo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 
@@ -81,4 +78,6 @@ public interface IUserProfileService extends IService<UserProfile> {
 	Integer getProfileStatusNum(ConsoleQueryBo bo);
 
     UserProfile getByOrderGoodsIdNoTenant(Long orderGoodsId);
+
+	boolean editUserCard(UserCardEditBo bo);
 }

+ 49 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -28,9 +28,7 @@ import com.zhongzheng.modules.alioss.bo.OssRequest;
 import com.zhongzheng.modules.alioss.service.impl.OssServiceImpl;
 import com.zhongzheng.modules.alisms.service.IAliSmsService;
 import com.zhongzheng.modules.base.bo.*;
-import com.zhongzheng.modules.base.vo.JsonBean;
-import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
-import com.zhongzheng.modules.base.vo.UserProfileExportVo;
+import com.zhongzheng.modules.base.vo.*;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
@@ -60,7 +58,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
 import com.zhongzheng.modules.base.domain.UserProfile;
 import com.zhongzheng.modules.base.mapper.UserProfileMapper;
-import com.zhongzheng.modules.base.vo.UserProfileVo;
 import com.zhongzheng.modules.base.service.IUserProfileService;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
@@ -1075,6 +1072,54 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         return baseMapper.getByOrderGoodsIdNoTenant(orderGoodsId);
     }
 
+    @Override
+    public boolean editUserCard(UserCardEditBo bo) {
+        UserProfile userProfile = getById(bo.getId());
+        if (ObjectUtils.isNull(userProfile)){
+            throw new CustomException("获取用户资料失败!");
+        }
+        User user = iUserService.getById(userProfile.getUserId());
+        if (ObjectUtils.isNull(user)){
+            throw new CustomException("用户信息获取失败!");
+        }
+        if (ObjectUtils.isNotNull(bo.getDegree())){
+            if (bo.getDegree() < 0){
+                //角度为负数
+                bo.setDegree(bo.getDegree() + 360);
+            }
+            //调整照片角度
+            if (ObjectUtils.isNotNull(bo.getIdCard1())){
+                ossService.processObject(bo.getIdCard1(),bo.getIdCard1(), String.format("image/rotate,%s", bo.getDegree()));
+            }
+            if (ObjectUtils.isNotNull(bo.getIdCard2())){
+                ossService.processObject(bo.getIdCard2(),bo.getIdCard2(), String.format("image/rotate,%s", bo.getDegree()));
+            }
+        }else {
+            //更换照片
+            String keyValue = userProfile.getKeyValue();
+            JsonBean jsonBean = JSON.parseObject(keyValue, JsonBean.class);
+            if (ObjectUtils.isNotNull(bo.getIdCard1())){
+                if (Validator.isNotEmpty(jsonBean.getIdcard_face_photo())) {
+                    Idcard_face_photo idcard1 = jsonBean.getIdcard_face_photo();
+                    idcard1.setValue(bo.getIdCard1());
+                }
+                user.setIdCardImg1(bo.getIdCard1());
+            }
+            if (ObjectUtils.isNotNull(bo.getIdCard2())){
+                if (Validator.isNotEmpty(jsonBean.getIdcard_national_photo())) {
+                    Idcard_national_photo idcard2 = jsonBean.getIdcard_national_photo();
+                    idcard2.setValue(bo.getIdCard2());
+                }
+                user.setIdCardImg2(bo.getIdCard2());
+            }
+            String jsonString = JSON.toJSONString(jsonBean);
+            userProfile.setKeyValue(jsonString);
+            updateById(userProfile);
+            iUserService.updateById(user);
+        }
+        return true;
+    }
+
     /**
      * url读取image转换为Base64字符串
      *

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderExportNewBo.java

@@ -4,10 +4,13 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 @Data
 public class OrderExportNewBo implements Serializable {
 
+    @ApiModelProperty("订单号集合")
+    private List<String> orderSnList;
     @ApiModelProperty("订单号")
     private String orderSn;
     @ApiModelProperty("订单开始时间")

+ 56 - 23
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderExportNewVo.java

@@ -17,15 +17,29 @@ import java.math.BigDecimal;
  */
 @Data
 @ApiModel("订单视图对象")
-public class OrderExportNewVo implements Serializable {
+public class  OrderExportNewVo implements Serializable {
 
     /**
      * 订单时间
      */
-    @Excel(name = "订单时间")
-    @ApiModelProperty("订单时间")
+    @Excel(name = "订单号")
+    @ApiModelProperty("订单号")
+    private String orderSn;
+
+    /**
+     * 订单时间
+     */
+    @Excel(name = "下单时间")
+    @ApiModelProperty("下单时间")
     private String orderTime;
 
+    /**
+     * 订单状态
+     */
+    @Excel(name = "订单状态")
+    @ApiModelProperty("订单状态")
+    private String orderStatus;
+
     /**
      * 学员姓名
      */
@@ -50,43 +64,62 @@ public class OrderExportNewVo implements Serializable {
     @Excel(name = "公司名称")
     @ApiModelProperty("公司名称")
     private String companyName;
-    /**
-     * 订单编号
-     */
-    @Excel(name = "订单编号")
-    @ApiModelProperty("订单编号")
-    private String orderSn;
+
 
     /**
      * 商品名称
      */
-    @Excel(name = "商品名称")
-    @ApiModelProperty("商品名称")
+    @Excel(name = "课程名称")
+    @ApiModelProperty("课程名称")
     private String goodsName;
 
+    /**
+     * 年份
+     */
+    @Excel(name = "年份")
+    @ApiModelProperty("年份")
+    private String sevenYear;
+
+    /**
+     * 业务层次
+     */
+    @Excel(name = "业务层次")
+    @ApiModelProperty("业务层次")
+    private String businessName;
+
     /**
      * 报名岗位
      */
     @Excel(name = "报名岗位")
     @ApiModelProperty("报名岗位")
-    private String majorName;
+    private String categoryName;
 
     /**
-     * 商品年份
+     * 班级名称
      */
-    @Excel(name = "商品年份")
-    @ApiModelProperty("商品年份")
-    private String goodsYear;
+    @Excel(name = "班级名称")
+    @ApiModelProperty("班级名称")
+    private String className;
 
     /**
-     * 是否关闭过订单
+     * 班级状态
      */
-    @Excel(name = "订单是否关闭")
-    @ApiModelProperty("订单是否关闭")
-    private String orderStatus;
+    @Excel(name = "班级状态")
+    @ApiModelProperty("班级状态")
+    private String classStatus;
+
+    /**
+     * 班级结束时间
+     */
+    @Excel(name = "班级结束时间")
+    @ApiModelProperty("班级结束时间")
+    private String classEndTime;
 
-    @Excel(name = "是否学时复购冲突")
-    @ApiModelProperty("是否学时复购冲突")
-    private String studyStatus;
+    /**
+     * 学习进度
+     */
+    @Excel(name = "学习进度")
+    @ApiModelProperty("学习进度")
+    private String studySchedule;
 
 }

+ 100 - 18
zhongzheng-system/src/main/resources/mapper/modules/order/OrderMapper.xml

@@ -735,34 +735,115 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </select>
 
+<!--    <select id="exportNew" resultType="com.zhongzheng.modules.order.vo.OrderExportNewVo"-->
+<!--            parameterType="com.zhongzheng.modules.order.bo.OrderExportNewBo">-->
+<!--        SELECT-->
+<!--            FROM_UNIXTIME( og.create_time, '%Y-%m-%d %H:%i:%s' ) AS orderTime,-->
+<!--            u.realname AS realname,-->
+<!--            AES_DECRYPT( UNHEX( u.id_card ), 'base20230213zzkj' ) AS idCard,-->
+<!--            AES_DECRYPT( UNHEX( u.telphone ), 'base20230213zzkj' ) AS telphone,-->
+<!--            u.company_name AS companyName,-->
+<!--            m.category_name AS majorName,-->
+<!--            g.seven_year AS goodsYear,-->
+<!--            CASE-->
+<!--            WHEN og.`status` = 1 THEN-->
+<!--            '否'-->
+<!--            WHEN og.`status` = 0 THEN-->
+<!--            '是' ELSE '其他'-->
+<!--            END AS orderStatus-->
+<!--        FROM-->
+<!--            order_goods og-->
+<!--        LEFT JOIN `order` o ON og.order_sn = o.order_sn-->
+<!--        LEFT JOIN `user` u ON o.user_id = u.user_id-->
+<!--        LEFT JOIN goods g ON og.goods_id = g.goods_id-->
+<!--        LEFT JOIN major m ON g.major_id = m.id-->
+<!--        WHERE-->
+<!--        og.refund_status != 2-->
+<!--        AND og.pay_status != 1-->
+<!--        <if test="orderSn != null and orderSn != ''">-->
+<!--            AND o.order_sn = #{orderSn}-->
+<!--        </if>-->
+<!--        <if test="orderStartTime != null and orderStartTime != ''">-->
+<!--            AND og.create_time <![CDATA[ >= ]]> #{orderStartTime}-->
+<!--        </if>-->
+<!--        <if test="orderEndTime != null and orderEndTime != ''">-->
+<!--            AND og.create_time <![CDATA[ <= ]]> #{orderEndTime}-->
+<!--        </if>-->
+<!--        <if test="educationTypeId != null and educationTypeId != ''">-->
+<!--            AND g.education_type_id = #{educationTypeId}-->
+<!--        </if>-->
+<!--        <if test="businessId != null and businessId != ''">-->
+<!--            AND g.business_id = #{businessId}-->
+<!--        </if>-->
+<!--        <if test="companyName != null and companyName != ''">-->
+<!--            AND u.company_name = #{companyName}-->
+<!--        </if>-->
+<!--    </select>-->
+
     <select id="exportNew" resultType="com.zhongzheng.modules.order.vo.OrderExportNewVo"
             parameterType="com.zhongzheng.modules.order.bo.OrderExportNewBo">
         SELECT
-            FROM_UNIXTIME( og.create_time, '%Y-%m-%d %H:%i:%s' ) AS orderTime,
-            u.realname AS realname,
-            AES_DECRYPT( UNHEX( u.id_card ), 'base20230213zzkj' ) AS idCard,
-            AES_DECRYPT( UNHEX( u.telphone ), 'base20230213zzkj' ) AS telphone,
-            u.company_name AS companyName,
-            m.category_name AS majorName,
-            g.seven_year AS goodsYear,
-            CASE
-            WHEN og.`status` = 1 THEN
-            '否'
-            WHEN og.`status` = 0 THEN
-            '是' ELSE '其他'
-            END AS orderStatus
+        o.order_sn,
+        FROM_UNIXTIME( og.create_time, '%Y-%m-%d %H:%i:%s' ) AS orderTime,
+        u.realname,
+        AES_DECRYPT(UNHEX(u.id_card),'base20230213zzkj') AS idCard,
+        AES_DECRYPT(UNHEX(u.telphone),'base20230213zzkj') AS telphone,
+        u.company_name AS companyName,
+        g.goods_name AS goodsName,
+        g.seven_year AS sevenYear,
+        CONCAT(cet.education_name,cb.business_name,cpt.project_name) AS businessName,
+        m.category_name AS categoryName,
+        cg.class_name AS className,
+        CASE
+        WHEN cg.class_status = 1 THEN '已开班'
+        WHEN cg.class_status = 0 THEN '未开班'
+        ELSE '其他' END AS classStart,
+        FROM_UNIXTIME( cg.class_end_time, '%Y-%m-%d %H:%i:%s' ) AS classEndTime,
+        CASE
+        WHEN o.order_status = 0 THEN '待支付'
+        WHEN o.order_status = 1 THEN '已支付'
+        WHEN o.order_status = -1 OR o.order_status = -2 THEN '已关闭'
+        WHEN o.order_status = 3 OR o.order_status = 4 THEN '已退款'
+        ELSE '其他' END AS orderStatus,
+        CONCAT((
+        ((SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr  where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = og.grade_id and ubr.order_goods_id = og.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) +
+        (
+        SELECT
+        COUNT( DISTINCT course_id, module_id, chapter_id, section_id )
         FROM
-            order_goods og
-        LEFT JOIN `order` o ON og.order_sn = o.order_sn
-        LEFT JOIN `user` u ON o.user_id = u.user_id
+        user_study_record
+        WHERE
+        current_status = 1
+        AND grade_id = og.grade_id
+        AND order_goods_id = og.order_goods_id
+        AND user_id = o.user_id
+        AND status = 1
+        AND goods_id = og.goods_id
+        ))),"/",og.course_num + og.exam_num) AS studySchedule
+        FROM
+        `order` o
+        LEFT JOIN order_goods og ON o.order_sn = og.order_sn
         LEFT JOIN goods g ON og.goods_id = g.goods_id
+        LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
         LEFT JOIN major m ON g.major_id = m.id
+        LEFT JOIN `user` u ON o.user_id = u.user_id
+        LEFT JOIN class_grade_user cgu ON og.order_goods_id = cgu.order_goods_id
+        LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
         WHERE
-        og.refund_status != 2
-        AND og.pay_status != 1
+        1=1
+        AND og.`status` = 1
+        AND o.input_order_sn IS NULL
         <if test="orderSn != null and orderSn != ''">
             AND o.order_sn = #{orderSn}
         </if>
+        <if test="orderSnList != null and orderSnList.size()!=0">
+            AND o.order_sn in
+            <foreach collection="orderSnList" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="orderStartTime != null and orderStartTime != ''">
             AND og.create_time <![CDATA[ >= ]]> #{orderStartTime}
         </if>
@@ -778,6 +859,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="companyName != null and companyName != ''">
             AND u.company_name = #{companyName}
         </if>
+        ORDER BY og.create_time DESC
     </select>
 
     <select id="getSevenOrder" parameterType="com.zhongzheng.modules.order.bo.RepetitionOrderBo"