فهرست منبع

手机端接口

jzkai 1 ماه پیش
والد
کامیت
589d8922c2

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/MessageInfoDAO.java

@@ -19,4 +19,5 @@ public interface MessageInfoDAO {
 	List<Map> findByRecipientId(String recipientId);
 	List<MessageInfo> findByRecipientIdAndType(@Param("recipientId") String recipientId,@Param("type") String type);
 	List<MessageInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+	int getCount(String type,String senderId, String recipientId);
 }

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/MessageInfoService.java

@@ -16,4 +16,5 @@ public interface MessageInfoService {
 	List<Map> findByRecipientId(String recipientId);
 	List<MessageInfo> findByRecipientIdAndType(String recipientId,String type);
 	Page<MessageInfo> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+	int getCount(String type, String senderId, String recipientId);
 }

+ 6 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/MessageInfoServiceImpl.java

@@ -78,4 +78,10 @@ public class MessageInfoServiceImpl implements MessageInfoService {
         
         return page;
 	}
+
+	@Override
+	public int getCount(String type, String senderId, String recipientId) {
+		// TODO Auto-generated method stub
+		return messageInfoDAO.getCount(type, senderId, recipientId);
+	}
 }

+ 18 - 2
common/src/main/resources/mapper/base/MessageInfo.xml

@@ -114,12 +114,28 @@
 			select * from base_message_info
 		]]>
 		<where>
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+			del_flag = false
+			<if test="searchParams.type != null">
+				and type_ = #{searchParams.type}
+			</if>
+			<if test="searchParams.recipientId != null">
+				and recipient_id = #{searchParams.recipientId}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+	<select id="getCount" resultType="int">
+		SELECT COUNT(*) FROM base_message_info
+		WHERE del_flag = 0
+		AND is_read = 0
+		AND type_ = #{type}
+		<if test="senderId != null">
+			AND sender_id = #{senderId}
+		</if>
+		<if test="recipientId != null">
+			AND recipient_id = #{recipientId}
+		</if>
+	</select>
 </mapper>

+ 18 - 2
common/target/classes/mapper/base/MessageInfo.xml

@@ -114,12 +114,28 @@
 			select * from base_message_info
 		]]>
 		<where>
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+			del_flag = false
+			<if test="searchParams.type != null">
+				and type_ = #{searchParams.type}
+			</if>
+			<if test="searchParams.recipientId != null">
+				and recipient_id = #{searchParams.recipientId}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+	<select id="getCount" resultType="int">
+		SELECT COUNT(*) FROM base_message_info
+		WHERE del_flag = 0
+		AND is_read = 0
+		AND type_ = #{type}
+		<if test="senderId != null">
+			AND sender_id = #{senderId}
+		</if>
+		<if test="recipientId != null">
+			AND recipient_id = #{recipientId}
+		</if>
+	</select>
 </mapper>

+ 123 - 0
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/MessageApiController.java

@@ -0,0 +1,123 @@
+package com.jpsoft.employment.modules.mobile.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.base.entity.*;
+import com.jpsoft.employment.modules.base.service.MessageInfoService;
+import com.jpsoft.employment.modules.base.service.TechnicianInfoService;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.utils.DES3;
+import com.jpsoft.employment.modules.common.utils.JwtUtil;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import com.jpsoft.employment.modules.sys.entity.DataDictionary;
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.*;
+
+@RestController
+@RequestMapping("/mobile/message")
+public class MessageApiController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
+    @Autowired
+    private MessageInfoService messageInfoService;
+
+    @ApiOperation(value="消息类型及数量")
+    @PostMapping("typeList")
+    public MessageResult<List> typeList(HttpServletRequest request) {
+        String subject = (String)request.getAttribute("subject");
+        MessageResult<List> msgResult = new MessageResult<>();
+        List<Map> list = new ArrayList<>();
+
+        try {
+            List<DataDictionary> dataDictionaryList = dataDictionaryService.findByCatalogName("消息分类");
+            for(DataDictionary dataDictionary : dataDictionaryList) {
+                if(!dataDictionary.getName().equals("普通消息")) {
+                    Map<String,Object> map = new HashMap<>();
+                    map.put("name", dataDictionary.getName());
+                    map.put("value", dataDictionary.getValue());
+                    map.put("count", messageInfoService.getCount(dataDictionary.getValue(), null, subject));
+                    list.add(map);
+                }
+            }
+
+            msgResult.setResult(false);
+            msgResult.setData(list);
+        }
+        catch(Exception ex) {
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="消息")
+    @PostMapping("messageList")
+    public MessageResult<Map> messageList(
+            String type, String recipientId,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize) {
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+        if (StringUtils.isNotEmpty(type)) {
+            searchParams.put("type",type);
+        }
+        if (StringUtils.isNotEmpty(recipientId)) {
+            searchParams.put("recipientId",recipientId);
+        }
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("send_time","desc"));
+
+        Page<MessageInfo> page = messageInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(false);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取详情")
+    @GetMapping("edit/{id}")
+    public MessageResult<MessageInfo> edit(@PathVariable("id") String id){
+        MessageResult<MessageInfo> msgResult = new MessageResult<>();
+
+        try {
+            MessageInfo messageInfo = messageInfoService.get(id);
+
+            if (messageInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(messageInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}

+ 158 - 0
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/ResourceApiController.java

@@ -0,0 +1,158 @@
+package com.jpsoft.employment.modules.mobile.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.base.entity.ArgonPartner;
+import com.jpsoft.employment.modules.base.entity.LaborerInfo;
+import com.jpsoft.employment.modules.base.entity.MessageInfo;
+import com.jpsoft.employment.modules.base.entity.TransportationInfo;
+import com.jpsoft.employment.modules.base.service.ArgonPartnerService;
+import com.jpsoft.employment.modules.base.service.LaborerInfoService;
+import com.jpsoft.employment.modules.base.service.MessageInfoService;
+import com.jpsoft.employment.modules.base.service.TransportationInfoService;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import com.jpsoft.employment.modules.sys.entity.DataDictionary;
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/mobile/resource")
+public class ResourceApiController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private ArgonPartnerService argonPartnerService;
+    @Autowired
+    private LaborerInfoService laborerInfoService;
+    @Autowired
+    private TransportationInfoService transportationInfoService;
+
+    @ApiOperation(value="氩气列表")
+    @PostMapping("argonList")
+    public MessageResult<List> argonList() {
+        MessageResult<List> msgResult = new MessageResult<>();
+
+        List<ArgonPartner> argonPartnerList = argonPartnerService.list();
+
+        msgResult.setResult(false);
+        msgResult.setData(argonPartnerList);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="氩气详情")
+    @GetMapping("argonEdit/{id}")
+    public MessageResult<ArgonPartner> argonEdit(@PathVariable("id") String id){
+        MessageResult<ArgonPartner> msgResult = new MessageResult<>();
+
+        try {
+            ArgonPartner argonPartner = argonPartnerService.get(id);
+
+            if (argonPartner != null) {
+                msgResult.setResult(true);
+                msgResult.setData(argonPartner);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="搬运工列表")
+    @PostMapping("laborerList")
+    public MessageResult<List> laborerList() {
+        MessageResult<List> msgResult = new MessageResult<>();
+
+        List<LaborerInfo> laborerInfoList = laborerInfoService.list();
+
+        msgResult.setResult(false);
+        msgResult.setData(laborerInfoList);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="搬运工详情")
+    @GetMapping("laborerEdit/{id}")
+    public MessageResult<LaborerInfo> laborerEdit(@PathVariable("id") String id){
+        MessageResult<LaborerInfo> msgResult = new MessageResult<>();
+
+        try {
+            LaborerInfo laborerInfo = laborerInfoService.get(id);
+
+            if (laborerInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(laborerInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="运输列表")
+    @PostMapping("transportationList")
+    public MessageResult<List> transportationList() {
+        MessageResult<List> msgResult = new MessageResult<>();
+
+        List<TransportationInfo> transportationInfoList = transportationInfoService.list();
+
+        msgResult.setResult(false);
+        msgResult.setData(transportationInfoList);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="运输详情")
+    @GetMapping("transportationEdit/{id}")
+    public MessageResult<TransportationInfo> transportationEdit(@PathVariable("id") String id){
+        MessageResult<TransportationInfo> msgResult = new MessageResult<>();
+
+        try {
+            TransportationInfo transportationInfo = transportationInfoService.get(id);
+
+            if (transportationInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(transportationInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}

+ 44 - 6
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/WorkOrderApiController.java

@@ -42,6 +42,8 @@ public class WorkOrderApiController {
     private ReceiveRequireService receiveRequireService;
     @Autowired
     private ConstructionProgressService constructionProgressService;
+    @Autowired
+    private CommentInfoService commentInfoService;
 
     @ApiOperation(value="列表")
     @RequestMapping(value = "list",method = RequestMethod.POST)
@@ -89,12 +91,14 @@ public class WorkOrderApiController {
             InstallationRequirement installationRequirement = installationRequirementService.findByWorkOrderId(id);
             ReceiveRequire receiveRequire = receiveRequireService.findByWorkOrderId(id);
             List<ConstructionProgress> constructionProgressList = constructionProgressService.findByWorkOrderId(id);
+            List<CommentInfo> commentInfoList = commentInfoService.findByWorkOrderId(id);
 
             if (workOrder != null) {
                 map.put("info",workOrder);
                 map.put("detail",installationRequirement);
                 map.put("require",receiveRequire);
                 map.put("progressList",constructionProgressList);
+                map.put("commentInfoList",commentInfoList);
 
                 msgResult.setResult(true);
                 msgResult.setData(map);
@@ -114,12 +118,12 @@ public class WorkOrderApiController {
     }
 
     @ApiOperation(value="上传凭证")
-    @RequestMapping(value = "updataCertificate",method = RequestMethod.POST)
+    @RequestMapping(value = "uploadCertificate",method = RequestMethod.POST)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "orderId", paramType = "query", required = true, value = "订单编号"),
             @ApiImplicitParam(name = "url", paramType = "query", required = true, value = "图片路径(','分隔)"),
     })
-    public MessageResult<Map> updataCertificate(
+    public MessageResult<Map> uploadCertificate(
             String orderId, String url,
             HttpServletRequest request){
         String subject = (String)request.getAttribute("subject");
@@ -193,12 +197,13 @@ public class WorkOrderApiController {
     }
 
     @ApiOperation(value="上传施工进度")
-    @RequestMapping(value = "updataProgress",method = RequestMethod.POST)
+    @RequestMapping(value = "uploadProgress",method = RequestMethod.POST)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "orderId", paramType = "query", required = true, value = "订单编号"),
-            @ApiImplicitParam(name = "url", paramType = "query", required = true, value = "图片路径(','分隔)"),
+            @ApiImplicitParam(name = "title", paramType = "query", required = true, value = "进度节点"),
+            @ApiImplicitParam(name = "images", paramType = "query", required = true, value = "图片路径(','分隔)"),
     })
-    public MessageResult<Map> updataProgress(
+    public MessageResult<Map> uploadProgress(
             String orderId, String title, String images,
             HttpServletRequest request){
         String subject = (String)request.getAttribute("subject");
@@ -212,7 +217,7 @@ public class WorkOrderApiController {
         constructionProgress.setSubmitType("2");
         constructionProgress.setSubmitTime(new Date());
         constructionProgress.setWorkOrderId(orderId);
-        constructionProgress.setIndex(constructionProgressService.getIndex(orderId));
+        constructionProgress.setIndex(constructionProgressService.getIndex(orderId) + 1);
         constructionProgress.setDelFlag(false);
         constructionProgress.setCreateBy(subject);
         constructionProgress.setCreateTime(new Date());
@@ -223,4 +228,37 @@ public class WorkOrderApiController {
 
         return msgResult;
     }
+
+    @ApiOperation(value="客户评价")
+    @RequestMapping(value = "customerReviews",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "orderId", paramType = "query", required = true, value = "订单编号"),
+            @ApiImplicitParam(name = "starRating", paramType = "query", required = true, value = "星级"),
+            @ApiImplicitParam(name = "content", paramType = "query", required = true, value = "内容"),
+            @ApiImplicitParam(name = "images", paramType = "query", required = true, value = "图片(','分隔)"),
+    })
+    public MessageResult<Map> customerReviews(
+            String orderId, String starRating, String content, String images,
+            HttpServletRequest request){
+        String subject = (String)request.getAttribute("subject");
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        CommentInfo commentInfo = new CommentInfo();
+        commentInfo.setId(UUID.randomUUID().toString());
+        commentInfo.setCompanyId(subject);
+        commentInfo.setWorkOrderId(orderId);
+        commentInfo.setStarRating(starRating);
+        commentInfo.setContent(content);
+        commentInfo.setImage(images);
+        commentInfo.setDateTime(new Date());
+        commentInfo.setDelFlag(false);
+        commentInfo.setCreateBy(subject);
+        commentInfo.setCreateTime(new Date());
+        commentInfoService.insert(commentInfo);
+
+        msgResult.setResult(true);
+        msgResult.setMessage("保存成功");
+
+        return msgResult;
+    }
 }

BIN
web/target/classes/com/jpsoft/employment/modules/mobile/controller/WorkOrderApiController.class