Просмотр исходного кода

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

zhouyy 4 месяцев назад
Родитель
Сommit
2216c75c34

BIN
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/assets/image/chongqi.png


BIN
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/assets/image/lianxir.png


BIN
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/assets/image/module/contract.png


BIN
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/assets/image/module/min_contract.png


BIN
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/assets/image/wanc.png


BIN
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/assets/image/yanqi.png


+ 3 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/addEditor.vue

@@ -96,7 +96,9 @@ function judgmentaAmounteEqual(mob, arr) {
   }
   let flag = false;
   const amounte = +mob.amountOfMoney || 0;
-  const totalAmounte = arr.reduce((pre, cur) => pre + (cur.totalPrice || 0), 0);
+  const totalAmounte = arr.reduce((pre, cur) => pre + (+cur.totalPrice || 0), 0);
+
+  console.log(amounte, totalAmounte)
 
   if (amounte != totalAmounte) {
     toastText(`商机金额${amounte > totalAmounte ? '大于' : '小于'}产品总金额,${amounte > totalAmounte ? '保存中...' : '请修改'}`)

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/product/newAndModifiedRelatedProducts.vue

@@ -163,8 +163,8 @@ function selectChange(value, label) {
 
 function inputNumberChange(field) {
     const { sellingPrice, quantity, discount, price } = props.form
-    props.form.discount = field == 'sellingPrice' ? Math.round(sellingPrice / price * 100) : props.form.discount
-    props.form.sellingPrice = field == 'discount' ? Math.round(price * discount / 100) : props.form.sellingPrice
+    // props.form.discount = field == 'sellingPrice' ? Math.round(sellingPrice / price * 100) : props.form.discount
+    // props.form.sellingPrice = field == 'discount' ? Math.round(price * discount / 100) : props.form.sellingPrice
     if (sellingPrice && quantity && price && discount) {
         props.form.totalPrice = Math.round(Math.round(price * discount / 100) * quantity)
     }

+ 57 - 9
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/visitorProgram/visitorDetails.vue

@@ -55,7 +55,7 @@
 
       <van-popup v-model:show="showDelay" closeable position="bottom" round>
         <div class="newModuleAdded relative">
-          <div class="text-size-large text-[#474A56] absolute topTitle">延期时间</div>
+          <div class="text-size-large text-[#474A56] absolute topTitle">{{ delayRestartText }}时间</div>
           <div class="flex flex-col overflow-y-auto h-52">
             <div class="flex-1">
               <div class="px-6 py-4 bg-[#F8F8FA] flex justify-between items-center mt-2" @click="showDatePicker = true">
@@ -83,20 +83,43 @@
     <template v-slot:footer v-if="detailedData.finishState == 0">
       <div class="w-full flex justify-between layout">
         <div class="footerBtnLeft layouts" @click="showContactsCli()">
-          <div class="imgClss"></div>
+          <div class="imgClss">
+            <img src="/src/assets/image/lianxir.png" alt="">
+          </div>
           联系人
         </div>
-        <div class="footerBtnRight layouts" @click="showDelay = true, showDelayData = ''">
-          <div class="imgClss"></div>
+        <div class="footerBtnRight layouts" @click="delayRestart('DELAY')">
+          <div class="imgClss">
+            <img src="/src/assets/image/yanqi.png" alt="">
+          </div>
           延期
         </div>
         <div class="coverWithWhite"></div>
         <div class="bigCircle" @click="completeThePlan()">
-          <div class="imgClss"></div>
+          <div class="imgClss">
+            <img src="/src/assets/image/wanc.png" alt="">
+          </div>
           完成
         </div>
       </div>
     </template>
+
+    <template v-slot:footer v-if="detailedData.finishState != 0">
+      <div class="w-full flex justify-between layout">
+        <div class="footerBtnTwoLeft layoutsTwo" @click="showContactsCli()">
+          <div class="imgClss">
+            <img src="/src/assets/image/lianxir.png" alt="">
+          </div>
+          联系人
+        </div>
+        <div class="footerBtnTwoLeft layoutsTwo" @click="delayRestart('RESTART')">
+          <div class="imgClss">
+            <img src="/src/assets/image/chongqi.png" alt="">
+          </div>
+          重启
+        </div>
+      </div>
+    </template>
   </Page>
 </template>
 
@@ -124,6 +147,14 @@ const showDatePickerVal = ref(dayjs().format("YYYY-MM-DD").split('-'))
 const showDelayData = ref('')
 const currentTime = ref('')
 const contactList = ref([]);
+const delayRestartText = ref('')
+
+function delayRestart(type = 'DELAY') {
+  const textType = { 'DELAY': '延期', 'RESTART': '重启' }
+  delayRestartText.value = textType[type]
+  showDelay.value = true
+  showDelayData.value = ''
+}
 
 function visitorEditor() {
   router.navigateTo({
@@ -153,7 +184,7 @@ function jumpToCustomerDetails() {
 }
 
 function showContactsCli() {
-  if(!((contactList.value || []).length)) {
+  if (!((contactList.value || []).length)) {
     toastText('该联系人无号码')
     return
   }
@@ -266,13 +297,32 @@ useLifecycle({
     justify-content: center;
   }
 
+  .layoutsTwo {
+    width: 40%;
+    height: 100%;
+    background: #fff;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+  }
+
   .footerBtnLeft {
     border-top-right-radius: 25px;
 
     .imgClss {
       width: 30px;
       height: 30px;
-      background-color: #000;
+      margin-bottom: 6px;
+    }
+  }
+
+  .footerBtnTwoLeft {
+    width: 50%;
+
+    .imgClss {
+      width: 30px;
+      height: 30px;
       margin-bottom: 6px;
     }
   }
@@ -283,7 +333,6 @@ useLifecycle({
     .imgClss {
       width: 26px;
       height: 24px;
-      background-color: #000;
       margin-bottom: 9px;
     }
   }
@@ -321,7 +370,6 @@ useLifecycle({
       width: 25.5px;
       height: 25.5px;
       margin-bottom: 4px;
-      background: #000;
     }
   }
 }

+ 6 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/UserController.java

@@ -112,6 +112,12 @@ public class UserController {
         return userService.loginByUserId(userId, request);
     }
 
+    @RequestMapping("/uploadImage")
+    public HttpRespMsg uploadImage(MultipartFile multipartFile) {
+        return userService.uploadImage(multipartFile, request);
+    }
+
+
     /**
      * 根据id获取用户信息
      * userId 用户id

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/UserService.java

@@ -109,4 +109,6 @@ public interface UserService extends IService<User> {
     HttpRespMsg deleteUserSalaryById(String id);
 
     HttpRespMsg getSimpleActiveUserListNew(Integer departmentId, HttpServletRequest request, String keyword, String cursor) throws Exception;
+
+    HttpRespMsg uploadImage(MultipartFile multipartFile, HttpServletRequest request);
 }

+ 66 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.constant.Constant;
@@ -14,6 +15,7 @@ import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.entity.vo.UserVO;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
+import com.management.platform.task.SFTPAsyncUploader;
 import com.management.platform.util.*;
 import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
 import me.chanjar.weixin.mp.api.WxMpService;
@@ -22,6 +24,8 @@ import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
 import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
 import org.apache.commons.collections4.Put;
 import org.apache.commons.io.FileUtils;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
@@ -101,6 +105,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     @Value("${configEnv.isPrivateDeploy}")
     private boolean isPrivateDeploy;
 
+    Logger logger = LogManager.getLogger(org.apache.logging.log4j.LogManager.ROOT_LOGGER_NAME);
+    @Autowired
+    public SFTPAsyncUploader sftpAsyncUploader;
+
     public static final String GET_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
     public static final String GET_USERINFO_URL = "https://api.weixin.qq.com/sns/userinfo?access_token=accessToken&openid=openId&lang=zh_CN";
     public static final String[] MATCHING_FILED = {"corpwx_userid","phone","job_number"};
@@ -1967,6 +1975,64 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             return msg;
         }
     }
+
+    @Override
+    public HttpRespMsg uploadImage(MultipartFile multipartFile, HttpServletRequest request) {
+        HttpRespMsg msg = new HttpRespMsg();
+        // 处理文件
+        String fileName = multipartFile.getOriginalFilename();
+        String[] split = fileName.split("\\.");
+        String fileExtension = split.length > 1 ? split[split.length - 1].toLowerCase() : ""; // 获取文件扩展名
+        String[] allowedExtensions = {"jpg", "jpeg", "png", "gif"}; // 允许的图片扩展名
+
+        // 检查扩展名是否有效
+        boolean isValidImage = Arrays.stream(allowedExtensions).anyMatch(fileExtension::equals);
+        if (!isValidImage) {
+            msg.setError("只允许上传图片格式的文件!");
+            return msg; // 返回错误信息
+        }
+
+        String serverName = UUID.randomUUID().toString().replaceAll("-", "") + "." + fileExtension;
+
+        // 检查目录
+        File dir = new File(path);
+        if (!dir.exists()) {
+            dir.mkdir();
+        }
+        File file = new File(dir, serverName);
+        InputStream inputStream = null;
+        OutputStream outputStream = null;
+        try {
+            inputStream = multipartFile.getInputStream();
+            outputStream = new FileOutputStream(file);
+            byte[] buffer = new byte[4096];
+            int temp;
+            while ((temp = inputStream.read(buffer)) != -1) {
+                outputStream.write(buffer, 0, temp);
+            }
+
+            // 关闭流
+            inputStream.close();
+            outputStream.close();
+
+            msg.data = serverName;
+
+            // 更新用户头像 URL
+            userMapper.update(null, new UpdateWrapper<User>()
+                    .eq("id", request.getHeader("token"))
+                    .set("portrait_url", serverName));
+
+            // 上传到 SFTP 服务器
+            sftpAsyncUploader.uploadFileAsync(file);
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+            logger.error(exception.getMessage());
+            msg.data = "文件上传失败!";
+        }
+
+        return msg;
+    }
 //
 //    private String getAccessToken(String code) {
 //        String accessToken = "";